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

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

Issue 12806002: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor comment fix Created 7 years, 9 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_utils.h" 8 #include "net/quic/crypto/crypto_utils.h"
9 #include "net/quic/quic_protocol.h" 9 #include "net/quic/quic_protocol.h"
10 #include "net/quic/quic_session.h" 10 #include "net/quic/quic_session.h"
11 11
12 namespace net { 12 namespace net {
13 13
14 QuicCryptoServerStream::QuicCryptoServerStream(QuicSession* session) 14 QuicCryptoServerStream::QuicCryptoServerStream(QuicSession* session)
15 : QuicCryptoStream(session) { 15 : QuicCryptoStream(session) {
16 config_.SetDefaults(); 16 config_.SetDefaults();
17 // Use hardcoded crypto parameters for now. 17 // Use hardcoded crypto parameters for now.
18 CryptoHandshakeMessage extra_tags; 18 CryptoHandshakeMessage extra_tags;
19 config_.ToHandshakeMessage(&extra_tags); 19 config_.ToHandshakeMessage(&extra_tags);
20
21 QuicGuid guid = session->connection()->guid();
22 crypto_config_.hkdf_info.append(reinterpret_cast<char*>(&guid),
23 sizeof(guid));
20 // TODO(agl): AddTestingConfig generates a new, random config. In the future 24 // TODO(agl): AddTestingConfig generates a new, random config. In the future
21 // this will be replaced with a real source of configs. 25 // this will be replaced with a real source of configs.
22 scoped_ptr<CryptoTagValueMap> config_tags( 26 scoped_ptr<CryptoTagValueMap> config_tags(
23 crypto_config_.AddTestingConfig(session->connection()->random_generator(), 27 crypto_config_.AddTestingConfig(session->connection()->random_generator(),
24 session->connection()->clock(), 28 session->connection()->clock(),
25 extra_tags)); 29 extra_tags));
26 // If we were using the same config in many servers then we would have to 30 // If we were using the same config in many servers then we would have to
27 // parse a QuicConfig from config_tags here. 31 // parse a QuicConfig from config_tags here.
28 } 32 }
29 33
(...skipping 19 matching lines...) Expand all
49 &error_details); 53 &error_details);
50 if (error != QUIC_NO_ERROR) { 54 if (error != QUIC_NO_ERROR) {
51 CloseConnectionWithDetails(error, "negotiated params"); 55 CloseConnectionWithDetails(error, "negotiated params");
52 return; 56 return;
53 } 57 }
54 58
55 CryptoHandshakeMessage shlo; 59 CryptoHandshakeMessage shlo;
56 CryptoUtils::GenerateNonce(session()->connection()->clock(), 60 CryptoUtils::GenerateNonce(session()->connection()->clock(),
57 session()->connection()->random_generator(), 61 session()->connection()->random_generator(),
58 &server_nonce_); 62 &server_nonce_);
59 QuicCryptoNegotiatedParams params; 63 crypto_config_.ProcessClientHello(message, server_nonce_, &shlo,
60 crypto_config_.ProcessClientHello(message, server_nonce_, &shlo, &params, 64 &crypto_negotiated_params_, &error_details);
61 &error_details);
62 if (!error_details.empty()) { 65 if (!error_details.empty()) {
63 DLOG(INFO) << "Rejecting CHLO: " << error_details; 66 DLOG(INFO) << "Rejecting CHLO: " << error_details;
64 } 67 }
65 config_.ToHandshakeMessage(&shlo); 68 config_.ToHandshakeMessage(&shlo);
66 SendHandshakeMessage(shlo); 69 SendHandshakeMessage(shlo);
67 70
68 // TODO(rch): correctly validate the message 71 // TODO(rch): correctly validate the message
69 SetHandshakeComplete(QUIC_NO_ERROR); 72 SetHandshakeComplete(QUIC_NO_ERROR);
70 return; 73 return;
71 } 74 }
72 75
73 } // namespace net 76 } // 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