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