Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: net/quic/quic_crypto_server_stream.cc

Issue 849123003: Land Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed extra blank line Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_crypto_server_stream.h ('k') | net/quic/quic_flags.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/cached_network_parameters.h" 9 #include "net/quic/crypto/cached_network_parameters.h"
10 #include "net/quic/crypto/crypto_protocol.h" 10 #include "net/quic/crypto/crypto_protocol.h"
11 #include "net/quic/crypto/crypto_utils.h" 11 #include "net/quic/crypto/crypto_utils.h"
12 #include "net/quic/crypto/quic_crypto_server_config.h" 12 #include "net/quic/crypto/quic_crypto_server_config.h"
13 #include "net/quic/quic_config.h" 13 #include "net/quic/quic_config.h"
14 #include "net/quic/quic_protocol.h" 14 #include "net/quic/quic_protocol.h"
15 #include "net/quic/quic_session.h" 15 #include "net/quic/quic_session.h"
16 16
17 using std::string; 17 using std::string;
18 18
19 namespace net { 19 namespace net {
20 20
21 void ServerHelloNotifier::OnAckNotification( 21 void ServerHelloNotifier::OnAckNotification(
22 int num_original_packets,
23 int num_original_bytes,
24 int num_retransmitted_packets, 22 int num_retransmitted_packets,
25 int num_retransmitted_bytes, 23 int num_retransmitted_bytes,
26 QuicTime::Delta delta_largest_observed) { 24 QuicTime::Delta delta_largest_observed) {
27 server_stream_->OnServerHelloAcked(); 25 server_stream_->OnServerHelloAcked();
28 } 26 }
29 27
30 QuicCryptoServerStream::QuicCryptoServerStream( 28 QuicCryptoServerStream::QuicCryptoServerStream(
31 const QuicCryptoServerConfig& crypto_config, 29 const QuicCryptoServerConfig& crypto_config,
32 QuicSession* session) 30 QuicSession* session)
33 : QuicCryptoStream(session), 31 : QuicCryptoStream(session),
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 crypto_negotiated_params_.initial_crypters.encrypter.release()); 121 crypto_negotiated_params_.initial_crypters.encrypter.release());
124 session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_INITIAL); 122 session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_INITIAL);
125 // Set the decrypter immediately so that we no longer accept unencrypted 123 // Set the decrypter immediately so that we no longer accept unencrypted
126 // packets. 124 // packets.
127 session()->connection()->SetDecrypter( 125 session()->connection()->SetDecrypter(
128 crypto_negotiated_params_.initial_crypters.decrypter.release(), 126 crypto_negotiated_params_.initial_crypters.decrypter.release(),
129 ENCRYPTION_INITIAL); 127 ENCRYPTION_INITIAL);
130 128
131 // We want to be notified when the SHLO is ACKed so that we can disable 129 // We want to be notified when the SHLO is ACKed so that we can disable
132 // HANDSHAKE_MODE in the sent packet manager. 130 // HANDSHAKE_MODE in the sent packet manager.
133 if (session()->connection()->version() <= QUIC_VERSION_21) { 131 scoped_refptr<ServerHelloNotifier> server_hello_notifier(
134 SendHandshakeMessage(reply); 132 new ServerHelloNotifier(this));
135 } else { 133 SendHandshakeMessage(reply, server_hello_notifier.get());
136 scoped_refptr<ServerHelloNotifier> server_hello_notifier(
137 new ServerHelloNotifier(this));
138 SendHandshakeMessage(reply, server_hello_notifier.get());
139 }
140 134
141 session()->connection()->SetEncrypter( 135 session()->connection()->SetEncrypter(
142 ENCRYPTION_FORWARD_SECURE, 136 ENCRYPTION_FORWARD_SECURE,
143 crypto_negotiated_params_.forward_secure_crypters.encrypter.release()); 137 crypto_negotiated_params_.forward_secure_crypters.encrypter.release());
144 session()->connection()->SetAlternativeDecrypter( 138 session()->connection()->SetAlternativeDecrypter(
145 crypto_negotiated_params_.forward_secure_crypters.decrypter.release(), 139 crypto_negotiated_params_.forward_secure_crypters.decrypter.release(),
146 ENCRYPTION_FORWARD_SECURE, false /* don't latch */); 140 ENCRYPTION_FORWARD_SECURE, false /* don't latch */);
147 141
148 encryption_established_ = true; 142 encryption_established_ = true;
149 handshake_confirmed_ = true; 143 handshake_confirmed_ = true;
150 session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED); 144 session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED);
151 } 145 }
152 146
153 void QuicCryptoServerStream::SendServerConfigUpdate( 147 void QuicCryptoServerStream::SendServerConfigUpdate(
154 const CachedNetworkParameters* cached_network_params) { 148 const CachedNetworkParameters* cached_network_params) {
155 if (session()->connection()->version() <= QUIC_VERSION_21 || 149 if (!handshake_confirmed_) {
156 !handshake_confirmed_) {
157 return; 150 return;
158 } 151 }
159 152
160 CryptoHandshakeMessage server_config_update_message; 153 CryptoHandshakeMessage server_config_update_message;
161 if (!crypto_config_.BuildServerConfigUpdateMessage( 154 if (!crypto_config_.BuildServerConfigUpdateMessage(
162 previous_source_address_tokens_, 155 previous_source_address_tokens_,
163 session()->connection()->self_address(), 156 session()->connection()->self_address(),
164 session()->connection()->peer_address(), 157 session()->connection()->peer_address(),
165 session()->connection()->clock(), 158 session()->connection()->clock(),
166 session()->connection()->random_generator(), 159 session()->connection()->random_generator(),
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 250
258 void QuicCryptoServerStream::ValidateCallback::RunImpl( 251 void QuicCryptoServerStream::ValidateCallback::RunImpl(
259 const CryptoHandshakeMessage& client_hello, 252 const CryptoHandshakeMessage& client_hello,
260 const Result& result) { 253 const Result& result) {
261 if (parent_ != nullptr) { 254 if (parent_ != nullptr) {
262 parent_->FinishProcessingHandshakeMessage(client_hello, result); 255 parent_->FinishProcessingHandshakeMessage(client_hello, result);
263 } 256 }
264 } 257 }
265 258
266 } // namespace net 259 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_server_stream.h ('k') | net/quic/quic_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698