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