Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: net/socket/ssl_client_socket_openssl.h

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

Powered by Google App Engine
This is Rietveld 408576698