| 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_CRYPTO_CRYPTO_HANDSHAKE_H_ | 5 #ifndef NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_ |
| 6 #define NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_ | 6 #define NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
| 13 #include "net/quic/quic_protocol.h" | 13 #include "net/quic/quic_protocol.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 class CommonCertSets; | 17 class CommonCertSets; |
| 18 class KeyExchange; | 18 class KeyExchange; |
| 19 class QuicDecrypter; | 19 class QuicDecrypter; |
| 20 class QuicEncrypter; | 20 class QuicEncrypter; |
| 21 | 21 |
| 22 // HandshakeFailureReason enum values are uploaded to UMA, they cannot be |
| 23 // changed. |
| 24 enum HandshakeFailureReason { |
| 25 HANDSHAKE_OK = 0, |
| 26 |
| 27 // Failure reasons for an invalid client nonce in CHLO. |
| 28 // |
| 29 // Client nonce had incorrect length. |
| 30 CLIENT_NONCE_INVALID_FAILURE = 1, |
| 31 // Client nonce is not unique. |
| 32 CLIENT_NONCE_NOT_UNIQUE_FAILURE = 2, |
| 33 // Client orbit is invalid or incorrect. |
| 34 CLIENT_NONCE_INVALID_ORBIT_FAILURE = 3, |
| 35 // Client nonce's timestamp is not in the strike register's valid time range. |
| 36 CLIENT_NONCE_INVALID_TIME_FAILURE = 4, |
| 37 // Client nonce verification has failed because strike register is down. |
| 38 CLIENT_NONCE_NO_STRIKE_REGISTER_FAILURE = 5, |
| 39 |
| 40 // Failure reasons for an invalid server nonce in CHLO. |
| 41 // |
| 42 // Unbox of server nonce failed. |
| 43 SERVER_NONCE_DECRYPTION_FAILURE = 6, |
| 44 // Decrypted server nonce had incorrect length. |
| 45 SERVER_NONCE_INVALID_FAILURE = 7, |
| 46 // Server nonce is not unique. |
| 47 SERVER_NONCE_NOT_UNIQUE_FAILURE = 8, |
| 48 // Server nonce's timestamp is not in the strike register's valid time range. |
| 49 SERVER_NONCE_INVALID_TIME_FAILURE = 9, |
| 50 |
| 51 // Failure reasons for an invalid server config in CHLO. |
| 52 // |
| 53 // Missing Server config id (kSCID) tag. |
| 54 SERVER_CONFIG_INCHOATE_HELLO_FAILURE = 10, |
| 55 // Couldn't find the Server config id (kSCID). |
| 56 SERVER_CONFIG_UNKNOWN_CONFIG_FAILURE = 11, |
| 57 |
| 58 // Failure reasons for an invalid source-address token. |
| 59 // |
| 60 // Missing Source-address token (kSourceAddressTokenTag) tag. |
| 61 SOURCE_ADDRESS_TOKEN_INVALID_FAILURE = 12, |
| 62 // Unbox of Source-address token failed. |
| 63 SOURCE_ADDRESS_TOKEN_DECRYPTION_FAILURE = 13, |
| 64 // Couldn't parse the unbox'ed Source-address token. |
| 65 SOURCE_ADDRESS_TOKEN_PARSE_FAILURE = 14, |
| 66 // Source-address token is for a different IP address. |
| 67 SOURCE_ADDRESS_TOKEN_DIFFERENT_IP_ADDRESS_FAILURE = 15, |
| 68 // The source-address token has a timestamp in the future. |
| 69 SOURCE_ADDRESS_TOKEN_CLOCK_SKEW_FAILURE = 16, |
| 70 // The source-address token has expired. |
| 71 SOURCE_ADDRESS_TOKEN_EXPIRED_FAILURE = 17, |
| 72 |
| 73 MAX_FAILURE_REASON, |
| 74 }; |
| 75 |
| 76 // These errors will be packed into an uint32 and we don't want to set the most |
| 77 // significant bit, which may be misinterpreted as the sign bit. |
| 78 COMPILE_ASSERT(MAX_FAILURE_REASON <= 32, failure_reason_out_of_sync); |
| 79 |
| 22 // A CrypterPair contains the encrypter and decrypter for an encryption level. | 80 // A CrypterPair contains the encrypter and decrypter for an encryption level. |
| 23 struct NET_EXPORT_PRIVATE CrypterPair { | 81 struct NET_EXPORT_PRIVATE CrypterPair { |
| 24 CrypterPair(); | 82 CrypterPair(); |
| 25 ~CrypterPair(); | 83 ~CrypterPair(); |
| 26 scoped_ptr<QuicEncrypter> encrypter; | 84 scoped_ptr<QuicEncrypter> encrypter; |
| 27 scoped_ptr<QuicDecrypter> decrypter; | 85 scoped_ptr<QuicDecrypter> decrypter; |
| 28 }; | 86 }; |
| 29 | 87 |
| 30 // Parameters negotiated by the crypto handshake. | 88 // Parameters negotiated by the crypto handshake. |
| 31 struct NET_EXPORT_PRIVATE QuicCryptoNegotiatedParameters { | 89 struct NET_EXPORT_PRIVATE QuicCryptoNegotiatedParameters { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 147 |
| 90 const CommonCertSets* common_cert_sets; | 148 const CommonCertSets* common_cert_sets; |
| 91 | 149 |
| 92 private: | 150 private: |
| 93 DISALLOW_COPY_AND_ASSIGN(QuicCryptoConfig); | 151 DISALLOW_COPY_AND_ASSIGN(QuicCryptoConfig); |
| 94 }; | 152 }; |
| 95 | 153 |
| 96 } // namespace net | 154 } // namespace net |
| 97 | 155 |
| 98 #endif // NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_ | 156 #endif // NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_ |
| OLD | NEW |