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

Side by Side Diff: net/quic/crypto/quic_server_info.cc

Issue 1818393003: QUIC - Persist "Hash of the CHLO message" and "Signed timestamp of the (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « net/quic/crypto/quic_server_info.h ('k') | net/quic/quic_chromium_client_session.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/crypto/quic_server_info.h" 5 #include "net/quic/crypto/quic_server_info.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 10
11 using std::string; 11 using std::string;
12 12
13 namespace { 13 namespace {
14 14
15 const int kQuicCryptoConfigVersion = 1; 15 const int kQuicCryptoConfigVersion = 2;
16 16
17 } // namespace 17 } // namespace
18 18
19 namespace net { 19 namespace net {
20 20
21 QuicServerInfo::State::State() {} 21 QuicServerInfo::State::State() {}
22 22
23 QuicServerInfo::State::~State() {} 23 QuicServerInfo::State::~State() {}
24 24
25 void QuicServerInfo::State::Clear() { 25 void QuicServerInfo::State::Clear() {
26 server_config.clear(); 26 server_config.clear();
27 source_address_token.clear(); 27 source_address_token.clear();
28 cert_sct.clear();
29 chlo_hash.clear();
28 server_config_sig.clear(); 30 server_config_sig.clear();
29 certs.clear(); 31 certs.clear();
30 } 32 }
31 33
32 QuicServerInfo::QuicServerInfo(const QuicServerId& server_id) 34 QuicServerInfo::QuicServerInfo(const QuicServerId& server_id)
33 : server_id_(server_id) {} 35 : server_id_(server_id) {}
34 36
35 QuicServerInfo::~QuicServerInfo() {} 37 QuicServerInfo::~QuicServerInfo() {}
36 38
37 const QuicServerInfo::State& QuicServerInfo::state() const { 39 const QuicServerInfo::State& QuicServerInfo::state() const {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 78 }
77 79
78 if (!iter.ReadString(&state->server_config)) { 80 if (!iter.ReadString(&state->server_config)) {
79 DVLOG(1) << "Malformed server_config"; 81 DVLOG(1) << "Malformed server_config";
80 return false; 82 return false;
81 } 83 }
82 if (!iter.ReadString(&state->source_address_token)) { 84 if (!iter.ReadString(&state->source_address_token)) {
83 DVLOG(1) << "Malformed source_address_token"; 85 DVLOG(1) << "Malformed source_address_token";
84 return false; 86 return false;
85 } 87 }
88 if (!iter.ReadString(&state->cert_sct)) {
ramant (doing other things) 2016/03/23 01:56:02 Hi Ryan, Should we load older versions and initi
Ryan Hamilton 2016/03/23 13:55:44 That sounds fine, since that's what we're doing to
ramant (doing other things) 2016/03/23 22:43:42 Done.
89 DVLOG(1) << "Malformed cert_sct";
90 return false;
91 }
92 if (!iter.ReadString(&state->chlo_hash)) {
93 DVLOG(1) << "Malformed chlo_hash";
94 return false;
95 }
86 if (!iter.ReadString(&state->server_config_sig)) { 96 if (!iter.ReadString(&state->server_config_sig)) {
87 DVLOG(1) << "Malformed server_config_sig"; 97 DVLOG(1) << "Malformed server_config_sig";
88 return false; 98 return false;
89 } 99 }
90 100
91 // Read certs. 101 // Read certs.
92 uint32_t num_certs; 102 uint32_t num_certs;
93 if (!iter.ReadUInt32(&num_certs)) { 103 if (!iter.ReadUInt32(&num_certs)) {
94 DVLOG(1) << "Malformed num_certs"; 104 DVLOG(1) << "Malformed num_certs";
95 return false; 105 return false;
(...skipping 16 matching lines...) Expand all
112 state_.Clear(); 122 state_.Clear();
113 return pickled_data; 123 return pickled_data;
114 } 124 }
115 125
116 string QuicServerInfo::SerializeInner() const { 126 string QuicServerInfo::SerializeInner() const {
117 base::Pickle p(sizeof(base::Pickle::Header)); 127 base::Pickle p(sizeof(base::Pickle::Header));
118 128
119 if (!p.WriteInt(kQuicCryptoConfigVersion) || 129 if (!p.WriteInt(kQuicCryptoConfigVersion) ||
120 !p.WriteString(state_.server_config) || 130 !p.WriteString(state_.server_config) ||
121 !p.WriteString(state_.source_address_token) || 131 !p.WriteString(state_.source_address_token) ||
132 !p.WriteString(state_.cert_sct) || !p.WriteString(state_.chlo_hash) ||
122 !p.WriteString(state_.server_config_sig) || 133 !p.WriteString(state_.server_config_sig) ||
123 state_.certs.size() > std::numeric_limits<uint32_t>::max() || 134 state_.certs.size() > std::numeric_limits<uint32_t>::max() ||
124 !p.WriteUInt32(state_.certs.size())) { 135 !p.WriteUInt32(state_.certs.size())) {
125 return string(); 136 return string();
126 } 137 }
127 138
128 for (size_t i = 0; i < state_.certs.size(); i++) { 139 for (size_t i = 0; i < state_.certs.size(); i++) {
129 if (!p.WriteString(state_.certs[i])) { 140 if (!p.WriteString(state_.certs[i])) {
130 return string(); 141 return string();
131 } 142 }
132 } 143 }
133 144
134 return string(reinterpret_cast<const char*>(p.data()), p.size()); 145 return string(reinterpret_cast<const char*>(p.data()), p.size());
135 } 146 }
136 147
137 QuicServerInfoFactory::~QuicServerInfoFactory() {} 148 QuicServerInfoFactory::~QuicServerInfoFactory() {}
138 149
139 } // namespace net 150 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/quic_server_info.h ('k') | net/quic/quic_chromium_client_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698