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

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

Issue 981723008: Unwind the SSL connection holdback experiment and remove related code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 5 years, 9 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
« no previous file with comments | « net/socket/ssl_client_socket_nss.cc ('k') | net/socket/ssl_client_socket_openssl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 const SSLConfig& ssl_config, 53 const SSLConfig& ssl_config,
54 const SSLClientSocketContext& context); 54 const SSLClientSocketContext& context);
55 ~SSLClientSocketOpenSSL() override; 55 ~SSLClientSocketOpenSSL() override;
56 56
57 const HostPortPair& host_and_port() const { return host_and_port_; } 57 const HostPortPair& host_and_port() const { return host_and_port_; }
58 const std::string& ssl_session_cache_shard() const { 58 const std::string& ssl_session_cache_shard() const {
59 return ssl_session_cache_shard_; 59 return ssl_session_cache_shard_;
60 } 60 }
61 61
62 // SSLClientSocket implementation. 62 // SSLClientSocket implementation.
63 std::string GetSessionCacheKey() const override;
64 bool InSessionCache() const override;
65 void SetHandshakeCompletionCallback(const base::Closure& callback) override;
66 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; 63 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override;
67 NextProtoStatus GetNextProto(std::string* proto) override; 64 NextProtoStatus GetNextProto(std::string* proto) override;
68 ChannelIDService* GetChannelIDService() const override; 65 ChannelIDService* GetChannelIDService() const override;
69 66
70 // SSLSocket implementation. 67 // SSLSocket implementation.
71 int ExportKeyingMaterial(const base::StringPiece& label, 68 int ExportKeyingMaterial(const base::StringPiece& label,
72 bool has_context, 69 bool has_context,
73 const base::StringPiece& context, 70 const base::StringPiece& context,
74 unsigned char* out, 71 unsigned char* out,
75 unsigned int outlen) override; 72 unsigned int outlen) override;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 private: 104 private:
108 class PeerCertificateChain; 105 class PeerCertificateChain;
109 class SSLContext; 106 class SSLContext;
110 friend class SSLClientSocket; 107 friend class SSLClientSocket;
111 friend class SSLContext; 108 friend class SSLContext;
112 109
113 int Init(); 110 int Init();
114 void DoReadCallback(int result); 111 void DoReadCallback(int result);
115 void DoWriteCallback(int result); 112 void DoWriteCallback(int result);
116 113
117 void OnHandshakeCompletion();
118
119 bool DoTransportIO(); 114 bool DoTransportIO();
120 int DoHandshake(); 115 int DoHandshake();
121 int DoChannelIDLookup(); 116 int DoChannelIDLookup();
122 int DoChannelIDLookupComplete(int result); 117 int DoChannelIDLookupComplete(int result);
123 int DoVerifyCert(int result); 118 int DoVerifyCert(int result);
124 int DoVerifyCertComplete(int result); 119 int DoVerifyCertComplete(int result);
125 void DoConnectCallback(int result); 120 void DoConnectCallback(int result);
126 void UpdateServerCert(); 121 void UpdateServerCert();
127 void VerifyCT(); 122 void VerifyCT();
128 123
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 const char *argp, int argi, long argl, 159 const char *argp, int argi, long argl,
165 long retvalue); 160 long retvalue);
166 161
167 // Callback from the SSL layer when an operation is performed on 162 // Callback from the SSL layer when an operation is performed on
168 // |transport_bio_|'s peer. 163 // |transport_bio_|'s peer.
169 static long BIOCallback(BIO *bio, 164 static long BIOCallback(BIO *bio,
170 int cmd, 165 int cmd,
171 const char *argp, int argi, long argl, 166 const char *argp, int argi, long argl,
172 long retvalue); 167 long retvalue);
173 168
174 // Callback that is used to obtain information about the state of the SSL
175 // handshake.
176 static void InfoCallback(const SSL* ssl, int type, int val);
177
178 void CheckIfHandshakeFinished();
179
180 // Adds the SignedCertificateTimestamps from ct_verify_result_ to |ssl_info|. 169 // Adds the SignedCertificateTimestamps from ct_verify_result_ to |ssl_info|.
181 // SCTs are held in three separate vectors in ct_verify_result, each 170 // SCTs are held in three separate vectors in ct_verify_result, each
182 // vetor representing a particular verification state, this method associates 171 // vetor representing a particular verification state, this method associates
183 // each of the SCTs with the corresponding SCTVerifyStatus as it adds it to 172 // each of the SCTs with the corresponding SCTVerifyStatus as it adds it to
184 // the |ssl_info|.signed_certificate_timestamps list. 173 // the |ssl_info|.signed_certificate_timestamps list.
185 void AddSCTInfoToSSLInfo(SSLInfo* ssl_info) const; 174 void AddSCTInfoToSSLInfo(SSLInfo* ssl_info) const;
186 175
176 // Returns a unique key string for the SSL session cache for
177 // this socket.
178 std::string GetSessionCacheKey() const;
179
187 bool transport_send_busy_; 180 bool transport_send_busy_;
188 bool transport_recv_busy_; 181 bool transport_recv_busy_;
189 182
190 // Buffers which are shared by BoringSSL and SSLClientSocketOpenSSL. 183 // Buffers which are shared by BoringSSL and SSLClientSocketOpenSSL.
191 // GrowableIOBuffer is used to keep ownership and setting offset. 184 // GrowableIOBuffer is used to keep ownership and setting offset.
192 scoped_refptr<GrowableIOBuffer> send_buffer_; 185 scoped_refptr<GrowableIOBuffer> send_buffer_;
193 scoped_refptr<GrowableIOBuffer> recv_buffer_; 186 scoped_refptr<GrowableIOBuffer> recv_buffer_;
194 187
195 CompletionCallback user_connect_callback_; 188 CompletionCallback user_connect_callback_;
196 CompletionCallback user_read_callback_; 189 CompletionCallback user_read_callback_;
(...skipping 24 matching lines...) Expand all
221 214
222 // Used by TransportReadComplete() to signify an error reading from the 215 // Used by TransportReadComplete() to signify an error reading from the
223 // transport socket. A value of OK indicates the socket is still 216 // transport socket. A value of OK indicates the socket is still
224 // readable. EOFs are mapped to ERR_CONNECTION_CLOSED. 217 // readable. EOFs are mapped to ERR_CONNECTION_CLOSED.
225 int transport_read_error_; 218 int transport_read_error_;
226 219
227 // Used by TransportWriteComplete() and TransportReadComplete() to signify an 220 // Used by TransportWriteComplete() and TransportReadComplete() to signify an
228 // error writing to the transport socket. A value of OK indicates no error. 221 // error writing to the transport socket. A value of OK indicates no error.
229 int transport_write_error_; 222 int transport_write_error_;
230 223
231 // Set when Connect finishes. 224 // Set when handshake finishes.
davidben 2015/03/11 01:05:13 Did you prefer to keep the name change reverted? (
232 scoped_ptr<PeerCertificateChain> server_cert_chain_; 225 scoped_ptr<PeerCertificateChain> server_cert_chain_;
233 scoped_refptr<X509Certificate> server_cert_; 226 scoped_refptr<X509Certificate> server_cert_;
234 CertVerifyResult server_cert_verify_result_; 227 CertVerifyResult server_cert_verify_result_;
235 bool completed_connect_; 228 bool completed_handshake_;
236 229
237 // Set when Read() or Write() successfully reads or writes data to or from the 230 // Set when Read() or Write() successfully reads or writes data to or from the
238 // network. 231 // network.
239 bool was_ever_used_; 232 bool was_ever_used_;
240 233
241 // Stores client authentication information between ClientAuthHandler and 234 // Stores client authentication information between ClientAuthHandler and
242 // GetSSLCertRequestInfo calls. 235 // GetSSLCertRequestInfo calls.
243 bool client_auth_cert_needed_; 236 bool client_auth_cert_needed_;
244 // List of DER-encoded X.509 DistinguishedName of certificate authorities 237 // List of DER-encoded X.509 DistinguishedName of certificate authorities
245 // allowed by the server. 238 // allowed by the server.
246 std::vector<std::string> cert_authorities_; 239 std::vector<std::string> cert_authorities_;
247 // List of SSLClientCertType values for client certificates allowed by the 240 // List of SSLClientCertType values for client certificates allowed by the
248 // server. 241 // server.
249 std::vector<SSLClientCertType> cert_key_types_; 242 std::vector<SSLClientCertType> cert_key_types_;
250 243
251 CertVerifier* const cert_verifier_; 244 CertVerifier* const cert_verifier_;
252 scoped_ptr<SingleRequestCertVerifier> verifier_; 245 scoped_ptr<SingleRequestCertVerifier> verifier_;
253 base::TimeTicks start_cert_verification_time_; 246 base::TimeTicks start_cert_verification_time_;
254 247
255 // Certificate Transparency: Verifier and result holder. 248 // Certificate Transparency: Verifier and result holder.
256 ct::CTVerifyResult ct_verify_result_; 249 ct::CTVerifyResult ct_verify_result_;
257 CTVerifier* cert_transparency_verifier_; 250 CTVerifier* cert_transparency_verifier_;
258 251
259 // The service for retrieving Channel ID keys. May be NULL. 252 // The service for retrieving Channel ID keys. May be NULL.
260 ChannelIDService* channel_id_service_; 253 ChannelIDService* channel_id_service_;
261 254
262 // Callback that is invoked when the connection finishes.
263 //
264 // Note: this callback will be run in Disconnect(). It will not alter
265 // any member variables of the SSLClientSocketOpenSSL.
266 base::Closure handshake_completion_callback_;
267
268 // OpenSSL stuff 255 // OpenSSL stuff
269 SSL* ssl_; 256 SSL* ssl_;
270 BIO* transport_bio_; 257 BIO* transport_bio_;
271 258
272 scoped_ptr<ClientSocketHandle> transport_; 259 scoped_ptr<ClientSocketHandle> transport_;
273 const HostPortPair host_and_port_; 260 const HostPortPair host_and_port_;
274 SSLConfig ssl_config_; 261 SSLConfig ssl_config_;
275 // ssl_session_cache_shard_ is an opaque string that partitions the SSL 262 // ssl_session_cache_shard_ is an opaque string that partitions the SSL
276 // session cache. i.e. sessions created with one value will not attempt to 263 // session cache. i.e. sessions created with one value will not attempt to
277 // resume on the socket with a different value. 264 // resume on the socket with a different value.
(...skipping 11 matching lines...) Expand all
289 STATE_VERIFY_CERT_COMPLETE, 276 STATE_VERIFY_CERT_COMPLETE,
290 }; 277 };
291 State next_handshake_state_; 278 State next_handshake_state_;
292 NextProtoStatus npn_status_; 279 NextProtoStatus npn_status_;
293 std::string npn_proto_; 280 std::string npn_proto_;
294 // Written by the |channel_id_service_|. 281 // Written by the |channel_id_service_|.
295 std::string channel_id_private_key_; 282 std::string channel_id_private_key_;
296 std::string channel_id_cert_; 283 std::string channel_id_cert_;
297 // True if channel ID extension was negotiated. 284 // True if channel ID extension was negotiated.
298 bool channel_id_xtn_negotiated_; 285 bool channel_id_xtn_negotiated_;
299 // True if InfoCallback has been run with result = SSL_CB_HANDSHAKE_DONE.
300 bool handshake_succeeded_;
301 // True if MarkSSLSessionAsGood has been called for this socket's
302 // SSL session.
303 bool marked_session_as_good_;
304 // The request handle for |channel_id_service_|. 286 // The request handle for |channel_id_service_|.
305 ChannelIDService::RequestHandle channel_id_request_handle_; 287 ChannelIDService::RequestHandle channel_id_request_handle_;
306 288
307 TransportSecurityState* transport_security_state_; 289 TransportSecurityState* transport_security_state_;
308 290
309 CertPolicyEnforcer* const policy_enforcer_; 291 CertPolicyEnforcer* const policy_enforcer_;
310 292
311 // pinning_failure_log contains a message produced by 293 // pinning_failure_log contains a message produced by
312 // TransportSecurityState::CheckPublicKeyPins in the event of a 294 // TransportSecurityState::CheckPublicKeyPins in the event of a
313 // pinning failure. It is a (somewhat) human-readable string. 295 // pinning failure. It is a (somewhat) human-readable string.
314 std::string pinning_failure_log_; 296 std::string pinning_failure_log_;
315 297
316 BoundNetLog net_log_; 298 BoundNetLog net_log_;
317 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_; 299 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_;
318 }; 300 };
319 301
320 } // namespace net 302 } // namespace net
321 303
322 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ 304 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_nss.cc ('k') | net/socket/ssl_client_socket_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698