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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 const SSLConfig& ssl_config, | 50 const SSLConfig& ssl_config, |
51 const SSLClientSocketContext& context); | 51 const SSLClientSocketContext& context); |
52 virtual ~SSLClientSocketOpenSSL(); | 52 virtual ~SSLClientSocketOpenSSL(); |
53 | 53 |
54 const HostPortPair& host_and_port() const { return host_and_port_; } | 54 const HostPortPair& host_and_port() const { return host_and_port_; } |
55 const std::string& ssl_session_cache_shard() const { | 55 const std::string& ssl_session_cache_shard() const { |
56 return ssl_session_cache_shard_; | 56 return ssl_session_cache_shard_; |
57 } | 57 } |
58 | 58 |
59 // SSLClientSocket implementation. | 59 // SSLClientSocket implementation. |
| 60 virtual bool InSessionCache() const OVERRIDE; |
| 61 virtual void SetHandshakeCompletionCallback( |
| 62 const base::Closure& callback) OVERRIDE; |
60 virtual void GetSSLCertRequestInfo( | 63 virtual void GetSSLCertRequestInfo( |
61 SSLCertRequestInfo* cert_request_info) OVERRIDE; | 64 SSLCertRequestInfo* cert_request_info) OVERRIDE; |
62 virtual NextProtoStatus GetNextProto(std::string* proto) OVERRIDE; | 65 virtual NextProtoStatus GetNextProto(std::string* proto) OVERRIDE; |
63 virtual ChannelIDService* GetChannelIDService() const OVERRIDE; | 66 virtual ChannelIDService* GetChannelIDService() const OVERRIDE; |
64 | 67 |
65 // SSLSocket implementation. | 68 // SSLSocket implementation. |
66 virtual int ExportKeyingMaterial(const base::StringPiece& label, | 69 virtual int ExportKeyingMaterial(const base::StringPiece& label, |
67 bool has_context, | 70 bool has_context, |
68 const base::StringPiece& context, | 71 const base::StringPiece& context, |
69 unsigned char* out, | 72 unsigned char* out, |
(...skipping 30 matching lines...) Expand all Loading... |
100 private: | 103 private: |
101 class PeerCertificateChain; | 104 class PeerCertificateChain; |
102 class SSLContext; | 105 class SSLContext; |
103 friend class SSLClientSocket; | 106 friend class SSLClientSocket; |
104 friend class SSLContext; | 107 friend class SSLContext; |
105 | 108 |
106 int Init(); | 109 int Init(); |
107 void DoReadCallback(int result); | 110 void DoReadCallback(int result); |
108 void DoWriteCallback(int result); | 111 void DoWriteCallback(int result); |
109 | 112 |
| 113 // Compute a unique key string for the SSL session cache. |
| 114 std::string GetSessionCacheKey() const; |
| 115 void OnHandshakeCompletion(); |
| 116 |
110 bool DoTransportIO(); | 117 bool DoTransportIO(); |
111 int DoHandshake(); | 118 int DoHandshake(); |
112 int DoChannelIDLookup(); | 119 int DoChannelIDLookup(); |
113 int DoChannelIDLookupComplete(int result); | 120 int DoChannelIDLookupComplete(int result); |
114 int DoVerifyCert(int result); | 121 int DoVerifyCert(int result); |
115 int DoVerifyCertComplete(int result); | 122 int DoVerifyCertComplete(int result); |
116 void DoConnectCallback(int result); | 123 void DoConnectCallback(int result); |
117 X509Certificate* UpdateServerCert(); | 124 X509Certificate* UpdateServerCert(); |
118 | 125 |
119 void OnHandshakeIOComplete(int result); | 126 void OnHandshakeIOComplete(int result); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // List of SSLClientCertType values for client certificates allowed by the | 224 // List of SSLClientCertType values for client certificates allowed by the |
218 // server. | 225 // server. |
219 std::vector<SSLClientCertType> cert_key_types_; | 226 std::vector<SSLClientCertType> cert_key_types_; |
220 | 227 |
221 CertVerifier* const cert_verifier_; | 228 CertVerifier* const cert_verifier_; |
222 scoped_ptr<SingleRequestCertVerifier> verifier_; | 229 scoped_ptr<SingleRequestCertVerifier> verifier_; |
223 | 230 |
224 // The service for retrieving Channel ID keys. May be NULL. | 231 // The service for retrieving Channel ID keys. May be NULL. |
225 ChannelIDService* channel_id_service_; | 232 ChannelIDService* channel_id_service_; |
226 | 233 |
| 234 // Callback that is invoked when the connection finishes. |
| 235 // |
| 236 // Note: this callback will be run in Disconnect(). It will not alter |
| 237 // any member variables of the SSLClientSocketOpenSSL. |
| 238 base::Closure handshake_completion_callback_; |
| 239 |
227 // OpenSSL stuff | 240 // OpenSSL stuff |
228 SSL* ssl_; | 241 SSL* ssl_; |
229 BIO* transport_bio_; | 242 BIO* transport_bio_; |
230 | 243 |
231 scoped_ptr<ClientSocketHandle> transport_; | 244 scoped_ptr<ClientSocketHandle> transport_; |
232 const HostPortPair host_and_port_; | 245 const HostPortPair host_and_port_; |
233 SSLConfig ssl_config_; | 246 SSLConfig ssl_config_; |
234 // ssl_session_cache_shard_ is an opaque string that partitions the SSL | 247 // ssl_session_cache_shard_ is an opaque string that partitions the SSL |
235 // session cache. i.e. sessions created with one value will not attempt to | 248 // session cache. i.e. sessions created with one value will not attempt to |
236 // resume on the socket with a different value. | 249 // resume on the socket with a different value. |
(...skipping 19 matching lines...) Expand all Loading... |
256 // True if channel ID extension was negotiated. | 269 // True if channel ID extension was negotiated. |
257 bool channel_id_xtn_negotiated_; | 270 bool channel_id_xtn_negotiated_; |
258 // The request handle for |channel_id_service_|. | 271 // The request handle for |channel_id_service_|. |
259 ChannelIDService::RequestHandle channel_id_request_handle_; | 272 ChannelIDService::RequestHandle channel_id_request_handle_; |
260 BoundNetLog net_log_; | 273 BoundNetLog net_log_; |
261 }; | 274 }; |
262 | 275 |
263 } // namespace net | 276 } // namespace net |
264 | 277 |
265 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 278 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
OLD | NEW |