OLD | NEW |
(Empty) | |
| 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 NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_ |
| 6 #define NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/logging.h" |
| 12 #include "base/string_piece.h" |
| 13 #include "net/base/net_export.h" |
| 14 |
| 15 namespace net { |
| 16 |
| 17 typedef uint32 CryptoTag; |
| 18 typedef std::map<CryptoTag, base::StringPiece> CryptoTagValueMap; |
| 19 struct NET_EXPORT_PRIVATE CryptoHandshakeMessage { |
| 20 CryptoHandshakeMessage(); |
| 21 ~CryptoHandshakeMessage(); |
| 22 CryptoTag tag; |
| 23 CryptoTagValueMap tag_value_map; |
| 24 }; |
| 25 |
| 26 // Crypto tags are written to the wire with a big-endian |
| 27 // representation of the name of the tag. For example |
| 28 // the client hello tag (CHLO) will be written as the |
| 29 // following 4 bytes: 'C' 'H' 'L' 'O'. Since it is |
| 30 // stored in memory as a little endian uint32, we need |
| 31 // to reverse the order of the bytes. |
| 32 #define MAKE_TAG(a,b,c,d) (d << 24) + (c << 16) + (b << 8) + a |
| 33 |
| 34 const CryptoTag kCHLO = MAKE_TAG('C', 'H', 'L', 'O'); // Client hello |
| 35 const CryptoTag kSHLO = MAKE_TAG('S', 'H', 'L', 'O'); // Server hello |
| 36 |
| 37 // AEAD algorithms |
| 38 const CryptoTag kNULL = MAKE_TAG('N', 'U', 'L', 'L'); // null algorithm |
| 39 const CryptoTag kAESH = MAKE_TAG('A', 'E', 'S', 'H'); // AES128 + SHA256 |
| 40 |
| 41 const size_t kMaxEntries = 16; // Max number of entries in a message. |
| 42 |
| 43 } // namespace net |
| 44 |
| 45 #endif // NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_ |
OLD | NEW |