QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef QUICHE_QUIC_CORE_CRYPTO_CRYPTO_PROTOCOL_H_ |
| 6 | #define QUICHE_QUIC_CORE_CRYPTO_CRYPTO_PROTOCOL_H_ |
| 7 | |
| 8 | #include <cstddef> |
vasilvv | 872e7a3 | 2019-03-12 16:42:44 -0700 | [diff] [blame] | 9 | #include <string> |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 10 | |
| 11 | #include "net/third_party/quiche/src/quic/core/quic_tag.h" |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 12 | |
| 13 | // Version and Crypto tags are written to the wire with a big-endian |
| 14 | // representation of the name of the tag. For example |
| 15 | // the client hello tag (CHLO) will be written as the |
| 16 | // following 4 bytes: 'C' 'H' 'L' 'O'. Since it is |
| 17 | // stored in memory as a little endian uint32_t, we need |
| 18 | // to reverse the order of the bytes. |
| 19 | // |
| 20 | // We use a macro to ensure that no static initialisers are created. Use the |
| 21 | // MakeQuicTag function in normal code. |
| 22 | #define TAG(a, b, c, d) \ |
| 23 | static_cast<QuicTag>((d << 24) + (c << 16) + (b << 8) + a) |
| 24 | |
| 25 | namespace quic { |
| 26 | |
vasilvv | c48c871 | 2019-03-11 13:38:16 -0700 | [diff] [blame] | 27 | typedef std::string ServerConfigID; |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 28 | |
wub | 5b352f1 | 2019-05-07 11:45:26 -0700 | [diff] [blame] | 29 | // The following tags have been deprecated and should not be reused: |
wub | 722bad4 | 2019-07-15 11:27:57 -0700 | [diff] [blame] | 30 | // "1CON", "BBQ4", "NCON", "RCID", "SREJ", "TBKP", "TB10" |
wub | 5b352f1 | 2019-05-07 11:45:26 -0700 | [diff] [blame] | 31 | |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 32 | // clang-format off |
| 33 | const QuicTag kCHLO = TAG('C', 'H', 'L', 'O'); // Client hello |
| 34 | const QuicTag kSHLO = TAG('S', 'H', 'L', 'O'); // Server hello |
| 35 | const QuicTag kSCFG = TAG('S', 'C', 'F', 'G'); // Server config |
| 36 | const QuicTag kREJ = TAG('R', 'E', 'J', '\0'); // Reject |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 37 | const QuicTag kCETV = TAG('C', 'E', 'T', 'V'); // Client encrypted tag-value |
| 38 | // pairs |
| 39 | const QuicTag kPRST = TAG('P', 'R', 'S', 'T'); // Public reset |
| 40 | const QuicTag kSCUP = TAG('S', 'C', 'U', 'P'); // Server config update |
| 41 | const QuicTag kALPN = TAG('A', 'L', 'P', 'N'); // Application-layer protocol |
| 42 | |
| 43 | // Key exchange methods |
| 44 | const QuicTag kP256 = TAG('P', '2', '5', '6'); // ECDH, Curve P-256 |
| 45 | const QuicTag kC255 = TAG('C', '2', '5', '5'); // ECDH, Curve25519 |
| 46 | |
| 47 | // AEAD algorithms |
| 48 | const QuicTag kAESG = TAG('A', 'E', 'S', 'G'); // AES128 + GCM-12 |
| 49 | const QuicTag kCC20 = TAG('C', 'C', '2', '0'); // ChaCha20 + Poly1305 RFC7539 |
| 50 | |
| 51 | // Congestion control feedback types |
| 52 | const QuicTag kQBIC = TAG('Q', 'B', 'I', 'C'); // TCP cubic |
| 53 | |
| 54 | // Connection options (COPT) values |
| 55 | const QuicTag kAFCW = TAG('A', 'F', 'C', 'W'); // Auto-tune flow control |
| 56 | // receive windows. |
| 57 | const QuicTag kIFW5 = TAG('I', 'F', 'W', '5'); // Set initial size |
| 58 | // of stream flow control |
| 59 | // receive window to |
| 60 | // 32KB. (2^5 KB). |
| 61 | const QuicTag kIFW6 = TAG('I', 'F', 'W', '6'); // Set initial size |
| 62 | // of stream flow control |
| 63 | // receive window to |
| 64 | // 64KB. (2^6 KB). |
| 65 | const QuicTag kIFW7 = TAG('I', 'F', 'W', '7'); // Set initial size |
| 66 | // of stream flow control |
| 67 | // receive window to |
| 68 | // 128KB. (2^7 KB). |
| 69 | const QuicTag kIFW8 = TAG('I', 'F', 'W', '8'); // Set initial size |
| 70 | // of stream flow control |
| 71 | // receive window to |
| 72 | // 256KB. (2^8 KB). |
| 73 | const QuicTag kIFW9 = TAG('I', 'F', 'W', '9'); // Set initial size |
| 74 | // of stream flow control |
| 75 | // receive window to |
| 76 | // 512KB. (2^9 KB). |
| 77 | const QuicTag kIFWA = TAG('I', 'F', 'W', 'a'); // Set initial size |
| 78 | // of stream flow control |
| 79 | // receive window to |
| 80 | // 1MB. (2^0xa KB). |
| 81 | const QuicTag kTBBR = TAG('T', 'B', 'B', 'R'); // Reduced Buffer Bloat TCP |
| 82 | const QuicTag k1RTT = TAG('1', 'R', 'T', 'T'); // STARTUP in BBR for 1 RTT |
| 83 | const QuicTag k2RTT = TAG('2', 'R', 'T', 'T'); // STARTUP in BBR for 2 RTTs |
| 84 | const QuicTag kLRTT = TAG('L', 'R', 'T', 'T'); // Exit STARTUP in BBR on loss |
| 85 | const QuicTag kBBS1 = TAG('B', 'B', 'S', '1'); // Rate-based recovery in |
| 86 | // BBR STARTUP |
| 87 | const QuicTag kBBS2 = TAG('B', 'B', 'S', '2'); // More aggressive packet |
| 88 | // conservation in BBR STARTUP |
| 89 | const QuicTag kBBS3 = TAG('B', 'B', 'S', '3'); // Slowstart packet |
| 90 | // conservation in BBR STARTUP |
| 91 | const QuicTag kBBS4 = TAG('B', 'B', 'S', '4'); // Reduce rate in STARTUP by |
| 92 | // bytes_lost / CWND. |
| 93 | const QuicTag kBBS5 = TAG('B', 'B', 'S', '5'); // Reduce rate in STARTUP by |
| 94 | // 2 * bytes_lost / CWND. |
| 95 | const QuicTag kBBRR = TAG('B', 'B', 'R', 'R'); // Rate-based recovery in BBR |
| 96 | const QuicTag kBBR1 = TAG('B', 'B', 'R', '1'); // DEPRECATED |
| 97 | const QuicTag kBBR2 = TAG('B', 'B', 'R', '2'); // DEPRECATED |
| 98 | const QuicTag kBBR3 = TAG('B', 'B', 'R', '3'); // Fully drain the queue once |
| 99 | // per cycle |
| 100 | const QuicTag kBBR4 = TAG('B', 'B', 'R', '4'); // 20 RTT ack aggregation |
| 101 | const QuicTag kBBR5 = TAG('B', 'B', 'R', '5'); // 40 RTT ack aggregation |
| 102 | const QuicTag kBBR6 = TAG('B', 'B', 'R', '6'); // PROBE_RTT with 0.75 * BDP |
| 103 | const QuicTag kBBR7 = TAG('B', 'B', 'R', '7'); // Skip PROBE_RTT if rtt has |
| 104 | // not changed 12.5% |
| 105 | const QuicTag kBBR8 = TAG('B', 'B', 'R', '8'); // Disable PROBE_RTT when |
| 106 | // recently app-limited |
| 107 | const QuicTag kBBR9 = TAG('B', 'B', 'R', '9'); // Ignore app-limited calls in |
| 108 | // BBR if enough inflight. |
| 109 | const QuicTag kBBRS = TAG('B', 'B', 'R', 'S'); // Use 1.5x pacing in startup |
| 110 | // after a loss has occurred. |
| 111 | const QuicTag kBBQ1 = TAG('B', 'B', 'Q', '1'); // BBR with lower 2.77 STARTUP |
| 112 | // pacing and CWND gain. |
| 113 | const QuicTag kBBQ2 = TAG('B', 'B', 'Q', '2'); // BBR with lower 2.0 STARTUP |
| 114 | // CWND gain. |
| 115 | const QuicTag kBBQ3 = TAG('B', 'B', 'Q', '3'); // BBR with ack aggregation |
| 116 | // compensation in STARTUP. |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 117 | const QuicTag kBBQ5 = TAG('B', 'B', 'Q', '5'); // Expire ack aggregation upon |
| 118 | // bandwidth increase in |
| 119 | // STARTUP. |
| 120 | const QuicTag kRENO = TAG('R', 'E', 'N', 'O'); // Reno Congestion Control |
| 121 | const QuicTag kTPCC = TAG('P', 'C', 'C', '\0'); // Performance-Oriented |
| 122 | // Congestion Control |
| 123 | const QuicTag kBYTE = TAG('B', 'Y', 'T', 'E'); // TCP cubic or reno in bytes |
| 124 | const QuicTag kIW03 = TAG('I', 'W', '0', '3'); // Force ICWND to 3 |
| 125 | const QuicTag kIW10 = TAG('I', 'W', '1', '0'); // Force ICWND to 10 |
| 126 | const QuicTag kIW20 = TAG('I', 'W', '2', '0'); // Force ICWND to 20 |
| 127 | const QuicTag kIW50 = TAG('I', 'W', '5', '0'); // Force ICWND to 50 |
wub | a9a43cb | 2019-07-17 15:22:42 -0700 | [diff] [blame] | 128 | const QuicTag kB2ON = TAG('B', '2', 'O', 'N'); // Enable BBRv2 |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 129 | const QuicTag kNTLP = TAG('N', 'T', 'L', 'P'); // No tail loss probe |
| 130 | const QuicTag k1TLP = TAG('1', 'T', 'L', 'P'); // 1 tail loss probe |
| 131 | const QuicTag k1RTO = TAG('1', 'R', 'T', 'O'); // Send 1 packet upon RTO |
| 132 | const QuicTag kNRTO = TAG('N', 'R', 'T', 'O'); // CWND reduction on loss |
| 133 | const QuicTag kTIME = TAG('T', 'I', 'M', 'E'); // Time based loss detection |
| 134 | const QuicTag kATIM = TAG('A', 'T', 'I', 'M'); // Adaptive time loss detection |
| 135 | const QuicTag kMIN1 = TAG('M', 'I', 'N', '1'); // Min CWND of 1 packet |
| 136 | const QuicTag kMIN4 = TAG('M', 'I', 'N', '4'); // Min CWND of 4 packets, |
| 137 | // with a min rate of 1 BDP. |
| 138 | const QuicTag kTLPR = TAG('T', 'L', 'P', 'R'); // Tail loss probe delay of |
| 139 | // 0.5RTT. |
| 140 | const QuicTag kMAD0 = TAG('M', 'A', 'D', '0'); // Ignore ack delay |
| 141 | const QuicTag kMAD1 = TAG('M', 'A', 'D', '1'); // 25ms initial max ack delay |
| 142 | const QuicTag kMAD2 = TAG('M', 'A', 'D', '2'); // No min TLP |
| 143 | const QuicTag kMAD3 = TAG('M', 'A', 'D', '3'); // No min RTO |
| 144 | const QuicTag kMAD4 = TAG('M', 'A', 'D', '4'); // IETF style TLP |
| 145 | const QuicTag kMAD5 = TAG('M', 'A', 'D', '5'); // IETF style TLP with 2x mult |
| 146 | const QuicTag kACD0 = TAG('A', 'D', 'D', '0'); // Disable ack decimation |
| 147 | const QuicTag kACKD = TAG('A', 'C', 'K', 'D'); // Ack decimation style acking. |
| 148 | const QuicTag kAKD2 = TAG('A', 'K', 'D', '2'); // Ack decimation tolerating |
| 149 | // out of order packets. |
| 150 | const QuicTag kAKD3 = TAG('A', 'K', 'D', '3'); // Ack decimation style acking |
| 151 | // with 1/8 RTT acks. |
| 152 | const QuicTag kAKD4 = TAG('A', 'K', 'D', '4'); // Ack decimation with 1/8 RTT |
| 153 | // tolerating out of order. |
| 154 | const QuicTag kAKDU = TAG('A', 'K', 'D', 'U'); // Unlimited number of packets |
| 155 | // received before acking |
| 156 | const QuicTag kACKQ = TAG('A', 'C', 'K', 'Q'); // Send an immediate ack after |
| 157 | // 1 RTT of not receiving. |
| 158 | const QuicTag kSSLR = TAG('S', 'S', 'L', 'R'); // Slow Start Large Reduction. |
| 159 | const QuicTag kNPRR = TAG('N', 'P', 'R', 'R'); // Pace at unity instead of PRR |
| 160 | const QuicTag k5RTO = TAG('5', 'R', 'T', 'O'); // Close connection on 5 RTOs |
| 161 | const QuicTag kCONH = TAG('C', 'O', 'N', 'H'); // Conservative Handshake |
| 162 | // Retransmissions. |
| 163 | const QuicTag kLFAK = TAG('L', 'F', 'A', 'K'); // Don't invoke FACK on the |
| 164 | // first ack. |
| 165 | const QuicTag kSTMP = TAG('S', 'T', 'M', 'P'); // Send and process timestamps |
fayang | b0c7b4b | 2019-09-12 06:45:24 -0700 | [diff] [blame] | 166 | |
| 167 | const QuicTag kILD0 = TAG('I', 'L', 'D', '0'); // IETF style loss detection |
| 168 | // (default with 1/8 RTT time |
| 169 | // threshold) |
| 170 | const QuicTag kILD1 = TAG('I', 'L', 'D', '1'); // IETF style loss detection |
| 171 | // with 1/4 RTT time threshold |
| 172 | const QuicTag kILD2 = TAG('I', 'L', 'D', '2'); // IETF style loss detection |
| 173 | // with adaptive packet |
| 174 | // threshold |
| 175 | const QuicTag kILD3 = TAG('I', 'L', 'D', '3'); // IETF style loss detection |
| 176 | // with 1/4 RTT time threshold |
| 177 | // and adaptive packet |
| 178 | // threshold |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 179 | // TODO(fayang): Remove this connection option when QUIC_VERSION_35, is removed |
| 180 | // Since MAX_HEADER_LIST_SIZE settings frame is supported instead. |
| 181 | const QuicTag kSMHL = TAG('S', 'M', 'H', 'L'); // Support MAX_HEADER_LIST_SIZE |
| 182 | // settings frame. |
| 183 | const QuicTag kNSTP = TAG('N', 'S', 'T', 'P'); // No stop waiting frames. |
| 184 | const QuicTag kNRTT = TAG('N', 'R', 'T', 'T'); // Ignore initial RTT |
| 185 | |
fayang | ce0a316 | 2019-08-15 09:05:36 -0700 | [diff] [blame] | 186 | const QuicTag k1PTO = TAG('1', 'P', 'T', 'O'); // Send 1 packet upon PTO. |
| 187 | const QuicTag k2PTO = TAG('2', 'P', 'T', 'O'); // Send 2 packets upon PTO. |
| 188 | |
| 189 | const QuicTag k7PTO = TAG('7', 'P', 'T', 'O'); // Closes connection on 7 |
| 190 | // consecutive PTOs. |
| 191 | const QuicTag k8PTO = TAG('8', 'P', 'T', 'O'); // Closes connection on 8 |
| 192 | // consecutive PTOs. |
fayang | 4c1c236 | 2019-09-13 07:20:01 -0700 | [diff] [blame] | 193 | const QuicTag kPTOS = TAG('P', 'T', 'O', 'S'); // Skip packet number before |
| 194 | // sending the last PTO. |
fayang | ce0a316 | 2019-08-15 09:05:36 -0700 | [diff] [blame] | 195 | |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 196 | // Optional support of truncated Connection IDs. If sent by a peer, the value |
| 197 | // is the minimum number of bytes allowed for the connection ID sent to the |
| 198 | // peer. |
| 199 | const QuicTag kTCID = TAG('T', 'C', 'I', 'D'); // Connection ID truncation. |
| 200 | |
| 201 | // Multipath option. |
| 202 | const QuicTag kMPTH = TAG('M', 'P', 'T', 'H'); // Enable multipath. |
| 203 | |
| 204 | const QuicTag kNCMR = TAG('N', 'C', 'M', 'R'); // Do not attempt connection |
| 205 | // migration. |
| 206 | |
| 207 | // Disable Pacing offload option. |
| 208 | const QuicTag kNPCO = TAG('N', 'P', 'C', 'O'); // No pacing offload. |
| 209 | |
| 210 | // Enable bandwidth resumption experiment. |
| 211 | const QuicTag kBWRE = TAG('B', 'W', 'R', 'E'); // Bandwidth resumption. |
| 212 | const QuicTag kBWMX = TAG('B', 'W', 'M', 'X'); // Max bandwidth resumption. |
| 213 | const QuicTag kBWRS = TAG('B', 'W', 'R', 'S'); // Server bandwidth resumption. |
| 214 | const QuicTag kBWS2 = TAG('B', 'W', 'S', '2'); // Server bw resumption v2. |
wub | 5377f61 | 2019-04-29 12:55:36 -0700 | [diff] [blame] | 215 | const QuicTag kBWS3 = TAG('B', 'W', 'S', '3'); // QUIC Initial CWND - Control. |
| 216 | const QuicTag kBWS4 = TAG('B', 'W', 'S', '4'); // QUIC Initial CWND - Enabled. |
fayang | f1b99dc | 2019-05-14 06:29:18 -0700 | [diff] [blame] | 217 | const QuicTag kBWS5 = TAG('B', 'W', 'S', '5'); // QUIC Initial CWND up and down |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 218 | |
| 219 | // Enable path MTU discovery experiment. |
| 220 | const QuicTag kMTUH = TAG('M', 'T', 'U', 'H'); // High-target MTU discovery. |
| 221 | const QuicTag kMTUL = TAG('M', 'T', 'U', 'L'); // Low-target MTU discovery. |
| 222 | |
fayang | 944cfbc | 2019-07-31 09:15:00 -0700 | [diff] [blame] | 223 | // Enable Priority scheme experiment. |
| 224 | const QuicTag kH2PR = TAG('H', '2', 'P', 'R'); // HTTP2 priorities. |
fayang | e606e0c | 2019-08-05 06:56:05 -0700 | [diff] [blame] | 225 | const QuicTag kFIFO = TAG('F', 'I', 'F', 'O'); // Stream with the smallest ID |
| 226 | // has the highest priority. |
fayang | ae26634 | 2019-08-05 12:19:59 -0700 | [diff] [blame] | 227 | const QuicTag kLIFO = TAG('L', 'I', 'F', 'O'); // Stream with the largest ID |
| 228 | // has the highest priority. |
fayang | 1b11b96 | 2019-09-16 14:01:48 -0700 | [diff] [blame] | 229 | const QuicTag kRRWS = TAG('R', 'R', 'W', 'S'); // Round robin write scheduling. |
fayang | 944cfbc | 2019-07-31 09:15:00 -0700 | [diff] [blame] | 230 | |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 231 | // Proof types (i.e. certificate types) |
| 232 | // NOTE: although it would be silly to do so, specifying both kX509 and kX59R |
| 233 | // is allowed and is equivalent to specifying only kX509. |
| 234 | const QuicTag kX509 = TAG('X', '5', '0', '9'); // X.509 certificate, all key |
| 235 | // types |
| 236 | const QuicTag kX59R = TAG('X', '5', '9', 'R'); // X.509 certificate, RSA keys |
| 237 | // only |
| 238 | const QuicTag kCHID = TAG('C', 'H', 'I', 'D'); // Channel ID. |
| 239 | |
| 240 | // Client hello tags |
| 241 | const QuicTag kVER = TAG('V', 'E', 'R', '\0'); // Version |
| 242 | const QuicTag kNONC = TAG('N', 'O', 'N', 'C'); // The client's nonce |
| 243 | const QuicTag kNONP = TAG('N', 'O', 'N', 'P'); // The client's proof nonce |
| 244 | const QuicTag kKEXS = TAG('K', 'E', 'X', 'S'); // Key exchange methods |
| 245 | const QuicTag kAEAD = TAG('A', 'E', 'A', 'D'); // Authenticated |
| 246 | // encryption algorithms |
| 247 | const QuicTag kCOPT = TAG('C', 'O', 'P', 'T'); // Connection options |
| 248 | const QuicTag kCLOP = TAG('C', 'L', 'O', 'P'); // Client connection options |
| 249 | const QuicTag kICSL = TAG('I', 'C', 'S', 'L'); // Idle network timeout |
| 250 | const QuicTag kSCLS = TAG('S', 'C', 'L', 'S'); // Silently close on timeout |
fkastenholz | d3a1de9 | 2019-05-15 07:00:07 -0700 | [diff] [blame] | 251 | const QuicTag kMIBS = TAG('M', 'I', 'D', 'S'); // Max incoming bidi streams |
| 252 | const QuicTag kMIUS = TAG('M', 'I', 'U', 'S'); // Max incoming unidi streams |
fkastenholz | 4dc4ba3 | 2019-07-30 09:55:25 -0700 | [diff] [blame] | 253 | const QuicTag kADE = TAG('A', 'D', 'E', 0); // Ack Delay Exponent (IETF |
| 254 | // QUIC ACK Frame Only). |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 255 | const QuicTag kIRTT = TAG('I', 'R', 'T', 'T'); // Estimated initial RTT in us. |
| 256 | const QuicTag kSNI = TAG('S', 'N', 'I', '\0'); // Server name |
| 257 | // indication |
| 258 | const QuicTag kPUBS = TAG('P', 'U', 'B', 'S'); // Public key values |
| 259 | const QuicTag kSCID = TAG('S', 'C', 'I', 'D'); // Server config id |
| 260 | const QuicTag kORBT = TAG('O', 'B', 'I', 'T'); // Server orbit. |
| 261 | const QuicTag kPDMD = TAG('P', 'D', 'M', 'D'); // Proof demand. |
| 262 | const QuicTag kPROF = TAG('P', 'R', 'O', 'F'); // Proof (signature). |
| 263 | const QuicTag kCCS = TAG('C', 'C', 'S', 0); // Common certificate set |
| 264 | const QuicTag kCCRT = TAG('C', 'C', 'R', 'T'); // Cached certificate |
| 265 | const QuicTag kEXPY = TAG('E', 'X', 'P', 'Y'); // Expiry |
| 266 | const QuicTag kSTTL = TAG('S', 'T', 'T', 'L'); // Server Config TTL |
| 267 | const QuicTag kSFCW = TAG('S', 'F', 'C', 'W'); // Initial stream flow control |
| 268 | // receive window. |
| 269 | const QuicTag kCFCW = TAG('C', 'F', 'C', 'W'); // Initial session/connection |
| 270 | // flow control receive window. |
| 271 | const QuicTag kUAID = TAG('U', 'A', 'I', 'D'); // Client's User Agent ID. |
| 272 | const QuicTag kXLCT = TAG('X', 'L', 'C', 'T'); // Expected leaf certificate. |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 273 | |
fkastenholz | 4c7303c | 2019-07-29 08:17:07 -0700 | [diff] [blame] | 274 | const QuicTag kMAD = TAG('M', 'A', 'D', 0); // Max Ack Delay (IETF QUIC) |
| 275 | |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 276 | // Rejection tags |
| 277 | const QuicTag kRREJ = TAG('R', 'R', 'E', 'J'); // Reasons for server sending |
wub | 0a4b9c5 | 2019-05-28 13:18:58 -0700 | [diff] [blame] | 278 | |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 279 | // Server hello tags |
| 280 | const QuicTag kCADR = TAG('C', 'A', 'D', 'R'); // Client IP address and port |
| 281 | const QuicTag kASAD = TAG('A', 'S', 'A', 'D'); // Alternate Server IP address |
| 282 | // and port. |
| 283 | const QuicTag kSRST = TAG('S', 'R', 'S', 'T'); // Stateless reset token used |
| 284 | // in IETF public reset packet |
| 285 | |
| 286 | // CETV tags |
| 287 | const QuicTag kCIDK = TAG('C', 'I', 'D', 'K'); // ChannelID key |
| 288 | const QuicTag kCIDS = TAG('C', 'I', 'D', 'S'); // ChannelID signature |
| 289 | |
| 290 | // Public reset tags |
| 291 | const QuicTag kRNON = TAG('R', 'N', 'O', 'N'); // Public reset nonce proof |
| 292 | const QuicTag kRSEQ = TAG('R', 'S', 'E', 'Q'); // Rejected packet number |
| 293 | |
| 294 | // Universal tags |
| 295 | const QuicTag kPAD = TAG('P', 'A', 'D', '\0'); // Padding |
| 296 | |
| 297 | // Stats collection tags |
| 298 | const QuicTag kEPID = TAG('E', 'P', 'I', 'D'); // Endpoint identifier. |
| 299 | |
| 300 | // clang-format on |
| 301 | |
| 302 | // These tags have a special form so that they appear either at the beginning |
| 303 | // or the end of a handshake message. Since handshake messages are sorted by |
| 304 | // tag value, the tags with 0 at the end will sort first and those with 255 at |
| 305 | // the end will sort last. |
| 306 | // |
| 307 | // The certificate chain should have a tag that will cause it to be sorted at |
| 308 | // the end of any handshake messages because it's likely to be large and the |
| 309 | // client might be able to get everything that it needs from the small values at |
| 310 | // the beginning. |
| 311 | // |
| 312 | // Likewise tags with random values should be towards the beginning of the |
| 313 | // message because the server mightn't hold state for a rejected client hello |
| 314 | // and therefore the client may have issues reassembling the rejection message |
| 315 | // in the event that it sent two client hellos. |
| 316 | const QuicTag kServerNonceTag = TAG('S', 'N', 'O', 0); // The server's nonce |
| 317 | const QuicTag kSourceAddressTokenTag = |
| 318 | TAG('S', 'T', 'K', 0); // Source-address token |
| 319 | const QuicTag kCertificateTag = TAG('C', 'R', 'T', 255); // Certificate chain |
| 320 | const QuicTag kCertificateSCTTag = |
| 321 | TAG('C', 'S', 'C', 'T'); // Signed cert timestamp (RFC6962) of leaf cert. |
| 322 | |
| 323 | #undef TAG |
| 324 | |
| 325 | const size_t kMaxEntries = 128; // Max number of entries in a message. |
| 326 | |
| 327 | const size_t kNonceSize = 32; // Size in bytes of the connection nonce. |
| 328 | |
| 329 | const size_t kOrbitSize = 8; // Number of bytes in an orbit value. |
| 330 | |
| 331 | // kProofSignatureLabel is prepended to the CHLO hash and server configs before |
| 332 | // signing to avoid any cross-protocol attacks on the signature. |
| 333 | const char kProofSignatureLabel[] = "QUIC CHLO and server config signature"; |
| 334 | |
| 335 | // kClientHelloMinimumSize is the minimum size of a client hello. Client hellos |
| 336 | // will have PAD tags added in order to ensure this minimum is met and client |
| 337 | // hellos smaller than this will be an error. This minimum size reduces the |
| 338 | // amplification factor of any mirror DoS attack. |
| 339 | // |
| 340 | // A client may pad an inchoate client hello to a size larger than |
| 341 | // kClientHelloMinimumSize to make it more likely to receive a complete |
| 342 | // rejection message. |
| 343 | const size_t kClientHelloMinimumSize = 1024; |
| 344 | |
| 345 | } // namespace quic |
| 346 | |
| 347 | #endif // QUICHE_QUIC_CORE_CRYPTO_CRYPTO_PROTOCOL_H_ |