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 "net/base/completion_callback.h" | 7 #include "net/base/completion_callback.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } | 202 } |
203 out.set_minimum_size(max_packet_size - kFramingOverhead); | 203 out.set_minimum_size(max_packet_size - kFramingOverhead); |
204 next_state_ = STATE_RECV_REJ; | 204 next_state_ = STATE_RECV_REJ; |
205 DVLOG(1) << "Client: Sending " << out.DebugString(); | 205 DVLOG(1) << "Client: Sending " << out.DebugString(); |
206 SendHandshakeMessage(out); | 206 SendHandshakeMessage(out); |
207 return; | 207 return; |
208 } | 208 } |
209 session()->config()->ToHandshakeMessage(&out); | 209 session()->config()->ToHandshakeMessage(&out); |
210 error = crypto_config_->FillClientHello( | 210 error = crypto_config_->FillClientHello( |
211 server_hostname_, | 211 server_hostname_, |
212 session()->connection()->guid(), | 212 session()->connection()->connection_id(), |
213 session()->connection()->supported_versions().front(), | 213 session()->connection()->supported_versions().front(), |
214 cached, | 214 cached, |
215 session()->connection()->clock()->WallNow(), | 215 session()->connection()->clock()->WallNow(), |
216 session()->connection()->random_generator(), | 216 session()->connection()->random_generator(), |
217 &crypto_negotiated_params_, | 217 &crypto_negotiated_params_, |
218 &out, | 218 &out, |
219 &error_details); | 219 &error_details); |
220 if (error != QUIC_NO_ERROR) { | 220 if (error != QUIC_NO_ERROR) { |
221 // Flush the cached config so that, if it's bad, the server has a | 221 // Flush the cached config so that, if it's bad, the server has a |
222 // chance to send us another in the future. | 222 // chance to send us another in the future. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 // alternative_decrypter will be NULL if the original alternative | 357 // alternative_decrypter will be NULL if the original alternative |
358 // decrypter latched and became the primary decrypter. That happens | 358 // decrypter latched and became the primary decrypter. That happens |
359 // if we received a message encrypted with the INITIAL key. | 359 // if we received a message encrypted with the INITIAL key. |
360 if (session()->connection()->alternative_decrypter() != NULL) { | 360 if (session()->connection()->alternative_decrypter() != NULL) { |
361 // The server hello was sent without encryption. | 361 // The server hello was sent without encryption. |
362 CloseConnectionWithDetails(QUIC_CRYPTO_ENCRYPTION_LEVEL_INCORRECT, | 362 CloseConnectionWithDetails(QUIC_CRYPTO_ENCRYPTION_LEVEL_INCORRECT, |
363 "unencrypted SHLO message"); | 363 "unencrypted SHLO message"); |
364 return; | 364 return; |
365 } | 365 } |
366 error = crypto_config_->ProcessServerHello( | 366 error = crypto_config_->ProcessServerHello( |
367 *in, session()->connection()->guid(), | 367 *in, session()->connection()->connection_id(), |
368 session()->connection()->server_supported_versions(), | 368 session()->connection()->server_supported_versions(), |
369 cached, &crypto_negotiated_params_, &error_details); | 369 cached, &crypto_negotiated_params_, &error_details); |
370 | 370 |
371 if (error != QUIC_NO_ERROR) { | 371 if (error != QUIC_NO_ERROR) { |
372 CloseConnectionWithDetails( | 372 CloseConnectionWithDetails( |
373 error, "Server hello invalid: " + error_details); | 373 error, "Server hello invalid: " + error_details); |
374 return; | 374 return; |
375 } | 375 } |
376 error = session()->config()->ProcessServerHello(*in, &error_details); | 376 error = session()->config()->ProcessServerHello(*in, &error_details); |
377 if (error != QUIC_NO_ERROR) { | 377 if (error != QUIC_NO_ERROR) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 ProofVerifier* verifier = crypto_config_->proof_verifier(); | 465 ProofVerifier* verifier = crypto_config_->proof_verifier(); |
466 if (!verifier) { | 466 if (!verifier) { |
467 // If no verifier is set then we don't check the certificates. | 467 // If no verifier is set then we don't check the certificates. |
468 cached->SetProofValid(); | 468 cached->SetProofValid(); |
469 } else if (!cached->signature().empty()) { | 469 } else if (!cached->signature().empty()) { |
470 next_state_ = STATE_VERIFY_PROOF; | 470 next_state_ = STATE_VERIFY_PROOF; |
471 } | 471 } |
472 } | 472 } |
473 | 473 |
474 } // namespace net | 474 } // namespace net |
OLD | NEW |