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

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

Issue 15074007: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for windows Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_crypto_server_stream.h ('k') | net/quic/quic_crypto_server_stream_test.cc » ('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 "net/quic/crypto/crypto_protocol.h" 7 #include "net/quic/crypto/crypto_protocol.h"
8 #include "net/quic/crypto/crypto_server_config.h" 8 #include "net/quic/crypto/crypto_server_config.h"
9 #include "net/quic/crypto/crypto_utils.h" 9 #include "net/quic/crypto/crypto_utils.h"
10 #include "net/quic/quic_config.h" 10 #include "net/quic/quic_config.h"
11 #include "net/quic/quic_protocol.h" 11 #include "net/quic/quic_protocol.h"
12 #include "net/quic/quic_session.h" 12 #include "net/quic/quic_session.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 QuicCryptoServerStream::QuicCryptoServerStream( 16 QuicCryptoServerStream::QuicCryptoServerStream(
17 const QuicConfig& config,
18 const QuicCryptoServerConfig& crypto_config, 17 const QuicCryptoServerConfig& crypto_config,
19 QuicSession* session) 18 QuicSession* session)
20 : QuicCryptoStream(session), 19 : QuicCryptoStream(session),
21 config_(config),
22 crypto_config_(crypto_config) { 20 crypto_config_(crypto_config) {
23 } 21 }
24 22
25 QuicCryptoServerStream::~QuicCryptoServerStream() { 23 QuicCryptoServerStream::~QuicCryptoServerStream() {
26 } 24 }
27 25
28 void QuicCryptoServerStream::OnHandshakeMessage( 26 void QuicCryptoServerStream::OnHandshakeMessage(
29 const CryptoHandshakeMessage& message) { 27 const CryptoHandshakeMessage& message) {
30 // Do not process handshake messages after the handshake is confirmed. 28 // Do not process handshake messages after the handshake is confirmed.
31 if (handshake_confirmed_) { 29 if (handshake_confirmed_) {
(...skipping 19 matching lines...) Expand all
51 CloseConnectionWithDetails(error, error_details); 49 CloseConnectionWithDetails(error, error_details);
52 return; 50 return;
53 } 51 }
54 52
55 if (reply.tag() != kSHLO) { 53 if (reply.tag() != kSHLO) {
56 SendHandshakeMessage(reply); 54 SendHandshakeMessage(reply);
57 return; 55 return;
58 } 56 }
59 57
60 // If we are returning a SHLO then we accepted the handshake. 58 // If we are returning a SHLO then we accepted the handshake.
61 error = config_.ProcessFinalPeerHandshake( 59 QuicConfig* config = session()->config();
62 message, CryptoUtils::LOCAL_PRIORITY, &negotiated_params_, 60 error = config->ProcessClientHello(message, &error_details);
63 &error_details);
64 if (error != QUIC_NO_ERROR) { 61 if (error != QUIC_NO_ERROR) {
65 CloseConnectionWithDetails(error, error_details); 62 CloseConnectionWithDetails(error, error_details);
66 return; 63 return;
67 } 64 }
68 65
66 config->ToHandshakeMessage(&reply);
67
69 // Receiving a full CHLO implies the client is prepared to decrypt with 68 // Receiving a full CHLO implies the client is prepared to decrypt with
70 // the new server write key. We can start to encrypt with the new server 69 // the new server write key. We can start to encrypt with the new server
71 // write key. 70 // write key.
72 // 71 //
73 // NOTE: the SHLO will be encrypted with the new server write key. 72 // NOTE: the SHLO will be encrypted with the new server write key.
74 session()->connection()->SetEncrypter( 73 session()->connection()->SetEncrypter(
75 ENCRYPTION_INITIAL, 74 ENCRYPTION_INITIAL,
76 crypto_negotiated_params_.initial_crypters.encrypter.release()); 75 crypto_negotiated_params_.initial_crypters.encrypter.release());
77 session()->connection()->SetDefaultEncryptionLevel( 76 session()->connection()->SetDefaultEncryptionLevel(
78 ENCRYPTION_INITIAL); 77 ENCRYPTION_INITIAL);
(...skipping 11 matching lines...) Expand all
90 session()->connection()->SetAlternativeDecrypter( 89 session()->connection()->SetAlternativeDecrypter(
91 crypto_negotiated_params_.forward_secure_crypters.decrypter.release(), 90 crypto_negotiated_params_.forward_secure_crypters.decrypter.release(),
92 false /* don't latch */); 91 false /* don't latch */);
93 92
94 encryption_established_ = true; 93 encryption_established_ = true;
95 handshake_confirmed_ = true; 94 handshake_confirmed_ = true;
96 session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED); 95 session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED);
97 } 96 }
98 97
99 } // namespace net 98 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_server_stream.h ('k') | net/quic/quic_crypto_server_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698