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_server_stream.h" | 5 #include "net/quic/quic_crypto_server_stream.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "crypto/secure_hash.h" | 10 #include "crypto/secure_hash.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (validate_client_hello_cb_ != nullptr) { | 107 if (validate_client_hello_cb_ != nullptr) { |
108 // Already processing some other handshake message. The protocol | 108 // Already processing some other handshake message. The protocol |
109 // does not allow for clients to send multiple handshake messages | 109 // does not allow for clients to send multiple handshake messages |
110 // before the server has a chance to respond. | 110 // before the server has a chance to respond. |
111 CloseConnectionWithDetails( | 111 CloseConnectionWithDetails( |
112 QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO, | 112 QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO, |
113 "Unexpected handshake message while processing CHLO"); | 113 "Unexpected handshake message while processing CHLO"); |
114 return; | 114 return; |
115 } | 115 } |
116 | 116 |
| 117 CryptoUtils::HashHandshakeMessage(message, &chlo_hash_); |
| 118 |
117 validate_client_hello_cb_ = new ValidateCallback(this); | 119 validate_client_hello_cb_ = new ValidateCallback(this); |
118 crypto_config_->ValidateClientHello( | 120 crypto_config_->ValidateClientHello( |
119 message, session()->connection()->peer_address().address(), | 121 message, session()->connection()->peer_address().address(), |
120 session()->connection()->self_address().address(), version(), | 122 session()->connection()->self_address().address(), version(), |
121 session()->connection()->clock(), &crypto_proof_, | 123 session()->connection()->clock(), &crypto_proof_, |
122 validate_client_hello_cb_); | 124 validate_client_hello_cb_); |
123 } | 125 } |
124 | 126 |
125 void QuicCryptoServerStream::FinishProcessingHandshakeMessage( | 127 void QuicCryptoServerStream::FinishProcessingHandshakeMessage( |
126 const CryptoHandshakeMessage& message, | 128 const CryptoHandshakeMessage& message, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 229 } |
228 | 230 |
229 void QuicCryptoServerStream::SendServerConfigUpdate( | 231 void QuicCryptoServerStream::SendServerConfigUpdate( |
230 const CachedNetworkParameters* cached_network_params) { | 232 const CachedNetworkParameters* cached_network_params) { |
231 if (!handshake_confirmed_) { | 233 if (!handshake_confirmed_) { |
232 return; | 234 return; |
233 } | 235 } |
234 | 236 |
235 CryptoHandshakeMessage server_config_update_message; | 237 CryptoHandshakeMessage server_config_update_message; |
236 if (!crypto_config_->BuildServerConfigUpdateMessage( | 238 if (!crypto_config_->BuildServerConfigUpdateMessage( |
237 session()->connection()->version(), previous_source_address_tokens_, | 239 session()->connection()->version(), chlo_hash_, |
| 240 previous_source_address_tokens_, |
238 session()->connection()->self_address().address(), | 241 session()->connection()->self_address().address(), |
239 session()->connection()->peer_address().address(), | 242 session()->connection()->peer_address().address(), |
240 session()->connection()->clock(), | 243 session()->connection()->clock(), |
241 session()->connection()->random_generator(), compressed_certs_cache_, | 244 session()->connection()->random_generator(), compressed_certs_cache_, |
242 crypto_negotiated_params_, cached_network_params, | 245 crypto_negotiated_params_, cached_network_params, |
243 &server_config_update_message)) { | 246 &server_config_update_message)) { |
244 DVLOG(1) << "Server: Failed to build server config update (SCUP)!"; | 247 DVLOG(1) << "Server: Failed to build server config update (SCUP)!"; |
245 return; | 248 return; |
246 } | 249 } |
247 | 250 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } | 396 } |
394 for (size_t i = 0; i < received_tags_length; ++i) { | 397 for (size_t i = 0; i < received_tags_length; ++i) { |
395 if (received_tags[i] == kSREJ) { | 398 if (received_tags[i] == kSREJ) { |
396 return true; | 399 return true; |
397 } | 400 } |
398 } | 401 } |
399 return false; | 402 return false; |
400 } | 403 } |
401 | 404 |
402 } // namespace net | 405 } // namespace net |
OLD | NEW |