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.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/stl_util.h" | 10 #include "base/stl_util.h" |
10 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
11 #include "net/quic/crypto/cert_compressor.h" | 12 #include "net/quic/crypto/cert_compressor.h" |
12 #include "net/quic/crypto/chacha20_poly1305_encrypter.h" | 13 #include "net/quic/crypto/chacha20_poly1305_encrypter.h" |
13 #include "net/quic/crypto/channel_id.h" | 14 #include "net/quic/crypto/channel_id.h" |
14 #include "net/quic/crypto/common_cert_set.h" | 15 #include "net/quic/crypto/common_cert_set.h" |
15 #include "net/quic/crypto/crypto_framer.h" | 16 #include "net/quic/crypto/crypto_framer.h" |
16 #include "net/quic/crypto/crypto_utils.h" | 17 #include "net/quic/crypto/crypto_utils.h" |
17 #include "net/quic/crypto/curve25519_key_exchange.h" | 18 #include "net/quic/crypto/curve25519_key_exchange.h" |
18 #include "net/quic/crypto/key_exchange.h" | 19 #include "net/quic/crypto/key_exchange.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 it->second->Clear(); | 338 it->second->Clear(); |
338 } | 339 } |
339 } | 340 } |
340 | 341 |
341 void QuicCryptoClientConfig::FillInchoateClientHello( | 342 void QuicCryptoClientConfig::FillInchoateClientHello( |
342 const QuicServerId& server_id, | 343 const QuicServerId& server_id, |
343 const QuicVersion preferred_version, | 344 const QuicVersion preferred_version, |
344 const CachedState* cached, | 345 const CachedState* cached, |
345 QuicCryptoNegotiatedParameters* out_params, | 346 QuicCryptoNegotiatedParameters* out_params, |
346 CryptoHandshakeMessage* out) const { | 347 CryptoHandshakeMessage* out) const { |
| 348 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 349 tracked_objects::ScopedTracker tracking_profile( |
| 350 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 351 "422516 QuicCryptoClientConfig::FillInchoateClientHello")); |
| 352 |
347 out->set_tag(kCHLO); | 353 out->set_tag(kCHLO); |
348 out->set_minimum_size(kClientHelloMinimumSize); | 354 out->set_minimum_size(kClientHelloMinimumSize); |
349 | 355 |
350 // Server name indication. We only send SNI if it's a valid domain name, as | 356 // Server name indication. We only send SNI if it's a valid domain name, as |
351 // per the spec. | 357 // per the spec. |
352 if (CryptoUtils::IsValidSNI(server_id.host())) { | 358 if (CryptoUtils::IsValidSNI(server_id.host())) { |
353 out->SetStringPiece(kSNI, server_id.host()); | 359 out->SetStringPiece(kSNI, server_id.host()); |
354 } | 360 } |
355 out->SetValue(kVER, QuicVersionToQuicTag(preferred_version)); | 361 out->SetValue(kVER, QuicVersionToQuicTag(preferred_version)); |
356 | 362 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 const QuicServerId& server_id, | 401 const QuicServerId& server_id, |
396 QuicConnectionId connection_id, | 402 QuicConnectionId connection_id, |
397 const QuicVersion preferred_version, | 403 const QuicVersion preferred_version, |
398 const CachedState* cached, | 404 const CachedState* cached, |
399 QuicWallTime now, | 405 QuicWallTime now, |
400 QuicRandom* rand, | 406 QuicRandom* rand, |
401 const ChannelIDKey* channel_id_key, | 407 const ChannelIDKey* channel_id_key, |
402 QuicCryptoNegotiatedParameters* out_params, | 408 QuicCryptoNegotiatedParameters* out_params, |
403 CryptoHandshakeMessage* out, | 409 CryptoHandshakeMessage* out, |
404 string* error_details) const { | 410 string* error_details) const { |
| 411 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 412 tracked_objects::ScopedTracker tracking_profile( |
| 413 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 414 "422516 QuicCryptoClientConfig::FillClientHello")); |
| 415 |
405 DCHECK(error_details != nullptr); | 416 DCHECK(error_details != nullptr); |
406 | 417 |
407 FillInchoateClientHello(server_id, preferred_version, cached, | 418 FillInchoateClientHello(server_id, preferred_version, cached, |
408 out_params, out); | 419 out_params, out); |
409 | 420 |
410 const CryptoHandshakeMessage* scfg = cached->GetServerConfig(); | 421 const CryptoHandshakeMessage* scfg = cached->GetServerConfig(); |
411 if (!scfg) { | 422 if (!scfg) { |
412 // This should never happen as our caller should have checked | 423 // This should never happen as our caller should have checked |
413 // cached->IsComplete() before calling this function. | 424 // cached->IsComplete() before calling this function. |
414 *error_details = "Handshake not ready"; | 425 *error_details = "Handshake not ready"; |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 } | 880 } |
870 | 881 |
871 // Update canonical version to point at the "most recent" entry. | 882 // Update canonical version to point at the "most recent" entry. |
872 canonical_server_map_[suffix_server_id] = server_id; | 883 canonical_server_map_[suffix_server_id] = server_id; |
873 | 884 |
874 server_state->InitializeFrom(*canonical_state); | 885 server_state->InitializeFrom(*canonical_state); |
875 return true; | 886 return true; |
876 } | 887 } |
877 | 888 |
878 } // namespace net | 889 } // namespace net |
OLD | NEW |