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

Side by Side Diff: net/quic/core/quic_crypto_stream.cc

Issue 2453113002: Fix object-lifetime issues in async GetProof callpaths (Closed)
Patch Set: Updated patchset dependency Created 4 years, 1 month 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/core/quic_crypto_stream.h ('k') | net/quic/core/quic_server_session_base_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/core/quic_crypto_stream.h" 5 #include "net/quic/core/quic_crypto_stream.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/string_piece.h" 9 #include "base/strings/string_piece.h"
10 #include "net/quic/core/crypto/crypto_handshake.h" 10 #include "net/quic/core/crypto/crypto_handshake.h"
11 #include "net/quic/core/crypto/crypto_utils.h" 11 #include "net/quic/core/crypto/crypto_utils.h"
12 #include "net/quic/core/quic_connection.h" 12 #include "net/quic/core/quic_connection.h"
13 #include "net/quic/core/quic_flags.h" 13 #include "net/quic/core/quic_flags.h"
14 #include "net/quic/core/quic_session.h" 14 #include "net/quic/core/quic_session.h"
15 #include "net/quic/core/quic_utils.h" 15 #include "net/quic/core/quic_utils.h"
16 16
17 using std::string; 17 using std::string;
18 using base::StringPiece; 18 using base::StringPiece;
19 using net::SpdyPriority; 19 using net::SpdyPriority;
20 20
21 namespace net { 21 namespace net {
22 22
23 #define ENDPOINT \ 23 #define ENDPOINT \
24 (session()->perspective() == Perspective::IS_SERVER ? "Server: " : "Client:" \ 24 (session()->perspective() == Perspective::IS_SERVER ? "Server: " : "Client:" \
25 " ") 25 " ")
26 26
27 QuicCryptoStream::QuicCryptoStream(QuicSession* session) 27 QuicCryptoStream::QuicCryptoStream(QuicSession* session)
28 : ReliableQuicStream(kCryptoStreamId, session), 28 : ReliableQuicStream(kCryptoStreamId, session),
29 encryption_established_(false), 29 encryption_established_(false),
30 handshake_confirmed_(false) { 30 handshake_confirmed_(false),
31 crypto_negotiated_params_(new QuicCryptoNegotiatedParameters) {
31 crypto_framer_.set_visitor(this); 32 crypto_framer_.set_visitor(this);
32 // The crypto stream is exempt from connection level flow control. 33 // The crypto stream is exempt from connection level flow control.
33 DisableConnectionFlowControlForThisStream(); 34 DisableConnectionFlowControlForThisStream();
34 } 35 }
35 36
37 QuicCryptoStream::~QuicCryptoStream() {}
38
36 // static 39 // static
37 QuicByteCount QuicCryptoStream::CryptoMessageFramingOverhead( 40 QuicByteCount QuicCryptoStream::CryptoMessageFramingOverhead(
38 QuicVersion version) { 41 QuicVersion version) {
39 return QuicPacketCreator::StreamFramePacketOverhead( 42 return QuicPacketCreator::StreamFramePacketOverhead(
40 version, PACKET_8BYTE_CONNECTION_ID, 43 version, PACKET_8BYTE_CONNECTION_ID,
41 /*include_version=*/true, 44 /*include_version=*/true,
42 /*include_path_id=*/true, 45 /*include_path_id=*/true,
43 /*include_diversification_nonce=*/true, PACKET_1BYTE_PACKET_NUMBER, 46 /*include_diversification_nonce=*/true, PACKET_1BYTE_PACKET_NUMBER,
44 /*offset=*/0); 47 /*offset=*/0);
45 } 48 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 bool QuicCryptoStream::ExportKeyingMaterial(StringPiece label, 94 bool QuicCryptoStream::ExportKeyingMaterial(StringPiece label,
92 StringPiece context, 95 StringPiece context,
93 size_t result_len, 96 size_t result_len,
94 string* result) const { 97 string* result) const {
95 if (!handshake_confirmed()) { 98 if (!handshake_confirmed()) {
96 DLOG(ERROR) << "ExportKeyingMaterial was called before forward-secure" 99 DLOG(ERROR) << "ExportKeyingMaterial was called before forward-secure"
97 << "encryption was established."; 100 << "encryption was established.";
98 return false; 101 return false;
99 } 102 }
100 return CryptoUtils::ExportKeyingMaterial( 103 return CryptoUtils::ExportKeyingMaterial(
101 crypto_negotiated_params_.subkey_secret, label, context, result_len, 104 crypto_negotiated_params_->subkey_secret, label, context, result_len,
102 result); 105 result);
103 } 106 }
104 107
105 bool QuicCryptoStream::ExportTokenBindingKeyingMaterial(string* result) const { 108 bool QuicCryptoStream::ExportTokenBindingKeyingMaterial(string* result) const {
106 if (!encryption_established()) { 109 if (!encryption_established()) {
107 QUIC_BUG << "ExportTokenBindingKeyingMaterial was called before initial" 110 QUIC_BUG << "ExportTokenBindingKeyingMaterial was called before initial"
108 << "encryption was established."; 111 << "encryption was established.";
109 return false; 112 return false;
110 } 113 }
111 return CryptoUtils::ExportKeyingMaterial( 114 return CryptoUtils::ExportKeyingMaterial(
112 crypto_negotiated_params_.initial_subkey_secret, "EXPORTER-Token-Binding", 115 crypto_negotiated_params_->initial_subkey_secret,
116 "EXPORTER-Token-Binding",
113 /* context= */ "", 32, result); 117 /* context= */ "", 32, result);
114 } 118 }
115 119
116 const QuicCryptoNegotiatedParameters& 120 const QuicCryptoNegotiatedParameters&
117 QuicCryptoStream::crypto_negotiated_params() const { 121 QuicCryptoStream::crypto_negotiated_params() const {
118 return crypto_negotiated_params_; 122 return *crypto_negotiated_params_;
119 } 123 }
120 124
121 } // namespace net 125 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_crypto_stream.h ('k') | net/quic/core/quic_server_session_base_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698