OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/quic_crypto_client_stream.h" | 5 #include "net/quic/quic_crypto_client_stream.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
9 #include "net/quic/crypto/crypto_protocol.h" | 9 #include "net/quic/crypto/crypto_protocol.h" |
10 #include "net/quic/crypto/crypto_utils.h" | 10 #include "net/quic/crypto/crypto_utils.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 next_state_ = STATE_VERIFY_PROOF; | 247 next_state_ = STATE_VERIFY_PROOF; |
248 } else { | 248 } else { |
249 next_state_ = STATE_GET_CHANNEL_ID; | 249 next_state_ = STATE_GET_CHANNEL_ID; |
250 } | 250 } |
251 } | 251 } |
252 | 252 |
253 void QuicCryptoClientStream::DoSendCHLO( | 253 void QuicCryptoClientStream::DoSendCHLO( |
254 const CryptoHandshakeMessage* in, | 254 const CryptoHandshakeMessage* in, |
255 QuicCryptoClientConfig::CachedState* cached) { | 255 QuicCryptoClientConfig::CachedState* cached) { |
256 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. | 256 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
257 tracked_objects::ScopedTracker tracking_profile( | 257 tracked_objects::ScopedTracker tracking_profile1( |
258 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 258 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
259 "422516 QuicCryptoClientStream::DoSendCHLO")); | 259 "422516 QuicCryptoClientStream::DoSendCHLO1")); |
260 | 260 |
261 // Send the client hello in plaintext. | 261 // Send the client hello in plaintext. |
262 session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_NONE); | 262 session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_NONE); |
263 if (num_client_hellos_ > kMaxClientHellos) { | 263 if (num_client_hellos_ > kMaxClientHellos) { |
264 CloseConnection(QUIC_CRYPTO_TOO_MANY_REJECTS); | 264 CloseConnection(QUIC_CRYPTO_TOO_MANY_REJECTS); |
265 return; | 265 return; |
266 } | 266 } |
267 num_client_hellos_++; | 267 num_client_hellos_++; |
268 | 268 |
269 CryptoHandshakeMessage out; | 269 CryptoHandshakeMessage out; |
(...skipping 30 matching lines...) Expand all Loading... |
300 server_id_, | 300 server_id_, |
301 session()->connection()->connection_id(), | 301 session()->connection()->connection_id(), |
302 session()->connection()->supported_versions().front(), | 302 session()->connection()->supported_versions().front(), |
303 cached, | 303 cached, |
304 session()->connection()->clock()->WallNow(), | 304 session()->connection()->clock()->WallNow(), |
305 session()->connection()->random_generator(), | 305 session()->connection()->random_generator(), |
306 channel_id_key_.get(), | 306 channel_id_key_.get(), |
307 &crypto_negotiated_params_, | 307 &crypto_negotiated_params_, |
308 &out, | 308 &out, |
309 &error_details); | 309 &error_details); |
| 310 |
| 311 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 312 tracked_objects::ScopedTracker tracking_profile2( |
| 313 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 314 "422516 QuicCryptoClientStream::DoSendCHLO2")); |
| 315 |
310 if (error != QUIC_NO_ERROR) { | 316 if (error != QUIC_NO_ERROR) { |
311 // Flush the cached config so that, if it's bad, the server has a | 317 // Flush the cached config so that, if it's bad, the server has a |
312 // chance to send us another in the future. | 318 // chance to send us another in the future. |
313 cached->InvalidateServerConfig(); | 319 cached->InvalidateServerConfig(); |
314 CloseConnectionWithDetails(error, error_details); | 320 CloseConnectionWithDetails(error, error_details); |
315 return; | 321 return; |
316 } | 322 } |
317 channel_id_sent_ = (channel_id_key_.get() != nullptr); | 323 channel_id_sent_ = (channel_id_key_.get() != nullptr); |
318 if (cached->proof_verify_details()) { | 324 if (cached->proof_verify_details()) { |
319 client_session()->OnProofVerifyDetailsAvailable( | 325 client_session()->OnProofVerifyDetailsAvailable( |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 | 438 |
433 void QuicCryptoClientStream::DoVerifyProofComplete( | 439 void QuicCryptoClientStream::DoVerifyProofComplete( |
434 QuicCryptoClientConfig::CachedState* cached) { | 440 QuicCryptoClientConfig::CachedState* cached) { |
435 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. | 441 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
436 tracked_objects::ScopedTracker tracking_profile( | 442 tracked_objects::ScopedTracker tracking_profile( |
437 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 443 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
438 "422516 QuicCryptoClientStream::DoVerifyProofComplete")); | 444 "422516 QuicCryptoClientStream::DoVerifyProofComplete")); |
439 | 445 |
440 if (!verify_ok_) { | 446 if (!verify_ok_) { |
441 next_state_ = STATE_NONE; | 447 next_state_ = STATE_NONE; |
442 if (verify_details_) { | 448 if (verify_details_.get()) { |
443 client_session()->OnProofVerifyDetailsAvailable(*verify_details_); | 449 client_session()->OnProofVerifyDetailsAvailable(*verify_details_); |
444 } | 450 } |
445 UMA_HISTOGRAM_BOOLEAN("Net.QuicVerifyProofFailed.HandshakeConfirmed", | 451 UMA_HISTOGRAM_BOOLEAN("Net.QuicVerifyProofFailed.HandshakeConfirmed", |
446 handshake_confirmed()); | 452 handshake_confirmed()); |
447 CloseConnectionWithDetails( | 453 CloseConnectionWithDetails( |
448 QUIC_PROOF_INVALID, "Proof invalid: " + verify_error_details_); | 454 QUIC_PROOF_INVALID, "Proof invalid: " + verify_error_details_); |
449 return; | 455 return; |
450 } | 456 } |
451 | 457 |
452 // Check if generation_counter has changed between STATE_VERIFY_PROOF and | 458 // Check if generation_counter has changed between STATE_VERIFY_PROOF and |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 } | 653 } |
648 } | 654 } |
649 return false; | 655 return false; |
650 } | 656 } |
651 | 657 |
652 QuicClientSessionBase* QuicCryptoClientStream::client_session() { | 658 QuicClientSessionBase* QuicCryptoClientStream::client_session() { |
653 return reinterpret_cast<QuicClientSessionBase*>(session()); | 659 return reinterpret_cast<QuicClientSessionBase*>(session()); |
654 } | 660 } |
655 | 661 |
656 } // namespace net | 662 } // namespace net |
OLD | NEW |