Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "crypto/ec_private_key.h" | 10 #include "crypto/ec_private_key.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 } else { | 120 } else { |
| 121 DCHECK_EQ(kExtensionALPN, negotiation_extension_); | 121 DCHECK_EQ(kExtensionALPN, negotiation_extension_); |
| 122 } | 122 } |
| 123 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolNegotiation", sample); | 123 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolNegotiation", sample); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // static | 126 // static |
| 127 void SSLClientSocket::RecordChannelIDSupport( | 127 void SSLClientSocket::RecordChannelIDSupport( |
| 128 ChannelIDService* channel_id_service, | 128 ChannelIDService* channel_id_service, |
| 129 bool negotiated_channel_id, | 129 bool negotiated_channel_id, |
| 130 bool channel_id_enabled, | 130 bool channel_id_enabled) { |
| 131 bool supports_ecc) { | |
| 132 // Since this enum is used for a histogram, do not change or re-use values. | 131 // Since this enum is used for a histogram, do not change or re-use values. |
| 133 enum { | 132 enum { |
| 134 DISABLED = 0, | 133 DISABLED = 0, |
| 135 CLIENT_ONLY = 1, | 134 CLIENT_ONLY = 1, |
| 136 CLIENT_AND_SERVER = 2, | 135 CLIENT_AND_SERVER = 2, |
| 137 CLIENT_NO_ECC = 3, | 136 // CLIENT_NO_ECC is unused now. |
|
Ryan Sleevi
2015/10/15 22:00:15
This doesn't match how CLIENT_BAD_SYSTEM_TIME was
| |
| 138 // CLIENT_BAD_SYSTEM_TIME is unused now. | 137 // CLIENT_BAD_SYSTEM_TIME is unused now. |
| 139 CLIENT_BAD_SYSTEM_TIME = 4, | 138 CLIENT_BAD_SYSTEM_TIME = 4, |
| 140 CLIENT_NO_CHANNEL_ID_SERVICE = 5, | 139 CLIENT_NO_CHANNEL_ID_SERVICE = 5, |
| 141 CHANNEL_ID_USAGE_MAX | 140 CHANNEL_ID_USAGE_MAX |
| 142 } supported = DISABLED; | 141 } supported = DISABLED; |
| 143 if (negotiated_channel_id) { | 142 if (negotiated_channel_id) { |
| 144 supported = CLIENT_AND_SERVER; | 143 supported = CLIENT_AND_SERVER; |
| 145 } else if (channel_id_enabled) { | 144 } else if (channel_id_enabled) { |
| 146 if (!channel_id_service) | 145 if (!channel_id_service) |
| 147 supported = CLIENT_NO_CHANNEL_ID_SERVICE; | 146 supported = CLIENT_NO_CHANNEL_ID_SERVICE; |
| 148 else if (!supports_ecc) | |
| 149 supported = CLIENT_NO_ECC; | |
| 150 else | 147 else |
| 151 supported = CLIENT_ONLY; | 148 supported = CLIENT_ONLY; |
| 152 } | 149 } |
| 153 UMA_HISTOGRAM_ENUMERATION("DomainBoundCerts.Support", supported, | 150 UMA_HISTOGRAM_ENUMERATION("DomainBoundCerts.Support", supported, |
| 154 CHANNEL_ID_USAGE_MAX); | 151 CHANNEL_ID_USAGE_MAX); |
| 155 } | 152 } |
| 156 | 153 |
| 157 // static | 154 // static |
| 158 bool SSLClientSocket::IsChannelIDEnabled( | 155 bool SSLClientSocket::IsChannelIDEnabled( |
| 159 const SSLConfig& ssl_config, | 156 const SSLConfig& ssl_config, |
| 160 ChannelIDService* channel_id_service) { | 157 ChannelIDService* channel_id_service) { |
| 161 if (!ssl_config.channel_id_enabled) | 158 if (!ssl_config.channel_id_enabled) |
| 162 return false; | 159 return false; |
| 163 if (!channel_id_service) { | 160 if (!channel_id_service) { |
| 164 DVLOG(1) << "NULL channel_id_service_, not enabling channel ID."; | 161 DVLOG(1) << "NULL channel_id_service_, not enabling channel ID."; |
| 165 return false; | 162 return false; |
| 166 } | 163 } |
| 167 if (!crypto::ECPrivateKey::IsSupported()) { | |
| 168 DVLOG(1) << "Elliptic Curve not supported, not enabling channel ID."; | |
| 169 return false; | |
| 170 } | |
| 171 return true; | 164 return true; |
| 172 } | 165 } |
| 173 | 166 |
| 174 // static | 167 // static |
| 175 bool SSLClientSocket::HasCipherAdequateForHTTP2( | 168 bool SSLClientSocket::HasCipherAdequateForHTTP2( |
| 176 const std::vector<uint16>& cipher_suites) { | 169 const std::vector<uint16>& cipher_suites) { |
| 177 for (uint16 cipher : cipher_suites) { | 170 for (uint16 cipher : cipher_suites) { |
| 178 if (IsSecureTLSCipherSuite(cipher)) | 171 if (IsSecureTLSCipherSuite(cipher)) |
| 179 return true; | 172 return true; |
| 180 } | 173 } |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 204 wire_protos.push_back(proto.size()); | 197 wire_protos.push_back(proto.size()); |
| 205 for (const char ch : proto) { | 198 for (const char ch : proto) { |
| 206 wire_protos.push_back(static_cast<uint8_t>(ch)); | 199 wire_protos.push_back(static_cast<uint8_t>(ch)); |
| 207 } | 200 } |
| 208 } | 201 } |
| 209 | 202 |
| 210 return wire_protos; | 203 return wire_protos; |
| 211 } | 204 } |
| 212 | 205 |
| 213 } // namespace net | 206 } // namespace net |
| OLD | NEW |