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. |
22 enum HandshakeFailureReason { | 24 enum HandshakeFailureReason { |
23 HANDSHAKE_OK = 0, | 25 HANDSHAKE_OK = 0, |
24 | 26 |
25 // Failure reasons for an invalid client nonce in CHLO. | 27 // Failure reasons for an invalid client nonce in CHLO. |
26 // | 28 // |
27 // TODO(rtenneti): Implement capturing of error from strike register. | 29 // TODO(rtenneti): Implement capturing of error from strike register. |
28 CLIENT_NONCE_UNKNOWN_FAILURE = 100, | 30 CLIENT_NONCE_UNKNOWN_FAILURE = 1, |
29 // Invalid client nonce. A possible reason, client nonce had incorrect length. | 31 // Invalid client nonce. A possible reason, client nonce had incorrect length. |
30 CLIENT_NONCE_INVALID_FAILURE, | 32 CLIENT_NONCE_INVALID_FAILURE = 2, |
| 33 // Client orbit is not valid. |
| 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, |
31 | 39 |
32 // Failure reasons for an invalid server nonce in CHLO. | 40 // Failure reasons for an invalid server nonce in CHLO. |
33 SERVER_NONCE_INVALID_FAILURE = 200, // Nonce had incorrect length. | 41 // |
34 SERVER_NONCE_DECRYPTION_FAILURE, // Unbox of nonce failed. | 42 SERVER_NONCE_INVALID_FAILURE = 6, // Nonce had incorrect length. |
35 SERVER_NONCE_NOT_UNIQUE_FAILURE, // Nonce is not unique. | 43 SERVER_NONCE_DECRYPTION_FAILURE = 7, // Unbox of nonce failed. |
| 44 SERVER_NONCE_NOT_UNIQUE_FAILURE = 8, // Nonce is not unique. |
| 45 // Server orbit is not valid. |
| 46 SERVER_NONCE_INVALID_ORBIT_FAILURE = 9, |
| 47 // Server nonce's timestamp is not in the strike register's valid time range. |
| 48 SERVER_NONCE_INVALID_TIME_FAILURE = 10, |
| 49 // Server nonce verification has failed because strike register is down. |
| 50 SERVER_NONCE_NO_STRIKE_REGISTER_FAILURE = 11, |
36 | 51 |
37 // Failure reasons for an invalid server config in CHLO. | 52 // Failure reasons for an invalid server config in CHLO. |
38 // | 53 // |
39 // Missing Server config id (kSCID) tag. | 54 // Missing Server config id (kSCID) tag. |
40 SERVER_CONFIG_INCHOATE_HELLO_FAILURE = 300, | 55 SERVER_CONFIG_INCHOATE_HELLO_FAILURE = 12, |
41 // GetConfigWithScid couldn't find the Server config id (kSCID). | 56 // GetConfigWithScid couldn't find the Server config id (kSCID). |
42 SERVER_CONFIG_UNKNOWN_CONFIG_FAILURE, | 57 SERVER_CONFIG_UNKNOWN_CONFIG_FAILURE = 13, |
43 | 58 |
44 // Failure reasons for an invalid source-address token. | 59 // Failure reasons for an invalid source-address token. |
45 // | 60 // |
46 // Missing Source-address token (kSourceAddressTokenTag) tag. | 61 // Missing Source-address token (kSourceAddressTokenTag) tag. |
47 SOURCE_ADDRESS_TOKEN_INVALID_FAILURE = 400, | 62 SOURCE_ADDRESS_TOKEN_INVALID_FAILURE = 14, |
48 // Unbox of Source-address token failed. | 63 // Unbox of Source-address token failed. |
49 SOURCE_ADDRESS_TOKEN_DECRYPTION_FAILURE, | 64 SOURCE_ADDRESS_TOKEN_DECRYPTION_FAILURE = 15, |
50 // Couldn't parse the unbox'ed Source-address token. | 65 // Couldn't parse the unbox'ed Source-address token. |
51 SOURCE_ADDRESS_TOKEN_PARSE_FAILURE, | 66 SOURCE_ADDRESS_TOKEN_PARSE_FAILURE = 16, |
52 // Source-address token is for a different IP address. | 67 // Source-address token is for a different IP address. |
53 SOURCE_ADDRESS_TOKEN_DIFFERENT_IP_ADDRESS_FAILURE, | 68 SOURCE_ADDRESS_TOKEN_DIFFERENT_IP_ADDRESS_FAILURE = 17, |
54 // The difference between the time in source-address token and |now| is more | 69 // The difference between the time in source-address token and |now| is more |
55 // than |source_address_token_future_secs_|. | 70 // than |source_address_token_future_secs_|. |
56 SOURCE_ADDRESS_TOKEN_CLOCK_SKEW_FAILURE, | 71 SOURCE_ADDRESS_TOKEN_CLOCK_SKEW_FAILURE = 18, |
57 // The difference between the time in source-address token and |now| is more | 72 // The difference between the time in source-address token and |now| is more |
58 // than |source_address_token_lifetime_secs_|. | 73 // than |source_address_token_lifetime_secs_|. |
59 SOURCE_ADDRESS_TOKEN_EXPIRED_FAILURE, | 74 SOURCE_ADDRESS_TOKEN_EXPIRED_FAILURE = 19, |
| 75 |
| 76 MAX_FAILURE_REASONS, |
60 }; | 77 }; |
61 | 78 |
| 79 // These errors will be packed into an uint32 and HANDSHAKE_OK is not used in |
| 80 // UMA histograms. |
| 81 COMPILE_ASSERT(MAX_FAILURE_REASONS <= 32, failure_reason_out_of_sync); |
| 82 |
62 // A CrypterPair contains the encrypter and decrypter for an encryption level. | 83 // A CrypterPair contains the encrypter and decrypter for an encryption level. |
63 struct NET_EXPORT_PRIVATE CrypterPair { | 84 struct NET_EXPORT_PRIVATE CrypterPair { |
64 CrypterPair(); | 85 CrypterPair(); |
65 ~CrypterPair(); | 86 ~CrypterPair(); |
66 scoped_ptr<QuicEncrypter> encrypter; | 87 scoped_ptr<QuicEncrypter> encrypter; |
67 scoped_ptr<QuicDecrypter> decrypter; | 88 scoped_ptr<QuicDecrypter> decrypter; |
68 }; | 89 }; |
69 | 90 |
70 // Parameters negotiated by the crypto handshake. | 91 // Parameters negotiated by the crypto handshake. |
71 struct NET_EXPORT_PRIVATE QuicCryptoNegotiatedParameters { | 92 struct NET_EXPORT_PRIVATE QuicCryptoNegotiatedParameters { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 150 |
130 const CommonCertSets* common_cert_sets; | 151 const CommonCertSets* common_cert_sets; |
131 | 152 |
132 private: | 153 private: |
133 DISALLOW_COPY_AND_ASSIGN(QuicCryptoConfig); | 154 DISALLOW_COPY_AND_ASSIGN(QuicCryptoConfig); |
134 }; | 155 }; |
135 | 156 |
136 } // namespace net | 157 } // namespace net |
137 | 158 |
138 #endif // NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_ | 159 #endif // NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_H_ |
OLD | NEW |