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_OPENSSL_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 const char *argp, int argi, long argl, | 159 const char *argp, int argi, long argl, |
160 long retvalue); | 160 long retvalue); |
161 | 161 |
162 // Callback from the SSL layer when an operation is performed on | 162 // Callback from the SSL layer when an operation is performed on |
163 // |transport_bio_|'s peer. | 163 // |transport_bio_|'s peer. |
164 static long BIOCallback(BIO *bio, | 164 static long BIOCallback(BIO *bio, |
165 int cmd, | 165 int cmd, |
166 const char *argp, int argi, long argl, | 166 const char *argp, int argi, long argl, |
167 long retvalue); | 167 long retvalue); |
168 | 168 |
169 // Called after the initial handshake completes and after the server | |
170 // certificate has been verified. Depending on whether the handshake False | |
171 // Started, the events may happen in either order. When both have, the session | |
172 // is cached. | |
Ryan Sleevi
2015/03/24 23:47:22
It took me a while to parse this comment, as I tho
davidben
2015/03/26 20:22:57
Done.
| |
173 void MaybeCacheSession(); | |
174 | |
175 void InfoCallback(int type, int val); | |
Ryan Sleevi
2015/03/24 23:47:22
Document. How does this differ from say 164? May j
davidben
2015/03/26 20:22:57
They're basically totally unrelated. :-P
| |
176 | |
169 // Adds the SignedCertificateTimestamps from ct_verify_result_ to |ssl_info|. | 177 // Adds the SignedCertificateTimestamps from ct_verify_result_ to |ssl_info|. |
170 // SCTs are held in three separate vectors in ct_verify_result, each | 178 // SCTs are held in three separate vectors in ct_verify_result, each |
171 // vetor representing a particular verification state, this method associates | 179 // vetor representing a particular verification state, this method associates |
172 // each of the SCTs with the corresponding SCTVerifyStatus as it adds it to | 180 // each of the SCTs with the corresponding SCTVerifyStatus as it adds it to |
173 // the |ssl_info|.signed_certificate_timestamps list. | 181 // the |ssl_info|.signed_certificate_timestamps list. |
174 void AddSCTInfoToSSLInfo(SSLInfo* ssl_info) const; | 182 void AddSCTInfoToSSLInfo(SSLInfo* ssl_info) const; |
175 | 183 |
176 // Returns a unique key string for the SSL session cache for | 184 // Returns a unique key string for the SSL session cache for |
177 // this socket. | 185 // this socket. |
178 std::string GetSessionCacheKey() const; | 186 std::string GetSessionCacheKey() const; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 BIO* transport_bio_; | 265 BIO* transport_bio_; |
258 | 266 |
259 scoped_ptr<ClientSocketHandle> transport_; | 267 scoped_ptr<ClientSocketHandle> transport_; |
260 const HostPortPair host_and_port_; | 268 const HostPortPair host_and_port_; |
261 SSLConfig ssl_config_; | 269 SSLConfig ssl_config_; |
262 // ssl_session_cache_shard_ is an opaque string that partitions the SSL | 270 // ssl_session_cache_shard_ is an opaque string that partitions the SSL |
263 // session cache. i.e. sessions created with one value will not attempt to | 271 // session cache. i.e. sessions created with one value will not attempt to |
264 // resume on the socket with a different value. | 272 // resume on the socket with a different value. |
265 const std::string ssl_session_cache_shard_; | 273 const std::string ssl_session_cache_shard_; |
266 | 274 |
267 // Used for session cache diagnostics. | |
268 bool trying_cached_session_; | |
269 | |
270 enum State { | 275 enum State { |
271 STATE_NONE, | 276 STATE_NONE, |
272 STATE_HANDSHAKE, | 277 STATE_HANDSHAKE, |
273 STATE_CHANNEL_ID_LOOKUP, | 278 STATE_CHANNEL_ID_LOOKUP, |
274 STATE_CHANNEL_ID_LOOKUP_COMPLETE, | 279 STATE_CHANNEL_ID_LOOKUP_COMPLETE, |
275 STATE_VERIFY_CERT, | 280 STATE_VERIFY_CERT, |
276 STATE_VERIFY_CERT_COMPLETE, | 281 STATE_VERIFY_CERT_COMPLETE, |
277 }; | 282 }; |
278 State next_handshake_state_; | 283 State next_handshake_state_; |
279 NextProtoStatus npn_status_; | 284 NextProtoStatus npn_status_; |
280 std::string npn_proto_; | 285 std::string npn_proto_; |
281 // Written by the |channel_id_service_|. | 286 // Written by the |channel_id_service_|. |
282 std::string channel_id_private_key_; | 287 std::string channel_id_private_key_; |
283 std::string channel_id_cert_; | 288 std::string channel_id_cert_; |
284 // True if channel ID extension was negotiated. | 289 // True if channel ID extension was negotiated. |
285 bool channel_id_xtn_negotiated_; | 290 bool channel_id_xtn_negotiated_; |
291 // True if the initial handshake has completed. | |
292 bool handshake_completed_; | |
293 // True if the initial handshake's certificate has been verified. | |
294 bool certificate_verified_; | |
286 // The request handle for |channel_id_service_|. | 295 // The request handle for |channel_id_service_|. |
287 ChannelIDService::RequestHandle channel_id_request_handle_; | 296 ChannelIDService::RequestHandle channel_id_request_handle_; |
288 | 297 |
289 TransportSecurityState* transport_security_state_; | 298 TransportSecurityState* transport_security_state_; |
290 | 299 |
291 CertPolicyEnforcer* const policy_enforcer_; | 300 CertPolicyEnforcer* const policy_enforcer_; |
292 | 301 |
293 // pinning_failure_log contains a message produced by | 302 // pinning_failure_log contains a message produced by |
294 // TransportSecurityState::CheckPublicKeyPins in the event of a | 303 // TransportSecurityState::CheckPublicKeyPins in the event of a |
295 // pinning failure. It is a (somewhat) human-readable string. | 304 // pinning failure. It is a (somewhat) human-readable string. |
296 std::string pinning_failure_log_; | 305 std::string pinning_failure_log_; |
297 | 306 |
298 BoundNetLog net_log_; | 307 BoundNetLog net_log_; |
299 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_; | 308 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_; |
300 }; | 309 }; |
301 | 310 |
302 } // namespace net | 311 } // namespace net |
303 | 312 |
304 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 313 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
OLD | NEW |