| 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_client_config.h" | 5 #include "net/quic/crypto/quic_crypto_client_config.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "net/quic/crypto/cert_compressor.h" | 10 #include "net/quic/crypto/cert_compressor.h" |
| 11 #include "net/quic/crypto/chacha20_poly1305_rfc7539_encrypter.h" | 11 #include "net/quic/crypto/chacha20_poly1305_rfc7539_encrypter.h" |
| 12 #include "net/quic/crypto/channel_id.h" | 12 #include "net/quic/crypto/channel_id.h" |
| 13 #include "net/quic/crypto/common_cert_set.h" | 13 #include "net/quic/crypto/common_cert_set.h" |
| 14 #include "net/quic/crypto/crypto_framer.h" | 14 #include "net/quic/crypto/crypto_framer.h" |
| 15 #include "net/quic/crypto/crypto_utils.h" | 15 #include "net/quic/crypto/crypto_utils.h" |
| 16 #include "net/quic/crypto/curve25519_key_exchange.h" | 16 #include "net/quic/crypto/curve25519_key_exchange.h" |
| 17 #include "net/quic/crypto/key_exchange.h" | 17 #include "net/quic/crypto/key_exchange.h" |
| 18 #include "net/quic/crypto/p256_key_exchange.h" | 18 #include "net/quic/crypto/p256_key_exchange.h" |
| 19 #include "net/quic/crypto/proof_verifier.h" | 19 #include "net/quic/crypto/proof_verifier.h" |
| 20 #include "net/quic/crypto/quic_encrypter.h" | 20 #include "net/quic/crypto/quic_encrypter.h" |
| 21 #include "net/quic/quic_bug_tracker.h" |
| 21 #include "net/quic/quic_utils.h" | 22 #include "net/quic/quic_utils.h" |
| 22 | 23 |
| 23 using base::StringPiece; | 24 using base::StringPiece; |
| 24 using std::map; | 25 using std::map; |
| 25 using std::string; | 26 using std::string; |
| 26 using std::queue; | 27 using std::queue; |
| 27 using std::vector; | 28 using std::vector; |
| 28 | 29 |
| 29 namespace net { | 30 namespace net { |
| 30 | 31 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 server_designated_connection_ids_ = other.server_designated_connection_ids_; | 333 server_designated_connection_ids_ = other.server_designated_connection_ids_; |
| 333 if (other.proof_verify_details_.get() != nullptr) { | 334 if (other.proof_verify_details_.get() != nullptr) { |
| 334 proof_verify_details_.reset(other.proof_verify_details_->Clone()); | 335 proof_verify_details_.reset(other.proof_verify_details_->Clone()); |
| 335 } | 336 } |
| 336 ++generation_counter_; | 337 ++generation_counter_; |
| 337 } | 338 } |
| 338 | 339 |
| 339 QuicConnectionId | 340 QuicConnectionId |
| 340 QuicCryptoClientConfig::CachedState::GetNextServerDesignatedConnectionId() { | 341 QuicCryptoClientConfig::CachedState::GetNextServerDesignatedConnectionId() { |
| 341 if (server_designated_connection_ids_.empty()) { | 342 if (server_designated_connection_ids_.empty()) { |
| 342 LOG(DFATAL) | 343 QUIC_BUG |
| 343 << "Attempting to consume a connection id that was never designated."; | 344 << "Attempting to consume a connection id that was never designated."; |
| 344 return 0; | 345 return 0; |
| 345 } | 346 } |
| 346 const QuicConnectionId next_id = server_designated_connection_ids_.front(); | 347 const QuicConnectionId next_id = server_designated_connection_ids_.front(); |
| 347 server_designated_connection_ids_.pop(); | 348 server_designated_connection_ids_.pop(); |
| 348 return next_id; | 349 return next_id; |
| 349 } | 350 } |
| 350 | 351 |
| 351 string QuicCryptoClientConfig::CachedState::GetNextServerNonce() { | 352 string QuicCryptoClientConfig::CachedState::GetNextServerNonce() { |
| 352 if (server_nonces_.empty()) { | 353 if (server_nonces_.empty()) { |
| 353 LOG(DFATAL) | 354 QUIC_BUG |
| 354 << "Attempting to consume a server nonce that was never designated."; | 355 << "Attempting to consume a server nonce that was never designated."; |
| 355 return ""; | 356 return ""; |
| 356 } | 357 } |
| 357 const string server_nonce = server_nonces_.front(); | 358 const string server_nonce = server_nonces_.front(); |
| 358 server_nonces_.pop(); | 359 server_nonces_.pop(); |
| 359 return server_nonce; | 360 return server_nonce; |
| 360 } | 361 } |
| 361 | 362 |
| 362 void QuicCryptoClientConfig::SetDefaults() { | 363 void QuicCryptoClientConfig::SetDefaults() { |
| 363 // Key exchange methods. | 364 // Key exchange methods. |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 } | 958 } |
| 958 | 959 |
| 959 // Update canonical version to point at the "most recent" entry. | 960 // Update canonical version to point at the "most recent" entry. |
| 960 canonical_server_map_[suffix_server_id] = server_id; | 961 canonical_server_map_[suffix_server_id] = server_id; |
| 961 | 962 |
| 962 server_state->InitializeFrom(*canonical_state); | 963 server_state->InitializeFrom(*canonical_state); |
| 963 return true; | 964 return true; |
| 964 } | 965 } |
| 965 | 966 |
| 966 } // namespace net | 967 } // namespace net |
| OLD | NEW |