| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_CORE_CRYPTO_CRYPTO_HANDSHAKE_H_ | 5 #ifndef NET_QUIC_CORE_CRYPTO_CRYPTO_HANDSHAKE_H_ |
| 6 #define NET_QUIC_CORE_CRYPTO_CRYPTO_HANDSHAKE_H_ | 6 #define NET_QUIC_CORE_CRYPTO_CRYPTO_HANDSHAKE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "net/base/net_export.h" | |
| 16 #include "net/quic/core/quic_packets.h" | 15 #include "net/quic/core/quic_packets.h" |
| 16 #include "net/quic/platform/api/quic_export.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 class CommonCertSets; | 20 class CommonCertSets; |
| 21 class KeyExchange; | 21 class KeyExchange; |
| 22 class QuicDecrypter; | 22 class QuicDecrypter; |
| 23 class QuicEncrypter; | 23 class QuicEncrypter; |
| 24 | 24 |
| 25 // HandshakeFailureReason enum values are uploaded to UMA, they cannot be | 25 // HandshakeFailureReason enum values are uploaded to UMA, they cannot be |
| 26 // changed. | 26 // changed. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 INVALID_EXPECTED_LEAF_CERTIFICATE = 21, | 84 INVALID_EXPECTED_LEAF_CERTIFICATE = 21, |
| 85 | 85 |
| 86 MAX_FAILURE_REASON = 22, | 86 MAX_FAILURE_REASON = 22, |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 // These errors will be packed into an uint32_t and we don't want to set the | 89 // These errors will be packed into an uint32_t and we don't want to set the |
| 90 // most significant bit, which may be misinterpreted as the sign bit. | 90 // most significant bit, which may be misinterpreted as the sign bit. |
| 91 static_assert(MAX_FAILURE_REASON <= 32, "failure reason out of sync"); | 91 static_assert(MAX_FAILURE_REASON <= 32, "failure reason out of sync"); |
| 92 | 92 |
| 93 // A CrypterPair contains the encrypter and decrypter for an encryption level. | 93 // A CrypterPair contains the encrypter and decrypter for an encryption level. |
| 94 struct NET_EXPORT_PRIVATE CrypterPair { | 94 struct QUIC_EXPORT_PRIVATE CrypterPair { |
| 95 CrypterPair(); | 95 CrypterPair(); |
| 96 ~CrypterPair(); | 96 ~CrypterPair(); |
| 97 std::unique_ptr<QuicEncrypter> encrypter; | 97 std::unique_ptr<QuicEncrypter> encrypter; |
| 98 std::unique_ptr<QuicDecrypter> decrypter; | 98 std::unique_ptr<QuicDecrypter> decrypter; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 // Parameters negotiated by the crypto handshake. | 101 // Parameters negotiated by the crypto handshake. |
| 102 struct NET_EXPORT_PRIVATE QuicCryptoNegotiatedParameters | 102 struct QUIC_EXPORT_PRIVATE QuicCryptoNegotiatedParameters |
| 103 : public base::RefCounted<QuicCryptoNegotiatedParameters> { | 103 : public base::RefCounted<QuicCryptoNegotiatedParameters> { |
| 104 // Initializes the members to 0 or empty values. | 104 // Initializes the members to 0 or empty values. |
| 105 QuicCryptoNegotiatedParameters(); | 105 QuicCryptoNegotiatedParameters(); |
| 106 | 106 |
| 107 QuicTag key_exchange; | 107 QuicTag key_exchange; |
| 108 QuicTag aead; | 108 QuicTag aead; |
| 109 std::string initial_premaster_secret; | 109 std::string initial_premaster_secret; |
| 110 std::string forward_secure_premaster_secret; | 110 std::string forward_secure_premaster_secret; |
| 111 // initial_subkey_secret is used as the PRK input to the HKDF used when | 111 // initial_subkey_secret is used as the PRK input to the HKDF used when |
| 112 // performing key extraction that needs to happen before forward-secure keys | 112 // performing key extraction that needs to happen before forward-secure keys |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // Default to false; set to true if the client indicates that it supports sct | 149 // Default to false; set to true if the client indicates that it supports sct |
| 150 // by sending CSCT tag with an empty value in client hello. | 150 // by sending CSCT tag with an empty value in client hello. |
| 151 bool sct_supported_by_client; | 151 bool sct_supported_by_client; |
| 152 | 152 |
| 153 private: | 153 private: |
| 154 friend class base::RefCounted<QuicCryptoNegotiatedParameters>; | 154 friend class base::RefCounted<QuicCryptoNegotiatedParameters>; |
| 155 virtual ~QuicCryptoNegotiatedParameters(); | 155 virtual ~QuicCryptoNegotiatedParameters(); |
| 156 }; | 156 }; |
| 157 | 157 |
| 158 // QuicCryptoConfig contains common configuration between clients and servers. | 158 // QuicCryptoConfig contains common configuration between clients and servers. |
| 159 class NET_EXPORT_PRIVATE QuicCryptoConfig { | 159 class QUIC_EXPORT_PRIVATE QuicCryptoConfig { |
| 160 public: | 160 public: |
| 161 // kInitialLabel is a constant that is used when deriving the initial | 161 // kInitialLabel is a constant that is used when deriving the initial |
| 162 // (non-forward secure) keys for the connection in order to tie the resulting | 162 // (non-forward secure) keys for the connection in order to tie the resulting |
| 163 // key to this protocol. | 163 // key to this protocol. |
| 164 static const char kInitialLabel[]; | 164 static const char kInitialLabel[]; |
| 165 | 165 |
| 166 // kCETVLabel is a constant that is used when deriving the keys for the | 166 // kCETVLabel is a constant that is used when deriving the keys for the |
| 167 // encrypted tag/value block in the client hello. | 167 // encrypted tag/value block in the client hello. |
| 168 static const char kCETVLabel[]; | 168 static const char kCETVLabel[]; |
| 169 | 169 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 187 | 187 |
| 188 const CommonCertSets* common_cert_sets; | 188 const CommonCertSets* common_cert_sets; |
| 189 | 189 |
| 190 private: | 190 private: |
| 191 DISALLOW_COPY_AND_ASSIGN(QuicCryptoConfig); | 191 DISALLOW_COPY_AND_ASSIGN(QuicCryptoConfig); |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 } // namespace net | 194 } // namespace net |
| 195 | 195 |
| 196 #endif // NET_QUIC_CORE_CRYPTO_CRYPTO_HANDSHAKE_H_ | 196 #endif // NET_QUIC_CORE_CRYPTO_CRYPTO_HANDSHAKE_H_ |
| OLD | NEW |