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. The order of handshake completion and |
| 171 // certificate verification depends on whether the connection was false |
| 172 // started. After both have happened (thus calling this twice), the session is |
| 173 // safe to cache and will be cached. |
| 174 void MaybeCacheSession(); |
| 175 |
| 176 // Callback from the SSL layer when the internal state machine progresses. It |
| 177 // is used to listen for when the handshake completes entirely; |Connect| may |
| 178 // return early if false starting. |
| 179 void InfoCallback(int type, int val); |
| 180 |
169 // Adds the SignedCertificateTimestamps from ct_verify_result_ to |ssl_info|. | 181 // Adds the SignedCertificateTimestamps from ct_verify_result_ to |ssl_info|. |
170 // SCTs are held in three separate vectors in ct_verify_result, each | 182 // SCTs are held in three separate vectors in ct_verify_result, each |
171 // vetor representing a particular verification state, this method associates | 183 // vetor representing a particular verification state, this method associates |
172 // each of the SCTs with the corresponding SCTVerifyStatus as it adds it to | 184 // each of the SCTs with the corresponding SCTVerifyStatus as it adds it to |
173 // the |ssl_info|.signed_certificate_timestamps list. | 185 // the |ssl_info|.signed_certificate_timestamps list. |
174 void AddSCTInfoToSSLInfo(SSLInfo* ssl_info) const; | 186 void AddSCTInfoToSSLInfo(SSLInfo* ssl_info) const; |
175 | 187 |
176 // Returns a unique key string for the SSL session cache for | 188 // Returns a unique key string for the SSL session cache for |
177 // this socket. | 189 // this socket. |
178 std::string GetSessionCacheKey() const; | 190 std::string GetSessionCacheKey() const; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 BIO* transport_bio_; | 269 BIO* transport_bio_; |
258 | 270 |
259 scoped_ptr<ClientSocketHandle> transport_; | 271 scoped_ptr<ClientSocketHandle> transport_; |
260 const HostPortPair host_and_port_; | 272 const HostPortPair host_and_port_; |
261 SSLConfig ssl_config_; | 273 SSLConfig ssl_config_; |
262 // ssl_session_cache_shard_ is an opaque string that partitions the SSL | 274 // 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 | 275 // session cache. i.e. sessions created with one value will not attempt to |
264 // resume on the socket with a different value. | 276 // resume on the socket with a different value. |
265 const std::string ssl_session_cache_shard_; | 277 const std::string ssl_session_cache_shard_; |
266 | 278 |
267 // Used for session cache diagnostics. | |
268 bool trying_cached_session_; | |
269 | |
270 enum State { | 279 enum State { |
271 STATE_NONE, | 280 STATE_NONE, |
272 STATE_HANDSHAKE, | 281 STATE_HANDSHAKE, |
273 STATE_CHANNEL_ID_LOOKUP, | 282 STATE_CHANNEL_ID_LOOKUP, |
274 STATE_CHANNEL_ID_LOOKUP_COMPLETE, | 283 STATE_CHANNEL_ID_LOOKUP_COMPLETE, |
275 STATE_VERIFY_CERT, | 284 STATE_VERIFY_CERT, |
276 STATE_VERIFY_CERT_COMPLETE, | 285 STATE_VERIFY_CERT_COMPLETE, |
277 }; | 286 }; |
278 State next_handshake_state_; | 287 State next_handshake_state_; |
279 NextProtoStatus npn_status_; | 288 NextProtoStatus npn_status_; |
280 std::string npn_proto_; | 289 std::string npn_proto_; |
281 // Written by the |channel_id_service_|. | 290 // Written by the |channel_id_service_|. |
282 std::string channel_id_private_key_; | 291 std::string channel_id_private_key_; |
283 std::string channel_id_cert_; | 292 std::string channel_id_cert_; |
284 // True if channel ID extension was negotiated. | 293 // True if channel ID extension was negotiated. |
285 bool channel_id_xtn_negotiated_; | 294 bool channel_id_xtn_negotiated_; |
| 295 // True if the initial handshake has completed. |
| 296 bool handshake_completed_; |
| 297 // True if the initial handshake's certificate has been verified. |
| 298 bool certificate_verified_; |
286 // The request handle for |channel_id_service_|. | 299 // The request handle for |channel_id_service_|. |
287 ChannelIDService::RequestHandle channel_id_request_handle_; | 300 ChannelIDService::RequestHandle channel_id_request_handle_; |
288 | 301 |
289 TransportSecurityState* transport_security_state_; | 302 TransportSecurityState* transport_security_state_; |
290 | 303 |
291 CertPolicyEnforcer* const policy_enforcer_; | 304 CertPolicyEnforcer* const policy_enforcer_; |
292 | 305 |
293 // pinning_failure_log contains a message produced by | 306 // pinning_failure_log contains a message produced by |
294 // TransportSecurityState::CheckPublicKeyPins in the event of a | 307 // TransportSecurityState::CheckPublicKeyPins in the event of a |
295 // pinning failure. It is a (somewhat) human-readable string. | 308 // pinning failure. It is a (somewhat) human-readable string. |
296 std::string pinning_failure_log_; | 309 std::string pinning_failure_log_; |
297 | 310 |
298 BoundNetLog net_log_; | 311 BoundNetLog net_log_; |
299 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_; | 312 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_; |
300 }; | 313 }; |
301 | 314 |
302 } // namespace net | 315 } // namespace net |
303 | 316 |
304 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 317 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
OLD | NEW |