Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: net/quic/crypto/quic_crypto_client_config.cc

Issue 932723002: Land Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/crypto/crypto_framer.cc ('k') | net/quic/crypto/quic_crypto_server_config.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 7 #include "base/metrics/histogram.h"
8 #include "base/metrics/sparse_histogram.h" 8 #include "base/metrics/sparse_histogram.h"
9 #include "base/profiler/scoped_tracker.h" 9 #include "base/profiler/scoped_tracker.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_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/quic_utils.h" 23 #include "net/quic/quic_utils.h"
24 24
25 using base::StringPiece; 25 using base::StringPiece;
26 using std::find;
27 using std::make_pair;
28 using std::map; 26 using std::map;
29 using std::string; 27 using std::string;
30 using std::vector; 28 using std::vector;
31 29
32 namespace net { 30 namespace net {
33 31
34 namespace { 32 namespace {
35 33
36 // Tracks the reason (the state of the server config) for sending inchoate 34 // Tracks the reason (the state of the server config) for sending inchoate
37 // ClientHello to the server. 35 // ClientHello to the server.
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 315 }
318 316
319 QuicCryptoClientConfig::CachedState* QuicCryptoClientConfig::LookupOrCreate( 317 QuicCryptoClientConfig::CachedState* QuicCryptoClientConfig::LookupOrCreate(
320 const QuicServerId& server_id) { 318 const QuicServerId& server_id) {
321 CachedStateMap::const_iterator it = cached_states_.find(server_id); 319 CachedStateMap::const_iterator it = cached_states_.find(server_id);
322 if (it != cached_states_.end()) { 320 if (it != cached_states_.end()) {
323 return it->second; 321 return it->second;
324 } 322 }
325 323
326 CachedState* cached = new CachedState; 324 CachedState* cached = new CachedState;
327 cached_states_.insert(make_pair(server_id, cached)); 325 cached_states_.insert(std::make_pair(server_id, cached));
328 bool cache_populated = PopulateFromCanonicalConfig(server_id, cached); 326 bool cache_populated = PopulateFromCanonicalConfig(server_id, cached);
329 UMA_HISTOGRAM_BOOLEAN( 327 UMA_HISTOGRAM_BOOLEAN(
330 "Net.QuicCryptoClientConfig.PopulatedFromCanonicalConfig", 328 "Net.QuicCryptoClientConfig.PopulatedFromCanonicalConfig",
331 cache_populated); 329 cache_populated);
332 return cached; 330 return cached;
333 } 331 }
334 332
335 void QuicCryptoClientConfig::ClearCachedStates() { 333 void QuicCryptoClientConfig::ClearCachedStates() {
336 for (CachedStateMap::const_iterator it = cached_states_.begin(); 334 for (CachedStateMap::const_iterator it = cached_states_.begin();
337 it != cached_states_.end(); ++it) { 335 it != cached_states_.end(); ++it) {
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 831
834 void QuicCryptoClientConfig::AddCanonicalSuffix(const string& suffix) { 832 void QuicCryptoClientConfig::AddCanonicalSuffix(const string& suffix) {
835 canonical_suffixes_.push_back(suffix); 833 canonical_suffixes_.push_back(suffix);
836 } 834 }
837 835
838 void QuicCryptoClientConfig::PreferAesGcm() { 836 void QuicCryptoClientConfig::PreferAesGcm() {
839 DCHECK(!aead.empty()); 837 DCHECK(!aead.empty());
840 if (aead.size() <= 1) { 838 if (aead.size() <= 1) {
841 return; 839 return;
842 } 840 }
843 QuicTagVector::iterator pos = find(aead.begin(), aead.end(), kAESG); 841 QuicTagVector::iterator pos = std::find(aead.begin(), aead.end(), kAESG);
844 if (pos != aead.end()) { 842 if (pos != aead.end()) {
845 aead.erase(pos); 843 aead.erase(pos);
846 aead.insert(aead.begin(), kAESG); 844 aead.insert(aead.begin(), kAESG);
847 } 845 }
848 } 846 }
849 847
850 void QuicCryptoClientConfig::DisableEcdsa() { 848 void QuicCryptoClientConfig::DisableEcdsa() {
851 disable_ecdsa_ = true; 849 disable_ecdsa_ = true;
852 } 850 }
853 851
(...skipping 29 matching lines...) Expand all
883 } 881 }
884 882
885 // Update canonical version to point at the "most recent" entry. 883 // Update canonical version to point at the "most recent" entry.
886 canonical_server_map_[suffix_server_id] = server_id; 884 canonical_server_map_[suffix_server_id] = server_id;
887 885
888 server_state->InitializeFrom(*canonical_state); 886 server_state->InitializeFrom(*canonical_state);
889 return true; 887 return true;
890 } 888 }
891 889
892 } // namespace net 890 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/crypto_framer.cc ('k') | net/quic/crypto/quic_crypto_server_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698