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