| 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/core/crypto/quic_crypto_client_config.h" | 5 #include "net/quic/core/crypto/quic_crypto_client_config.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| 11 #include "base/stl_util.h" | |
| 12 #include "net/quic/core/crypto/cert_compressor.h" | 11 #include "net/quic/core/crypto/cert_compressor.h" |
| 13 #include "net/quic/core/crypto/chacha20_poly1305_encrypter.h" | 12 #include "net/quic/core/crypto/chacha20_poly1305_encrypter.h" |
| 14 #include "net/quic/core/crypto/channel_id.h" | 13 #include "net/quic/core/crypto/channel_id.h" |
| 15 #include "net/quic/core/crypto/common_cert_set.h" | 14 #include "net/quic/core/crypto/common_cert_set.h" |
| 16 #include "net/quic/core/crypto/crypto_framer.h" | 15 #include "net/quic/core/crypto/crypto_framer.h" |
| 17 #include "net/quic/core/crypto/crypto_utils.h" | 16 #include "net/quic/core/crypto/crypto_utils.h" |
| 18 #include "net/quic/core/crypto/curve25519_key_exchange.h" | 17 #include "net/quic/core/crypto/curve25519_key_exchange.h" |
| 19 #include "net/quic/core/crypto/key_exchange.h" | 18 #include "net/quic/core/crypto/key_exchange.h" |
| 20 #include "net/quic/core/crypto/p256_key_exchange.h" | 19 #include "net/quic/core/crypto/p256_key_exchange.h" |
| 21 #include "net/quic/core/crypto/proof_verifier.h" | 20 #include "net/quic/core/crypto/proof_verifier.h" |
| 22 #include "net/quic/core/crypto/quic_encrypter.h" | 21 #include "net/quic/core/crypto/quic_encrypter.h" |
| 23 #include "net/quic/core/crypto/quic_random.h" | 22 #include "net/quic/core/crypto/quic_random.h" |
| 24 #include "net/quic/core/quic_utils.h" | 23 #include "net/quic/core/quic_utils.h" |
| 25 #include "net/quic/platform/api/quic_bug_tracker.h" | 24 #include "net/quic/platform/api/quic_bug_tracker.h" |
| 26 #include "net/quic/platform/api/quic_logging.h" | 25 #include "net/quic/platform/api/quic_logging.h" |
| 26 #include "net/quic/platform/api/quic_map_util.h" |
| 27 #include "net/quic/platform/api/quic_ptr_util.h" | 27 #include "net/quic/platform/api/quic_ptr_util.h" |
| 28 #include "net/quic/platform/api/quic_text_utils.h" | 28 #include "net/quic/platform/api/quic_text_utils.h" |
| 29 | 29 |
| 30 using base::ContainsKey; | |
| 31 using base::StringPiece; | 30 using base::StringPiece; |
| 32 using std::string; | 31 using std::string; |
| 33 | 32 |
| 34 namespace net { | 33 namespace net { |
| 35 | 34 |
| 36 namespace { | 35 namespace { |
| 37 | 36 |
| 38 // Tracks the reason (the state of the server config) for sending inchoate | 37 // Tracks the reason (the state of the server config) for sending inchoate |
| 39 // ClientHello to the server. | 38 // ClientHello to the server. |
| 40 void RecordInchoateClientHelloReason( | 39 void RecordInchoateClientHelloReason( |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 canonical_suffixes_[i])) { | 955 canonical_suffixes_[i])) { |
| 957 break; | 956 break; |
| 958 } | 957 } |
| 959 } | 958 } |
| 960 if (i == canonical_suffixes_.size()) { | 959 if (i == canonical_suffixes_.size()) { |
| 961 return false; | 960 return false; |
| 962 } | 961 } |
| 963 | 962 |
| 964 QuicServerId suffix_server_id(canonical_suffixes_[i], server_id.port(), | 963 QuicServerId suffix_server_id(canonical_suffixes_[i], server_id.port(), |
| 965 server_id.privacy_mode()); | 964 server_id.privacy_mode()); |
| 966 if (!ContainsKey(canonical_server_map_, suffix_server_id)) { | 965 if (!QuicContainsKey(canonical_server_map_, suffix_server_id)) { |
| 967 // This is the first host we've seen which matches the suffix, so make it | 966 // This is the first host we've seen which matches the suffix, so make it |
| 968 // canonical. | 967 // canonical. |
| 969 canonical_server_map_[suffix_server_id] = server_id; | 968 canonical_server_map_[suffix_server_id] = server_id; |
| 970 return false; | 969 return false; |
| 971 } | 970 } |
| 972 | 971 |
| 973 const QuicServerId& canonical_server_id = | 972 const QuicServerId& canonical_server_id = |
| 974 canonical_server_map_[suffix_server_id]; | 973 canonical_server_map_[suffix_server_id]; |
| 975 CachedState* canonical_state = cached_states_[canonical_server_id].get(); | 974 CachedState* canonical_state = cached_states_[canonical_server_id].get(); |
| 976 if (!canonical_state->proof_valid()) { | 975 if (!canonical_state->proof_valid()) { |
| 977 return false; | 976 return false; |
| 978 } | 977 } |
| 979 | 978 |
| 980 // Update canonical version to point at the "most recent" entry. | 979 // Update canonical version to point at the "most recent" entry. |
| 981 canonical_server_map_[suffix_server_id] = server_id; | 980 canonical_server_map_[suffix_server_id] = server_id; |
| 982 | 981 |
| 983 server_state->InitializeFrom(*canonical_state); | 982 server_state->InitializeFrom(*canonical_state); |
| 984 return true; | 983 return true; |
| 985 } | 984 } |
| 986 | 985 |
| 987 } // namespace net | 986 } // namespace net |
| OLD | NEW |