| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_ | 5 #ifndef NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_ |
| 6 #define NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_ | 6 #define NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_ |
| 7 | 7 |
| 8 #include <map> | |
| 9 #include <string> | 8 #include <string> |
| 10 #include <vector> | |
| 11 | 9 |
| 12 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
| 13 #include "net/quic/quic_protocol.h" | 11 #include "net/quic/quic_protocol.h" |
| 14 | 12 |
| 15 // Version and Crypto tags are written to the wire with a big-endian | 13 // Version and Crypto tags are written to the wire with a big-endian |
| 16 // representation of the name of the tag. For example | 14 // representation of the name of the tag. For example |
| 17 // the client hello tag (CHLO) will be written as the | 15 // the client hello tag (CHLO) will be written as the |
| 18 // following 4 bytes: 'C' 'H' 'L' 'O'. Since it is | 16 // following 4 bytes: 'C' 'H' 'L' 'O'. Since it is |
| 19 // stored in memory as a little endian uint32, we need | 17 // stored in memory as a little endian uint32, we need |
| 20 // to reverse the order of the bytes. | 18 // to reverse the order of the bytes. |
| 21 // | 19 // |
| 22 // We use a macro to ensure that no static initialisers are created. Use the | 20 // We use a macro to ensure that no static initialisers are created. Use the |
| 23 // MakeQuicTag function in normal code. | 21 // MakeQuicTag function in normal code. |
| 24 #define TAG(a, b, c, d) ((d << 24) + (c << 16) + (b << 8) + a) | 22 #define TAG(a, b, c, d) ((d << 24) + (c << 16) + (b << 8) + a) |
| 25 | 23 |
| 26 namespace net { | 24 namespace net { |
| 27 | 25 |
| 28 typedef std::string ServerConfigID; | 26 typedef std::string ServerConfigID; |
| 29 typedef std::map<QuicTag, std::string> QuicTagValueMap; | |
| 30 | 27 |
| 31 const QuicTag kCHLO = TAG('C', 'H', 'L', 'O'); // Client hello | 28 const QuicTag kCHLO = TAG('C', 'H', 'L', 'O'); // Client hello |
| 32 const QuicTag kSHLO = TAG('S', 'H', 'L', 'O'); // Server hello | 29 const QuicTag kSHLO = TAG('S', 'H', 'L', 'O'); // Server hello |
| 33 const QuicTag kSCFG = TAG('S', 'C', 'F', 'G'); // Server config | 30 const QuicTag kSCFG = TAG('S', 'C', 'F', 'G'); // Server config |
| 34 const QuicTag kREJ = TAG('R', 'E', 'J', '\0'); // Reject | 31 const QuicTag kREJ = TAG('R', 'E', 'J', '\0'); // Reject |
| 35 const QuicTag kCETV = TAG('C', 'E', 'T', 'V'); // Client encrypted tag-value | 32 const QuicTag kCETV = TAG('C', 'E', 'T', 'V'); // Client encrypted tag-value |
| 36 // pairs | 33 // pairs |
| 34 const QuicTag kPRST = TAG('P', 'R', 'S', 'T'); // Public reset |
| 37 | 35 |
| 38 // Key exchange methods | 36 // Key exchange methods |
| 39 const QuicTag kP256 = TAG('P', '2', '5', '6'); // ECDH, Curve P-256 | 37 const QuicTag kP256 = TAG('P', '2', '5', '6'); // ECDH, Curve P-256 |
| 40 const QuicTag kC255 = TAG('C', '2', '5', '5'); // ECDH, Curve25519 | 38 const QuicTag kC255 = TAG('C', '2', '5', '5'); // ECDH, Curve25519 |
| 41 | 39 |
| 42 // AEAD algorithms | 40 // AEAD algorithms |
| 43 const QuicTag kNULL = TAG('N', 'U', 'L', 'N'); // null algorithm | 41 const QuicTag kNULL = TAG('N', 'U', 'L', 'N'); // null algorithm |
| 44 const QuicTag kAESG = TAG('A', 'E', 'S', 'G'); // AES128 + GCM-12 | 42 const QuicTag kAESG = TAG('A', 'E', 'S', 'G'); // AES128 + GCM-12 |
| 45 | 43 |
| 46 // Congestion control feedback types | 44 // Congestion control feedback types |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // indication | 76 // indication |
| 79 const QuicTag kPUBS = TAG('P', 'U', 'B', 'S'); // Public key values | 77 const QuicTag kPUBS = TAG('P', 'U', 'B', 'S'); // Public key values |
| 80 const QuicTag kSCID = TAG('S', 'C', 'I', 'D'); // Server config id | 78 const QuicTag kSCID = TAG('S', 'C', 'I', 'D'); // Server config id |
| 81 const QuicTag kORBT = TAG('O', 'B', 'I', 'T'); // Server orbit. | 79 const QuicTag kORBT = TAG('O', 'B', 'I', 'T'); // Server orbit. |
| 82 const QuicTag kPDMD = TAG('P', 'D', 'M', 'D'); // Proof demand. | 80 const QuicTag kPDMD = TAG('P', 'D', 'M', 'D'); // Proof demand. |
| 83 const QuicTag kPROF = TAG('P', 'R', 'O', 'F'); // Proof (signature). | 81 const QuicTag kPROF = TAG('P', 'R', 'O', 'F'); // Proof (signature). |
| 84 const QuicTag kCCS = TAG('C', 'C', 'S', 0); // Common certificate set | 82 const QuicTag kCCS = TAG('C', 'C', 'S', 0); // Common certificate set |
| 85 const QuicTag kCCRT = TAG('C', 'C', 'R', 'T'); // Cached certificate | 83 const QuicTag kCCRT = TAG('C', 'C', 'R', 'T'); // Cached certificate |
| 86 const QuicTag kEXPY = TAG('E', 'X', 'P', 'Y'); // Expiry | 84 const QuicTag kEXPY = TAG('E', 'X', 'P', 'Y'); // Expiry |
| 87 | 85 |
| 86 // Server hello tags |
| 87 const QuicTag kCADR = TAG('C', 'A', 'D', 'R'); // Client IP address and port |
| 88 |
| 88 // CETV tags | 89 // CETV tags |
| 89 const QuicTag kCIDK = TAG('C', 'I', 'D', 'K'); // ChannelID key | 90 const QuicTag kCIDK = TAG('C', 'I', 'D', 'K'); // ChannelID key |
| 90 const QuicTag kCIDS = TAG('C', 'I', 'D', 'S'); // ChannelID signature | 91 const QuicTag kCIDS = TAG('C', 'I', 'D', 'S'); // ChannelID signature |
| 91 | 92 |
| 92 // Server hello tags | 93 // Public reset tags |
| 93 const QuicTag kCADR = TAG('C', 'A', 'D', 'R'); // Client IP address and port | 94 const QuicTag kRNON = TAG('R', 'N', 'O', 'N'); // Public reset nonce proof |
| 95 const QuicTag kRSEQ = TAG('R', 'S', 'E', 'Q'); // Rejected sequence number |
| 94 | 96 |
| 95 // Universal tags | 97 // Universal tags |
| 96 const QuicTag kPAD = TAG('P', 'A', 'D', '\0'); // Padding | 98 const QuicTag kPAD = TAG('P', 'A', 'D', '\0'); // Padding |
| 97 | 99 |
| 98 // These tags have a special form so that they appear either at the beginning | 100 // These tags have a special form so that they appear either at the beginning |
| 99 // or the end of a handshake message. Since handshake messages are sorted by | 101 // or the end of a handshake message. Since handshake messages are sorted by |
| 100 // tag value, the tags with 0 at the end will sort first and those with 255 at | 102 // tag value, the tags with 0 at the end will sort first and those with 255 at |
| 101 // the end will sort last. | 103 // the end will sort last. |
| 102 // | 104 // |
| 103 // The certificate chain should have a tag that will cause it to be sorted at | 105 // The certificate chain should have a tag that will cause it to be sorted at |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 142 |
| 141 // kClientHelloMinimumSizeOld is the previous value of kClientHelloMinimumSize. | 143 // kClientHelloMinimumSizeOld is the previous value of kClientHelloMinimumSize. |
| 142 // To support old clients, the server only enforces this size. | 144 // To support old clients, the server only enforces this size. |
| 143 // TODO(wtc): Replace it with kClientHelloMinimumSize when we drop support for | 145 // TODO(wtc): Replace it with kClientHelloMinimumSize when we drop support for |
| 144 // QUIC_VERSION_12 clients. | 146 // QUIC_VERSION_12 clients. |
| 145 const size_t kClientHelloMinimumSizeOld = 512; | 147 const size_t kClientHelloMinimumSizeOld = 512; |
| 146 | 148 |
| 147 } // namespace net | 149 } // namespace net |
| 148 | 150 |
| 149 #endif // NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_ | 151 #endif // NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_ |
| OLD | NEW |