| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "net/quic/crypto/cert_compressor.h" | 12 #include "net/quic/crypto/cert_compressor.h" |
| 13 #include "net/quic/crypto/chacha20_poly1305_rfc7539_encrypter.h" | 13 #include "net/quic/crypto/chacha20_poly1305_encrypter.h" |
| 14 #include "net/quic/crypto/channel_id.h" | 14 #include "net/quic/crypto/channel_id.h" |
| 15 #include "net/quic/crypto/common_cert_set.h" | 15 #include "net/quic/crypto/common_cert_set.h" |
| 16 #include "net/quic/crypto/crypto_framer.h" | 16 #include "net/quic/crypto/crypto_framer.h" |
| 17 #include "net/quic/crypto/crypto_utils.h" | 17 #include "net/quic/crypto/crypto_utils.h" |
| 18 #include "net/quic/crypto/curve25519_key_exchange.h" | 18 #include "net/quic/crypto/curve25519_key_exchange.h" |
| 19 #include "net/quic/crypto/key_exchange.h" | 19 #include "net/quic/crypto/key_exchange.h" |
| 20 #include "net/quic/crypto/p256_key_exchange.h" | 20 #include "net/quic/crypto/p256_key_exchange.h" |
| 21 #include "net/quic/crypto/proof_verifier.h" | 21 #include "net/quic/crypto/proof_verifier.h" |
| 22 #include "net/quic/crypto/quic_encrypter.h" | 22 #include "net/quic/crypto/quic_encrypter.h" |
| 23 #include "net/quic/crypto/quic_random.h" | 23 #include "net/quic/crypto/quic_random.h" |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 << "Attempting to consume a server nonce that was never designated."; | 370 << "Attempting to consume a server nonce that was never designated."; |
| 371 return ""; | 371 return ""; |
| 372 } | 372 } |
| 373 const string server_nonce = server_nonces_.front(); | 373 const string server_nonce = server_nonces_.front(); |
| 374 server_nonces_.pop(); | 374 server_nonces_.pop(); |
| 375 return server_nonce; | 375 return server_nonce; |
| 376 } | 376 } |
| 377 | 377 |
| 378 void QuicCryptoClientConfig::SetDefaults() { | 378 void QuicCryptoClientConfig::SetDefaults() { |
| 379 // Key exchange methods. | 379 // Key exchange methods. |
| 380 kexs.resize(2); | 380 kexs = {kC255, kP256}; |
| 381 kexs[0] = kC255; | |
| 382 kexs[1] = kP256; | |
| 383 | 381 |
| 384 // Authenticated encryption algorithms. Prefer RFC 7539 ChaCha20 by default. | 382 // Authenticated encryption algorithms. Prefer RFC 7539 ChaCha20 by default. |
| 385 aead.clear(); | 383 aead = {kCC20, kAESG}; |
| 386 if (ChaCha20Poly1305Rfc7539Encrypter::IsSupported()) { | |
| 387 aead.push_back(kCC20); | |
| 388 } | |
| 389 aead.push_back(kAESG); | |
| 390 | 384 |
| 391 disable_ecdsa_ = false; | 385 disable_ecdsa_ = false; |
| 392 } | 386 } |
| 393 | 387 |
| 394 QuicCryptoClientConfig::CachedState* QuicCryptoClientConfig::LookupOrCreate( | 388 QuicCryptoClientConfig::CachedState* QuicCryptoClientConfig::LookupOrCreate( |
| 395 const QuicServerId& server_id) { | 389 const QuicServerId& server_id) { |
| 396 CachedStateMap::const_iterator it = cached_states_.find(server_id); | 390 CachedStateMap::const_iterator it = cached_states_.find(server_id); |
| 397 if (it != cached_states_.end()) { | 391 if (it != cached_states_.end()) { |
| 398 return it->second; | 392 return it->second; |
| 399 } | 393 } |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 } | 986 } |
| 993 | 987 |
| 994 // Update canonical version to point at the "most recent" entry. | 988 // Update canonical version to point at the "most recent" entry. |
| 995 canonical_server_map_[suffix_server_id] = server_id; | 989 canonical_server_map_[suffix_server_id] = server_id; |
| 996 | 990 |
| 997 server_state->InitializeFrom(*canonical_state); | 991 server_state->InitializeFrom(*canonical_state); |
| 998 return true; | 992 return true; |
| 999 } | 993 } |
| 1000 | 994 |
| 1001 } // namespace net | 995 } // namespace net |
| OLD | NEW |