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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 return; | 84 return; |
85 } | 85 } |
86 | 86 |
87 if (reply.tag() != kSHLO) { | 87 if (reply.tag() != kSHLO) { |
88 SendHandshakeMessage(reply); | 88 SendHandshakeMessage(reply); |
89 return; | 89 return; |
90 } | 90 } |
91 | 91 |
92 // If we are returning a SHLO then we accepted the handshake. | 92 // If we are returning a SHLO then we accepted the handshake. |
93 QuicConfig* config = session()->config(); | 93 QuicConfig* config = session()->config(); |
| 94 OverrideQuicConfigDefaults(config); |
94 error = config->ProcessPeerHello(message, CLIENT, &error_details); | 95 error = config->ProcessPeerHello(message, CLIENT, &error_details); |
95 if (error != QUIC_NO_ERROR) { | 96 if (error != QUIC_NO_ERROR) { |
96 CloseConnectionWithDetails(error, error_details); | 97 CloseConnectionWithDetails(error, error_details); |
97 return; | 98 return; |
98 } | 99 } |
99 session()->OnConfigNegotiated(); | 100 session()->OnConfigNegotiated(); |
100 | 101 |
101 config->ToHandshakeMessage(&reply); | 102 config->ToHandshakeMessage(&reply); |
102 | 103 |
103 // Receiving a full CHLO implies the client is prepared to decrypt with | 104 // Receiving a full CHLO implies the client is prepared to decrypt with |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 const CryptoHandshakeMessage& message, | 166 const CryptoHandshakeMessage& message, |
166 const ValidateClientHelloResultCallback::Result& result, | 167 const ValidateClientHelloResultCallback::Result& result, |
167 CryptoHandshakeMessage* reply, | 168 CryptoHandshakeMessage* reply, |
168 string* error_details) { | 169 string* error_details) { |
169 return crypto_config_.ProcessClientHello( | 170 return crypto_config_.ProcessClientHello( |
170 result, | 171 result, |
171 session()->connection()->connection_id(), | 172 session()->connection()->connection_id(), |
172 session()->connection()->peer_address(), | 173 session()->connection()->peer_address(), |
173 session()->connection()->version(), | 174 session()->connection()->version(), |
174 session()->connection()->supported_versions(), | 175 session()->connection()->supported_versions(), |
175 session()->connection()->max_flow_control_receive_window_bytes(), | 176 session()->max_flow_control_receive_window_bytes(), |
176 session()->connection()->clock(), | 177 session()->connection()->clock(), |
177 session()->connection()->random_generator(), | 178 session()->connection()->random_generator(), |
178 &crypto_negotiated_params_, reply, error_details); | 179 &crypto_negotiated_params_, reply, error_details); |
179 } | 180 } |
180 | 181 |
| 182 void QuicCryptoServerStream::OverrideQuicConfigDefaults(QuicConfig* config) { |
| 183 } |
| 184 |
181 QuicCryptoServerStream::ValidateCallback::ValidateCallback( | 185 QuicCryptoServerStream::ValidateCallback::ValidateCallback( |
182 QuicCryptoServerStream* parent) : parent_(parent) { | 186 QuicCryptoServerStream* parent) : parent_(parent) { |
183 } | 187 } |
184 | 188 |
185 void QuicCryptoServerStream::ValidateCallback::Cancel() { | 189 void QuicCryptoServerStream::ValidateCallback::Cancel() { |
186 parent_ = NULL; | 190 parent_ = NULL; |
187 } | 191 } |
188 | 192 |
189 void QuicCryptoServerStream::ValidateCallback::RunImpl( | 193 void QuicCryptoServerStream::ValidateCallback::RunImpl( |
190 const CryptoHandshakeMessage& client_hello, | 194 const CryptoHandshakeMessage& client_hello, |
191 const Result& result) { | 195 const Result& result) { |
192 if (parent_ != NULL) { | 196 if (parent_ != NULL) { |
193 parent_->FinishProcessingHandshakeMessage(client_hello, result); | 197 parent_->FinishProcessingHandshakeMessage(client_hello, result); |
194 } | 198 } |
195 } | 199 } |
196 | 200 |
197 } // namespace net | 201 } // namespace net |
OLD | NEW |