| 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_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "net/quic/crypto/crypto_protocol.h" | 8 #include "net/quic/crypto/crypto_protocol.h" |
| 9 #include "net/quic/crypto/crypto_utils.h" | 9 #include "net/quic/crypto/crypto_utils.h" |
| 10 #include "net/quic/crypto/null_encrypter.h" | 10 #include "net/quic/crypto/null_encrypter.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 return channel_id_source_callback_run_; | 148 return channel_id_source_callback_run_; |
| 149 } | 149 } |
| 150 | 150 |
| 151 void QuicCryptoClientStream::HandleServerConfigUpdateMessage( | 151 void QuicCryptoClientStream::HandleServerConfigUpdateMessage( |
| 152 const CryptoHandshakeMessage& server_config_update) { | 152 const CryptoHandshakeMessage& server_config_update) { |
| 153 DCHECK(server_config_update.tag() == kSCUP); | 153 DCHECK(server_config_update.tag() == kSCUP); |
| 154 string error_details; | 154 string error_details; |
| 155 QuicCryptoClientConfig::CachedState* cached = | 155 QuicCryptoClientConfig::CachedState* cached = |
| 156 crypto_config_->LookupOrCreate(server_id_); | 156 crypto_config_->LookupOrCreate(server_id_); |
| 157 QuicErrorCode error = crypto_config_->ProcessServerConfigUpdate( | 157 QuicErrorCode error = crypto_config_->ProcessServerConfigUpdate( |
| 158 server_config_update, | 158 server_config_update, session()->connection()->clock()->WallNow(), |
| 159 session()->connection()->clock()->WallNow(), | 159 session()->connection()->version(), cached, &crypto_negotiated_params_, |
| 160 cached, | |
| 161 &crypto_negotiated_params_, | |
| 162 &error_details); | 160 &error_details); |
| 163 | 161 |
| 164 if (error != QUIC_NO_ERROR) { | 162 if (error != QUIC_NO_ERROR) { |
| 165 CloseConnectionWithDetails( | 163 CloseConnectionWithDetails( |
| 166 error, "Server config update invalid: " + error_details); | 164 error, "Server config update invalid: " + error_details); |
| 167 return; | 165 return; |
| 168 } | 166 } |
| 169 | 167 |
| 170 DCHECK(handshake_confirmed()); | 168 DCHECK(handshake_confirmed()); |
| 171 if (proof_verify_callback_) { | 169 if (proof_verify_callback_) { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // that we need. | 361 // that we need. |
| 364 if ((in->tag() != kREJ) && (in->tag() != kSREJ)) { | 362 if ((in->tag() != kREJ) && (in->tag() != kSREJ)) { |
| 365 next_state_ = STATE_NONE; | 363 next_state_ = STATE_NONE; |
| 366 CloseConnectionWithDetails(QUIC_INVALID_CRYPTO_MESSAGE_TYPE, | 364 CloseConnectionWithDetails(QUIC_INVALID_CRYPTO_MESSAGE_TYPE, |
| 367 "Expected REJ"); | 365 "Expected REJ"); |
| 368 return; | 366 return; |
| 369 } | 367 } |
| 370 stateless_reject_received_ = in->tag() == kSREJ; | 368 stateless_reject_received_ = in->tag() == kSREJ; |
| 371 string error_details; | 369 string error_details; |
| 372 QuicErrorCode error = crypto_config_->ProcessRejection( | 370 QuicErrorCode error = crypto_config_->ProcessRejection( |
| 373 *in, session()->connection()->clock()->WallNow(), cached, | 371 *in, session()->connection()->clock()->WallNow(), |
| 374 &crypto_negotiated_params_, &error_details); | 372 session()->connection()->version(), cached, &crypto_negotiated_params_, |
| 373 &error_details); |
| 375 | 374 |
| 376 if (error != QUIC_NO_ERROR) { | 375 if (error != QUIC_NO_ERROR) { |
| 377 next_state_ = STATE_NONE; | 376 next_state_ = STATE_NONE; |
| 378 CloseConnectionWithDetails(error, error_details); | 377 CloseConnectionWithDetails(error, error_details); |
| 379 return; | 378 return; |
| 380 } | 379 } |
| 381 if (!cached->proof_valid()) { | 380 if (!cached->proof_valid()) { |
| 382 if (!cached->signature().empty()) { | 381 if (!cached->signature().empty()) { |
| 383 // Note that we only verify the proof if the cached proof is not | 382 // Note that we only verify the proof if the cached proof is not |
| 384 // valid. If the cached proof is valid here, someone else must have | 383 // valid. If the cached proof is valid here, someone else must have |
| (...skipping 14 matching lines...) Expand all Loading... |
| 399 next_state_ = STATE_VERIFY_PROOF_COMPLETE; | 398 next_state_ = STATE_VERIFY_PROOF_COMPLETE; |
| 400 generation_counter_ = cached->generation_counter(); | 399 generation_counter_ = cached->generation_counter(); |
| 401 | 400 |
| 402 ProofVerifierCallbackImpl* proof_verify_callback = | 401 ProofVerifierCallbackImpl* proof_verify_callback = |
| 403 new ProofVerifierCallbackImpl(this); | 402 new ProofVerifierCallbackImpl(this); |
| 404 | 403 |
| 405 verify_ok_ = false; | 404 verify_ok_ = false; |
| 406 | 405 |
| 407 QuicAsyncStatus status = verifier->VerifyProof( | 406 QuicAsyncStatus status = verifier->VerifyProof( |
| 408 server_id_.host(), cached->server_config(), cached->certs(), | 407 server_id_.host(), cached->server_config(), cached->certs(), |
| 409 cached->signature(), verify_context_.get(), &verify_error_details_, | 408 cached->cert_sct(), cached->signature(), verify_context_.get(), |
| 410 &verify_details_, proof_verify_callback); | 409 &verify_error_details_, &verify_details_, proof_verify_callback); |
| 411 | 410 |
| 412 switch (status) { | 411 switch (status) { |
| 413 case QUIC_PENDING: | 412 case QUIC_PENDING: |
| 414 proof_verify_callback_ = proof_verify_callback; | 413 proof_verify_callback_ = proof_verify_callback; |
| 415 DVLOG(1) << "Doing VerifyProof"; | 414 DVLOG(1) << "Doing VerifyProof"; |
| 416 break; | 415 break; |
| 417 case QUIC_FAILURE: | 416 case QUIC_FAILURE: |
| 418 delete proof_verify_callback; | 417 delete proof_verify_callback; |
| 419 break; | 418 break; |
| 420 case QUIC_SUCCESS: | 419 case QUIC_SUCCESS: |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 } | 614 } |
| 616 } | 615 } |
| 617 return false; | 616 return false; |
| 618 } | 617 } |
| 619 | 618 |
| 620 QuicClientSessionBase* QuicCryptoClientStream::client_session() { | 619 QuicClientSessionBase* QuicCryptoClientStream::client_session() { |
| 621 return reinterpret_cast<QuicClientSessionBase*>(session()); | 620 return reinterpret_cast<QuicClientSessionBase*>(session()); |
| 622 } | 621 } |
| 623 | 622 |
| 624 } // namespace net | 623 } // namespace net |
| OLD | NEW |