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 "base/base64.h" | 7 #include "base/base64.h" |
8 #include "crypto/secure_hash.h" | 8 #include "crypto/secure_hash.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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // does not allow for clients to send multiple handshake messages | 106 // does not allow for clients to send multiple handshake messages |
107 // before the server has a chance to respond. | 107 // before the server has a chance to respond. |
108 CloseConnectionWithDetails( | 108 CloseConnectionWithDetails( |
109 QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO, | 109 QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO, |
110 "Unexpected handshake message while processing CHLO"); | 110 "Unexpected handshake message while processing CHLO"); |
111 return; | 111 return; |
112 } | 112 } |
113 | 113 |
114 validate_client_hello_cb_ = new ValidateCallback(this); | 114 validate_client_hello_cb_ = new ValidateCallback(this); |
115 return crypto_config_->ValidateClientHello( | 115 return crypto_config_->ValidateClientHello( |
116 message, session()->connection()->peer_address().address(), | 116 message, session()->connection()->peer_address().address().bytes(), |
117 session()->connection()->self_address().address(), version(), | 117 session()->connection()->self_address().address().bytes(), version(), |
118 session()->connection()->clock(), &crypto_proof_, | 118 session()->connection()->clock(), &crypto_proof_, |
119 validate_client_hello_cb_); | 119 validate_client_hello_cb_); |
120 } | 120 } |
121 | 121 |
122 void QuicCryptoServerStream::FinishProcessingHandshakeMessage( | 122 void QuicCryptoServerStream::FinishProcessingHandshakeMessage( |
123 const CryptoHandshakeMessage& message, | 123 const CryptoHandshakeMessage& message, |
124 const ValidateClientHelloResultCallback::Result& result) { | 124 const ValidateClientHelloResultCallback::Result& result) { |
125 // Clear the callback that got us here. | 125 // Clear the callback that got us here. |
126 DCHECK(validate_client_hello_cb_ != nullptr); | 126 DCHECK(validate_client_hello_cb_ != nullptr); |
127 validate_client_hello_cb_ = nullptr; | 127 validate_client_hello_cb_ = nullptr; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
216 void QuicCryptoServerStream::SendServerConfigUpdate( | 216 void QuicCryptoServerStream::SendServerConfigUpdate( |
217 const CachedNetworkParameters* cached_network_params) { | 217 const CachedNetworkParameters* cached_network_params) { |
218 if (!handshake_confirmed_) { | 218 if (!handshake_confirmed_) { |
219 return; | 219 return; |
220 } | 220 } |
221 | 221 |
222 CryptoHandshakeMessage server_config_update_message; | 222 CryptoHandshakeMessage server_config_update_message; |
223 if (!crypto_config_->BuildServerConfigUpdateMessage( | 223 if (!crypto_config_->BuildServerConfigUpdateMessage( |
224 session()->connection()->version(), previous_source_address_tokens_, | 224 session()->connection()->version(), previous_source_address_tokens_, |
225 session()->connection()->self_address().address(), | 225 session()->connection()->self_address().address().bytes(), |
226 session()->connection()->peer_address().address(), | 226 session()->connection()->peer_address().address().bytes(), |
227 session()->connection()->clock(), | 227 session()->connection()->clock(), |
228 session()->connection()->random_generator(), | 228 session()->connection()->random_generator(), |
229 crypto_negotiated_params_, cached_network_params, | 229 crypto_negotiated_params_, cached_network_params, |
230 &server_config_update_message)) { | 230 &server_config_update_message)) { |
231 DVLOG(1) << "Server: Failed to build server config update (SCUP)!"; | 231 DVLOG(1) << "Server: Failed to build server config update (SCUP)!"; |
232 return; | 232 return; |
233 } | 233 } |
234 | 234 |
235 DVLOG(1) << "Server: Sending server config update: " | 235 DVLOG(1) << "Server: Sending server config update: " |
236 << server_config_update_message.DebugString(); | 236 << server_config_update_message.DebugString(); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 327 |
328 const bool use_stateless_rejects_in_crypto_config = | 328 const bool use_stateless_rejects_in_crypto_config = |
329 use_stateless_rejects_if_peer_supported_ && | 329 use_stateless_rejects_if_peer_supported_ && |
330 peer_supports_stateless_rejects_; | 330 peer_supports_stateless_rejects_; |
331 QuicConnection* connection = session()->connection(); | 331 QuicConnection* connection = session()->connection(); |
332 const QuicConnectionId server_designated_connection_id = | 332 const QuicConnectionId server_designated_connection_id = |
333 use_stateless_rejects_in_crypto_config | 333 use_stateless_rejects_in_crypto_config |
334 ? GenerateConnectionIdForReject(connection->connection_id()) | 334 ? GenerateConnectionIdForReject(connection->connection_id()) |
335 : 0; | 335 : 0; |
336 return crypto_config_->ProcessClientHello( | 336 return crypto_config_->ProcessClientHello( |
337 result, connection->connection_id(), connection->self_address().address(), | 337 result, connection->connection_id(), |
338 connection->peer_address(), version(), connection->supported_versions(), | 338 connection->self_address().address().bytes(), connection->peer_address(), |
| 339 version(), connection->supported_versions(), |
339 use_stateless_rejects_in_crypto_config, server_designated_connection_id, | 340 use_stateless_rejects_in_crypto_config, server_designated_connection_id, |
340 connection->clock(), connection->random_generator(), | 341 connection->clock(), connection->random_generator(), |
341 &crypto_negotiated_params_, &crypto_proof_, reply, error_details); | 342 &crypto_negotiated_params_, &crypto_proof_, reply, error_details); |
342 } | 343 } |
343 | 344 |
344 void QuicCryptoServerStream::OverrideQuicConfigDefaults(QuicConfig* config) {} | 345 void QuicCryptoServerStream::OverrideQuicConfigDefaults(QuicConfig* config) {} |
345 | 346 |
346 QuicCryptoServerStream::ValidateCallback::ValidateCallback( | 347 QuicCryptoServerStream::ValidateCallback::ValidateCallback( |
347 QuicCryptoServerStream* parent) | 348 QuicCryptoServerStream* parent) |
348 : parent_(parent) {} | 349 : parent_(parent) {} |
(...skipping 29 matching lines...) Expand all Loading... |
378 } | 379 } |
379 for (size_t i = 0; i < received_tags_length; ++i) { | 380 for (size_t i = 0; i < received_tags_length; ++i) { |
380 if (received_tags[i] == kSREJ) { | 381 if (received_tags[i] == kSREJ) { |
381 return true; | 382 return true; |
382 } | 383 } |
383 } | 384 } |
384 return false; | 385 return false; |
385 } | 386 } |
386 | 387 |
387 } // namespace net | 388 } // namespace net |
OLD | NEW |