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, | 65 virtual NextProtoStatus GetNextProto(std::string* proto, |
63 std::string* server_protos) OVERRIDE; | 66 std::string* server_protos) OVERRIDE; |
64 virtual ServerBoundCertService* GetServerBoundCertService() const OVERRIDE; | 67 virtual ServerBoundCertService* GetServerBoundCertService() const OVERRIDE; |
65 | 68 |
66 // SSLSocket implementation. | 69 // SSLSocket implementation. |
67 virtual int ExportKeyingMaterial(const base::StringPiece& label, | 70 virtual int ExportKeyingMaterial(const base::StringPiece& label, |
68 bool has_context, | 71 bool has_context, |
69 const base::StringPiece& context, | 72 const base::StringPiece& context, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 private: | 104 private: |
102 class PeerCertificateChain; | 105 class PeerCertificateChain; |
103 class SSLContext; | 106 class SSLContext; |
104 friend class SSLClientSocket; | 107 friend class SSLClientSocket; |
105 friend class SSLContext; | 108 friend class SSLContext; |
106 | 109 |
107 int Init(); | 110 int Init(); |
108 void DoReadCallback(int result); | 111 void DoReadCallback(int result); |
109 void DoWriteCallback(int result); | 112 void DoWriteCallback(int result); |
110 | 113 |
| 114 // Compute a unique key string for the SSL session cache. |
| 115 std::string GetSessionCacheKey() const; |
| 116 void OnHandshakeCompletion(); |
| 117 |
111 bool DoTransportIO(); | 118 bool DoTransportIO(); |
112 int DoHandshake(); | 119 int DoHandshake(); |
113 int DoVerifyCert(int result); | 120 int DoVerifyCert(int result); |
114 int DoVerifyCertComplete(int result); | 121 int DoVerifyCertComplete(int result); |
115 void DoConnectCallback(int result); | 122 void DoConnectCallback(int result); |
116 X509Certificate* UpdateServerCert(); | 123 X509Certificate* UpdateServerCert(); |
117 | 124 |
118 void OnHandshakeIOComplete(int result); | 125 void OnHandshakeIOComplete(int result); |
119 void OnSendComplete(int result); | 126 void OnSendComplete(int result); |
120 void OnRecvComplete(int result); | 127 void OnRecvComplete(int result); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // List of SSLClientCertType values for client certificates allowed by the | 208 // List of SSLClientCertType values for client certificates allowed by the |
202 // server. | 209 // server. |
203 std::vector<SSLClientCertType> cert_key_types_; | 210 std::vector<SSLClientCertType> cert_key_types_; |
204 | 211 |
205 CertVerifier* const cert_verifier_; | 212 CertVerifier* const cert_verifier_; |
206 scoped_ptr<SingleRequestCertVerifier> verifier_; | 213 scoped_ptr<SingleRequestCertVerifier> verifier_; |
207 | 214 |
208 // The service for retrieving Channel ID keys. May be NULL. | 215 // The service for retrieving Channel ID keys. May be NULL. |
209 ServerBoundCertService* server_bound_cert_service_; | 216 ServerBoundCertService* server_bound_cert_service_; |
210 | 217 |
| 218 // Callback that is invoked when the connection finishes. |
| 219 // |
| 220 // Note: this callback will be run in Disconnect(). It will not alter |
| 221 // any member variables of the SSLClientSocketOpenSSL. |
| 222 base::Closure handshake_completion_callback_; |
| 223 |
211 // OpenSSL stuff | 224 // OpenSSL stuff |
212 SSL* ssl_; | 225 SSL* ssl_; |
213 BIO* transport_bio_; | 226 BIO* transport_bio_; |
214 | 227 |
215 scoped_ptr<ClientSocketHandle> transport_; | 228 scoped_ptr<ClientSocketHandle> transport_; |
216 const HostPortPair host_and_port_; | 229 const HostPortPair host_and_port_; |
217 SSLConfig ssl_config_; | 230 SSLConfig ssl_config_; |
218 // ssl_session_cache_shard_ is an opaque string that partitions the SSL | 231 // ssl_session_cache_shard_ is an opaque string that partitions the SSL |
219 // session cache. i.e. sessions created with one value will not attempt to | 232 // session cache. i.e. sessions created with one value will not attempt to |
220 // resume on the socket with a different value. | 233 // resume on the socket with a different value. |
(...skipping 20 matching lines...) Expand all Loading... |
241 // True if channel ID extension was negotiated. | 254 // True if channel ID extension was negotiated. |
242 bool channel_id_xtn_negotiated_; | 255 bool channel_id_xtn_negotiated_; |
243 // The request handle for |server_bound_cert_service_|. | 256 // The request handle for |server_bound_cert_service_|. |
244 ServerBoundCertService::RequestHandle channel_id_request_handle_; | 257 ServerBoundCertService::RequestHandle channel_id_request_handle_; |
245 BoundNetLog net_log_; | 258 BoundNetLog net_log_; |
246 }; | 259 }; |
247 | 260 |
248 } // namespace net | 261 } // namespace net |
249 | 262 |
250 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 263 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
OLD | NEW |