OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "net/quic/crypto/quic_crypto_server_config.h" | 5 #include "net/quic/crypto/quic_crypto_server_config.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 const IPEndPoint client_ip; | 73 const IPEndPoint client_ip; |
74 const QuicWallTime now; | 74 const QuicWallTime now; |
75 | 75 |
76 // Outputs from EvaluateClientHello. | 76 // Outputs from EvaluateClientHello. |
77 bool valid_source_address_token; | 77 bool valid_source_address_token; |
78 bool client_nonce_well_formed; | 78 bool client_nonce_well_formed; |
79 bool unique; | 79 bool unique; |
80 StringPiece sni; | 80 StringPiece sni; |
81 StringPiece client_nonce; | 81 StringPiece client_nonce; |
82 StringPiece server_nonce; | 82 StringPiece server_nonce; |
| 83 StringPiece user_agent_id; |
83 }; | 84 }; |
84 | 85 |
85 struct ValidateClientHelloResultCallback::Result { | 86 struct ValidateClientHelloResultCallback::Result { |
86 Result(const CryptoHandshakeMessage& in_client_hello, | 87 Result(const CryptoHandshakeMessage& in_client_hello, |
87 IPEndPoint in_client_ip, | 88 IPEndPoint in_client_ip, |
88 QuicWallTime in_now) | 89 QuicWallTime in_now) |
89 : client_hello(in_client_hello), | 90 : client_hello(in_client_hello), |
90 info(in_client_ip, in_now), | 91 info(in_client_ip, in_now), |
91 error_code(QUIC_NO_ERROR) { | 92 error_code(QUIC_NO_ERROR) { |
92 } | 93 } |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 return; | 883 return; |
883 } | 884 } |
884 | 885 |
885 if (client_hello.GetStringPiece(kSNI, &info->sni) && | 886 if (client_hello.GetStringPiece(kSNI, &info->sni) && |
886 !CryptoUtils::IsValidSNI(info->sni)) { | 887 !CryptoUtils::IsValidSNI(info->sni)) { |
887 helper.ValidationComplete(QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER, | 888 helper.ValidationComplete(QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER, |
888 "Invalid SNI name"); | 889 "Invalid SNI name"); |
889 return; | 890 return; |
890 } | 891 } |
891 | 892 |
| 893 client_hello.GetStringPiece(kUAID, &info->user_agent_id); |
| 894 |
892 StringPiece srct; | 895 StringPiece srct; |
893 if (requested_config.get() != NULL && | 896 if (requested_config.get() != NULL && |
894 client_hello.GetStringPiece(kSourceAddressTokenTag, &srct) && | 897 client_hello.GetStringPiece(kSourceAddressTokenTag, &srct) && |
895 ValidateSourceAddressToken(*requested_config, | 898 ValidateSourceAddressToken(*requested_config, |
896 srct, | 899 srct, |
897 info->client_ip, | 900 info->client_ip, |
898 info->now)) { | 901 info->now)) { |
899 info->valid_source_address_token = true; | 902 info->valid_source_address_token = true; |
900 } else { | 903 } else { |
901 // No server config with the requested ID, or no valid source address token. | 904 // No server config with the requested ID, or no valid source address token. |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 QuicCryptoServerConfig::Config::Config() | 1404 QuicCryptoServerConfig::Config::Config() |
1402 : channel_id_enabled(false), | 1405 : channel_id_enabled(false), |
1403 is_primary(false), | 1406 is_primary(false), |
1404 primary_time(QuicWallTime::Zero()), | 1407 primary_time(QuicWallTime::Zero()), |
1405 priority(0), | 1408 priority(0), |
1406 source_address_token_boxer(NULL) {} | 1409 source_address_token_boxer(NULL) {} |
1407 | 1410 |
1408 QuicCryptoServerConfig::Config::~Config() { STLDeleteElements(&key_exchanges); } | 1411 QuicCryptoServerConfig::Config::~Config() { STLDeleteElements(&key_exchanges); } |
1409 | 1412 |
1410 } // namespace net | 1413 } // namespace net |
OLD | NEW |