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 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 bool supports_ecc); | 202 bool supports_ecc); |
203 | 203 |
204 // Records ConnectionType histograms for a successful SSL connection. | 204 // Records ConnectionType histograms for a successful SSL connection. |
205 static void RecordConnectionTypeMetrics(int ssl_version); | 205 static void RecordConnectionTypeMetrics(int ssl_version); |
206 | 206 |
207 // Returns whether TLS channel ID is enabled. | 207 // Returns whether TLS channel ID is enabled. |
208 static bool IsChannelIDEnabled( | 208 static bool IsChannelIDEnabled( |
209 const SSLConfig& ssl_config, | 209 const SSLConfig& ssl_config, |
210 ChannelIDService* channel_id_service); | 210 ChannelIDService* channel_id_service); |
211 | 211 |
| 212 // Determine if there is at least one enabled cipher suite that satisfies |
| 213 // Section 9.2 of the HTTP/2 specification. Note that the server might still |
| 214 // pick an inadequate cipher suite. |
| 215 static bool HasCipherAdequateForHTTP2( |
| 216 const std::vector<uint16>& cipher_suites); |
| 217 |
| 218 // Determine if the TLS version required by Section 9.2 of the HTTP/2 |
| 219 // specification is enabled. Note that the server might still pick an |
| 220 // inadequate TLS version. |
| 221 static bool IsTLSVersionAdequateForHTTP2(const SSLConfig& ssl_config); |
| 222 |
212 // Serializes |next_protos| in the wire format for ALPN: protocols are listed | 223 // Serializes |next_protos| in the wire format for ALPN: protocols are listed |
213 // in order, each prefixed by a one-byte length. | 224 // in order, each prefixed by a one-byte length. Any HTTP/2 protocols in |
| 225 // |next_protos| are ignored if |can_advertise_http2| is false. |
214 static std::vector<uint8_t> SerializeNextProtos( | 226 static std::vector<uint8_t> SerializeNextProtos( |
215 const std::vector<std::string>& next_protos); | 227 const NextProtoVector& next_protos, |
| 228 bool can_advertise_http2); |
216 | 229 |
217 // For unit testing only. | 230 // For unit testing only. |
218 // Returns the unverified certificate chain as presented by server. | 231 // Returns the unverified certificate chain as presented by server. |
219 // Note that chain may be different than the verified chain returned by | 232 // Note that chain may be different than the verified chain returned by |
220 // StreamSocket::GetSSLInfo(). | 233 // StreamSocket::GetSSLInfo(). |
221 virtual scoped_refptr<X509Certificate> GetUnverifiedServerCertificateChain() | 234 virtual scoped_refptr<X509Certificate> GetUnverifiedServerCertificateChain() |
222 const = 0; | 235 const = 0; |
223 | 236 |
224 private: | 237 private: |
| 238 FRIEND_TEST_ALL_PREFIXES(SSLClientSocket, SerializeNextProtos); |
225 // For signed_cert_timestamps_received_ and stapled_ocsp_response_received_. | 239 // For signed_cert_timestamps_received_ and stapled_ocsp_response_received_. |
226 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | 240 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, |
227 ConnectSignedCertTimestampsEnabledTLSExtension); | 241 ConnectSignedCertTimestampsEnabledTLSExtension); |
228 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | 242 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, |
229 ConnectSignedCertTimestampsEnabledOCSP); | 243 ConnectSignedCertTimestampsEnabledOCSP); |
230 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | 244 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, |
231 ConnectSignedCertTimestampsDisabled); | 245 ConnectSignedCertTimestampsDisabled); |
232 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, | 246 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, |
233 VerifyServerChainProperlyOrdered); | 247 VerifyServerChainProperlyOrdered); |
234 | 248 |
235 // True if NPN was responded to, independent of selecting SPDY or HTTP. | 249 // True if NPN was responded to, independent of selecting SPDY or HTTP. |
236 bool was_npn_negotiated_; | 250 bool was_npn_negotiated_; |
237 // True if NPN successfully negotiated SPDY. | 251 // True if NPN successfully negotiated SPDY. |
238 bool was_spdy_negotiated_; | 252 bool was_spdy_negotiated_; |
239 // Protocol that we negotiated with the server. | 253 // Protocol that we negotiated with the server. |
240 NextProto protocol_negotiated_; | 254 NextProto protocol_negotiated_; |
241 // True if a channel ID was sent. | 255 // True if a channel ID was sent. |
242 bool channel_id_sent_; | 256 bool channel_id_sent_; |
243 // True if SCTs were received via a TLS extension. | 257 // True if SCTs were received via a TLS extension. |
244 bool signed_cert_timestamps_received_; | 258 bool signed_cert_timestamps_received_; |
245 // True if a stapled OCSP response was received. | 259 // True if a stapled OCSP response was received. |
246 bool stapled_ocsp_response_received_; | 260 bool stapled_ocsp_response_received_; |
247 // Protocol negotiation extension used. | 261 // Protocol negotiation extension used. |
248 SSLNegotiationExtension negotiation_extension_; | 262 SSLNegotiationExtension negotiation_extension_; |
249 }; | 263 }; |
250 | 264 |
251 } // namespace net | 265 } // namespace net |
252 | 266 |
253 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 267 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
OLD | NEW |