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

Side by Side Diff: net/socket/ssl_client_socket.cc

Issue 356713005: Rename ServerBoundCert => ChannelID to reflect the current name (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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
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/socket/ssl_client_socket.h" 5 #include "net/socket/ssl_client_socket.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "crypto/ec_private_key.h" 9 #include "crypto/ec_private_key.h"
10 #include "net/ssl/server_bound_cert_service.h" 10 #include "net/ssl/channel_id_service.h"
11 #include "net/ssl/ssl_config_service.h" 11 #include "net/ssl/ssl_config_service.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 SSLClientSocket::SSLClientSocket() 15 SSLClientSocket::SSLClientSocket()
16 : was_npn_negotiated_(false), 16 : was_npn_negotiated_(false),
17 was_spdy_negotiated_(false), 17 was_spdy_negotiated_(false),
18 protocol_negotiated_(kProtoUnknown), 18 protocol_negotiated_(kProtoUnknown),
19 channel_id_sent_(false), 19 channel_id_sent_(false),
20 signed_cert_timestamps_received_(false), 20 signed_cert_timestamps_received_(false),
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 signed_cert_timestamps_received_ = signed_cert_timestamps_received; 151 signed_cert_timestamps_received_ = signed_cert_timestamps_received;
152 } 152 }
153 153
154 void SSLClientSocket::set_stapled_ocsp_response_received( 154 void SSLClientSocket::set_stapled_ocsp_response_received(
155 bool stapled_ocsp_response_received) { 155 bool stapled_ocsp_response_received) {
156 stapled_ocsp_response_received_ = stapled_ocsp_response_received; 156 stapled_ocsp_response_received_ = stapled_ocsp_response_received;
157 } 157 }
158 158
159 // static 159 // static
160 void SSLClientSocket::RecordChannelIDSupport( 160 void SSLClientSocket::RecordChannelIDSupport(
161 ServerBoundCertService* server_bound_cert_service, 161 ChannelIDService* channel_id_service,
162 bool negotiated_channel_id, 162 bool negotiated_channel_id,
163 bool channel_id_enabled, 163 bool channel_id_enabled,
164 bool supports_ecc) { 164 bool supports_ecc) {
165 // Since this enum is used for a histogram, do not change or re-use values. 165 // Since this enum is used for a histogram, do not change or re-use values.
166 enum { 166 enum {
167 DISABLED = 0, 167 DISABLED = 0,
168 CLIENT_ONLY = 1, 168 CLIENT_ONLY = 1,
169 CLIENT_AND_SERVER = 2, 169 CLIENT_AND_SERVER = 2,
170 CLIENT_NO_ECC = 3, 170 CLIENT_NO_ECC = 3,
171 CLIENT_BAD_SYSTEM_TIME = 4, 171 CLIENT_BAD_SYSTEM_TIME = 4,
172 CLIENT_NO_SERVER_BOUND_CERT_SERVICE = 5, 172 CLIENT_NO_CHANNEL_ID_SERVICE = 5,
173 DOMAIN_BOUND_CERT_USAGE_MAX 173 DOMAIN_BOUND_CERT_USAGE_MAX
wtc 2014/07/01 19:50:53 DOMAIN_BOUND_CERT_USAGE_MAX => CHANNEL_ID_USAGE_MA
Ryan Hamilton 2014/07/21 19:12:09 Done.
174 } supported = DISABLED; 174 } supported = DISABLED;
175 if (negotiated_channel_id) { 175 if (negotiated_channel_id) {
176 supported = CLIENT_AND_SERVER; 176 supported = CLIENT_AND_SERVER;
177 } else if (channel_id_enabled) { 177 } else if (channel_id_enabled) {
178 if (!server_bound_cert_service) 178 if (!channel_id_service)
179 supported = CLIENT_NO_SERVER_BOUND_CERT_SERVICE; 179 supported = CLIENT_NO_CHANNEL_ID_SERVICE;
180 else if (!supports_ecc) 180 else if (!supports_ecc)
181 supported = CLIENT_NO_ECC; 181 supported = CLIENT_NO_ECC;
182 else if (!server_bound_cert_service->IsSystemTimeValid()) 182 else if (!channel_id_service->IsSystemTimeValid())
183 supported = CLIENT_BAD_SYSTEM_TIME; 183 supported = CLIENT_BAD_SYSTEM_TIME;
184 else 184 else
185 supported = CLIENT_ONLY; 185 supported = CLIENT_ONLY;
186 } 186 }
187 UMA_HISTOGRAM_ENUMERATION("DomainBoundCerts.Support", supported, 187 UMA_HISTOGRAM_ENUMERATION("DomainBoundCerts.Support", supported,
188 DOMAIN_BOUND_CERT_USAGE_MAX); 188 DOMAIN_BOUND_CERT_USAGE_MAX);
189 } 189 }
190 190
191 // static 191 // static
192 bool SSLClientSocket::IsChannelIDEnabled( 192 bool SSLClientSocket::IsChannelIDEnabled(
193 const SSLConfig& ssl_config, 193 const SSLConfig& ssl_config,
194 ServerBoundCertService* server_bound_cert_service) { 194 ChannelIDService* channel_id_service) {
195 if (!ssl_config.channel_id_enabled) 195 if (!ssl_config.channel_id_enabled)
196 return false; 196 return false;
197 if (!server_bound_cert_service) { 197 if (!channel_id_service) {
198 DVLOG(1) << "NULL server_bound_cert_service_, not enabling channel ID."; 198 DVLOG(1) << "NULL channel_id_service_, not enabling channel ID.";
199 return false; 199 return false;
200 } 200 }
201 if (!crypto::ECPrivateKey::IsSupported()) { 201 if (!crypto::ECPrivateKey::IsSupported()) {
202 DVLOG(1) << "Elliptic Curve not supported, not enabling channel ID."; 202 DVLOG(1) << "Elliptic Curve not supported, not enabling channel ID.";
203 return false; 203 return false;
204 } 204 }
205 if (!server_bound_cert_service->IsSystemTimeValid()) { 205 if (!channel_id_service->IsSystemTimeValid()) {
206 DVLOG(1) << "System time is not within the supported range for certificate " 206 DVLOG(1) << "System time is not within the supported range for certificate "
207 "generation, not enabling channel ID."; 207 "generation, not enabling channel ID.";
208 return false; 208 return false;
209 } 209 }
210 return true; 210 return true;
211 } 211 }
212 212
213 } // namespace net 213 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698