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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // We sent a dummy CHLO because we didn't have enough information to | 227 // We sent a dummy CHLO because we didn't have enough information to |
228 // perform a handshake, or we sent a full hello that the server | 228 // perform a handshake, or we sent a full hello that the server |
229 // rejected. Here we hope to have a REJ that contains the information | 229 // rejected. Here we hope to have a REJ that contains the information |
230 // that we need. | 230 // that we need. |
231 if (in->tag() != kREJ) { | 231 if (in->tag() != kREJ) { |
232 CloseConnectionWithDetails(QUIC_INVALID_CRYPTO_MESSAGE_TYPE, | 232 CloseConnectionWithDetails(QUIC_INVALID_CRYPTO_MESSAGE_TYPE, |
233 "Expected REJ"); | 233 "Expected REJ"); |
234 return; | 234 return; |
235 } | 235 } |
236 error = crypto_config_->ProcessRejection( | 236 error = crypto_config_->ProcessRejection( |
237 cached, *in, session()->connection()->clock()->WallNow(), | 237 *in, session()->connection()->clock()->WallNow(), cached, |
238 &crypto_negotiated_params_, &error_details); | 238 &crypto_negotiated_params_, &error_details); |
239 if (error != QUIC_NO_ERROR) { | 239 if (error != QUIC_NO_ERROR) { |
240 CloseConnectionWithDetails(error, error_details); | 240 CloseConnectionWithDetails(error, error_details); |
241 return; | 241 return; |
242 } | 242 } |
243 if (!cached->proof_valid()) { | 243 if (!cached->proof_valid()) { |
244 ProofVerifier* verifier = crypto_config_->proof_verifier(); | 244 ProofVerifier* verifier = crypto_config_->proof_verifier(); |
245 if (!verifier) { | 245 if (!verifier) { |
246 // If no verifier is set then we don't check the certificates. | 246 // If no verifier is set then we don't check the certificates. |
247 cached->SetProofValid(); | 247 cached->SetProofValid(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // alternative_decrypter will be NULL if the original alternative | 327 // alternative_decrypter will be NULL if the original alternative |
328 // decrypter latched and became the primary decrypter. That happens | 328 // decrypter latched and became the primary decrypter. That happens |
329 // if we received a message encrypted with the INITIAL key. | 329 // if we received a message encrypted with the INITIAL key. |
330 if (session()->connection()->alternative_decrypter() != NULL) { | 330 if (session()->connection()->alternative_decrypter() != NULL) { |
331 // The server hello was sent without encryption. | 331 // The server hello was sent without encryption. |
332 CloseConnectionWithDetails(QUIC_CRYPTO_ENCRYPTION_LEVEL_INCORRECT, | 332 CloseConnectionWithDetails(QUIC_CRYPTO_ENCRYPTION_LEVEL_INCORRECT, |
333 "unencrypted SHLO message"); | 333 "unencrypted SHLO message"); |
334 return; | 334 return; |
335 } | 335 } |
336 error = crypto_config_->ProcessServerHello( | 336 error = crypto_config_->ProcessServerHello( |
337 *in, session()->connection()->guid(), &crypto_negotiated_params_, | 337 *in, session()->connection()->guid(), cached, |
338 &error_details); | 338 &crypto_negotiated_params_, &error_details); |
339 if (error != QUIC_NO_ERROR) { | 339 if (error != QUIC_NO_ERROR) { |
340 CloseConnectionWithDetails( | 340 CloseConnectionWithDetails( |
341 error, "Server hello invalid: " + error_details); | 341 error, "Server hello invalid: " + error_details); |
342 return; | 342 return; |
343 } | 343 } |
344 error = session()->config()->ProcessServerHello(*in, &error_details); | 344 error = session()->config()->ProcessServerHello(*in, &error_details); |
345 if (error != QUIC_NO_ERROR) { | 345 if (error != QUIC_NO_ERROR) { |
346 CloseConnectionWithDetails( | 346 CloseConnectionWithDetails( |
347 error, "Server hello invalid: " + error_details); | 347 error, "Server hello invalid: " + error_details); |
348 return; | 348 return; |
(...skipping 17 matching lines...) Expand all Loading... |
366 } | 366 } |
367 case STATE_IDLE: | 367 case STATE_IDLE: |
368 // This means that the peer sent us a message that we weren't expecting. | 368 // This means that the peer sent us a message that we weren't expecting. |
369 CloseConnection(QUIC_INVALID_CRYPTO_MESSAGE_TYPE); | 369 CloseConnection(QUIC_INVALID_CRYPTO_MESSAGE_TYPE); |
370 return; | 370 return; |
371 } | 371 } |
372 } | 372 } |
373 } | 373 } |
374 | 374 |
375 } // namespace net | 375 } // namespace net |
OLD | NEW |