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/quic/crypto/channel_id.h" |
7 #include "net/quic/crypto/crypto_protocol.h" | 8 #include "net/quic/crypto/crypto_protocol.h" |
8 #include "net/quic/crypto/crypto_utils.h" | 9 #include "net/quic/crypto/crypto_utils.h" |
9 #include "net/quic/crypto/null_encrypter.h" | 10 #include "net/quic/crypto/null_encrypter.h" |
10 #include "net/quic/crypto/proof_verifier.h" | 11 #include "net/quic/crypto/proof_verifier.h" |
11 #include "net/quic/quic_client_session_base.h" | 12 #include "net/quic/quic_client_session_base.h" |
12 #include "net/quic/quic_protocol.h" | 13 #include "net/quic/quic_protocol.h" |
13 #include "net/quic/quic_session.h" | 14 #include "net/quic/quic_session.h" |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 | 17 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 CloseConnection(QUIC_INTERNAL_ERROR); | 145 CloseConnection(QUIC_INTERNAL_ERROR); |
145 return; | 146 return; |
146 } | 147 } |
147 out.set_minimum_size(max_packet_size - kFramingOverhead); | 148 out.set_minimum_size(max_packet_size - kFramingOverhead); |
148 next_state_ = STATE_RECV_REJ; | 149 next_state_ = STATE_RECV_REJ; |
149 DVLOG(1) << "Client: Sending " << out.DebugString(); | 150 DVLOG(1) << "Client: Sending " << out.DebugString(); |
150 SendHandshakeMessage(out); | 151 SendHandshakeMessage(out); |
151 return; | 152 return; |
152 } | 153 } |
153 session()->config()->ToHandshakeMessage(&out); | 154 session()->config()->ToHandshakeMessage(&out); |
| 155 |
| 156 scoped_ptr<ChannelIDKey> channel_id_key; |
| 157 bool do_channel_id = false; |
| 158 if (crypto_config_->channel_id_source()) { |
| 159 const CryptoHandshakeMessage* scfg = cached->GetServerConfig(); |
| 160 DCHECK(scfg); |
| 161 const QuicTag* their_proof_demands; |
| 162 size_t num_their_proof_demands; |
| 163 if (scfg->GetTaglist(kPDMD, &their_proof_demands, |
| 164 &num_their_proof_demands) == QUIC_NO_ERROR) { |
| 165 for (size_t i = 0; i < num_their_proof_demands; i++) { |
| 166 if (their_proof_demands[i] == kCHID) { |
| 167 do_channel_id = true; |
| 168 break; |
| 169 } |
| 170 } |
| 171 } |
| 172 } |
| 173 if (do_channel_id) { |
| 174 QuicAsyncStatus status = |
| 175 crypto_config_->channel_id_source()->GetChannelIDKey( |
| 176 server_id_.host(), &channel_id_key, NULL); |
| 177 if (status != QUIC_SUCCESS) { |
| 178 CloseConnectionWithDetails(QUIC_INVALID_CHANNEL_ID_SIGNATURE, |
| 179 "Channel ID lookup failed"); |
| 180 return; |
| 181 } |
| 182 } |
| 183 |
154 error = crypto_config_->FillClientHello( | 184 error = crypto_config_->FillClientHello( |
155 server_id_, | 185 server_id_, |
156 session()->connection()->connection_id(), | 186 session()->connection()->connection_id(), |
157 session()->connection()->supported_versions().front(), | 187 session()->connection()->supported_versions().front(), |
158 session()->max_flow_control_receive_window_bytes(), | 188 session()->max_flow_control_receive_window_bytes(), |
159 cached, | 189 cached, |
160 session()->connection()->clock()->WallNow(), | 190 session()->connection()->clock()->WallNow(), |
161 session()->connection()->random_generator(), | 191 session()->connection()->random_generator(), |
| 192 channel_id_key.get(), |
162 &crypto_negotiated_params_, | 193 &crypto_negotiated_params_, |
163 &out, | 194 &out, |
164 &error_details); | 195 &error_details); |
165 if (error != QUIC_NO_ERROR) { | 196 if (error != QUIC_NO_ERROR) { |
166 // Flush the cached config so that, if it's bad, the server has a | 197 // Flush the cached config so that, if it's bad, the server has a |
167 // chance to send us another in the future. | 198 // chance to send us another in the future. |
168 cached->InvalidateServerConfig(); | 199 cached->InvalidateServerConfig(); |
169 CloseConnectionWithDetails(error, error_details); | 200 CloseConnectionWithDetails(error, error_details); |
170 return; | 201 return; |
171 } | 202 } |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 QuicCryptoClientConfig::CachedState* cached) { | 389 QuicCryptoClientConfig::CachedState* cached) { |
359 cached->SetProofValid(); | 390 cached->SetProofValid(); |
360 client_session()->OnProofValid(*cached); | 391 client_session()->OnProofValid(*cached); |
361 } | 392 } |
362 | 393 |
363 QuicClientSessionBase* QuicCryptoClientStream::client_session() { | 394 QuicClientSessionBase* QuicCryptoClientStream::client_session() { |
364 return reinterpret_cast<QuicClientSessionBase*>(session()); | 395 return reinterpret_cast<QuicClientSessionBase*>(session()); |
365 } | 396 } |
366 | 397 |
367 } // namespace net | 398 } // namespace net |
OLD | NEW |