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

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

Issue 1178193002: Sign CertificateVerify messages on a background thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more mac build fix, this is blind while mac checkout syncs Created 5 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
« no previous file with comments | « net/net_common.gypi ('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 <openssl/base.h>
9 #include <openssl/ssl.h>
10
8 #include <string> 11 #include <string>
12 #include <vector>
9 13
10 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
13 #include "net/base/completion_callback.h" 17 #include "net/base/completion_callback.h"
14 #include "net/base/io_buffer.h" 18 #include "net/base/io_buffer.h"
15 #include "net/cert/cert_verifier.h" 19 #include "net/cert/cert_verifier.h"
16 #include "net/cert/cert_verify_result.h" 20 #include "net/cert/cert_verify_result.h"
17 #include "net/cert/ct_verify_result.h" 21 #include "net/cert/ct_verify_result.h"
18 #include "net/socket/client_socket_handle.h" 22 #include "net/socket/client_socket_handle.h"
19 #include "net/socket/ssl_client_socket.h" 23 #include "net/socket/ssl_client_socket.h"
20 #include "net/ssl/channel_id_service.h" 24 #include "net/ssl/channel_id_service.h"
21 #include "net/ssl/openssl_ssl_util.h" 25 #include "net/ssl/openssl_ssl_util.h"
22 #include "net/ssl/ssl_client_cert_type.h" 26 #include "net/ssl/ssl_client_cert_type.h"
23 #include "net/ssl/ssl_config_service.h" 27 #include "net/ssl/ssl_config_service.h"
24 #include "net/ssl/ssl_failure_state.h" 28 #include "net/ssl/ssl_failure_state.h"
25 29
26 // Avoid including misc OpenSSL headers, i.e.:
27 // <openssl/bio.h>
28 typedef struct bio_st BIO;
29 // <openssl/evp.h>
30 typedef struct evp_pkey_st EVP_PKEY;
31 // <openssl/ssl.h>
32 typedef struct ssl_session_st SSL_SESSION;
33 typedef struct ssl_st SSL;
34 // <openssl/x509.h>
35 typedef struct x509_st X509;
36 // <openssl/ossl_type.h>
37 typedef struct x509_store_ctx_st X509_STORE_CTX;
38
39 namespace net { 30 namespace net {
40 31
41 class CertVerifier; 32 class CertVerifier;
42 class CTVerifier; 33 class CTVerifier;
43 class SSLCertRequestInfo; 34 class SSLCertRequestInfo;
44 class SSLInfo; 35 class SSLInfo;
36 class SSLPrivateKey;
45 37
46 // An SSL client socket implemented with OpenSSL. 38 // An SSL client socket implemented with OpenSSL.
47 class SSLClientSocketOpenSSL : public SSLClientSocket { 39 class SSLClientSocketOpenSSL : public SSLClientSocket {
48 public: 40 public:
49 // Takes ownership of the transport_socket, which may already be connected. 41 // Takes ownership of the transport_socket, which may already be connected.
50 // The given hostname will be compared with the name(s) in the server's 42 // The given hostname will be compared with the name(s) in the server's
51 // certificate during the SSL handshake. ssl_config specifies the SSL 43 // certificate during the SSL handshake. ssl_config specifies the SSL
52 // settings. 44 // settings.
53 SSLClientSocketOpenSSL(scoped_ptr<ClientSocketHandle> transport_socket, 45 SSLClientSocketOpenSSL(scoped_ptr<ClientSocketHandle> transport_socket,
54 const HostPortPair& host_and_port, 46 const HostPortPair& host_and_port,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 void OnHandshakeIOComplete(int result); 118 void OnHandshakeIOComplete(int result);
127 void OnSendComplete(int result); 119 void OnSendComplete(int result);
128 void OnRecvComplete(int result); 120 void OnRecvComplete(int result);
129 121
130 int DoHandshakeLoop(int last_io_result); 122 int DoHandshakeLoop(int last_io_result);
131 int DoReadLoop(); 123 int DoReadLoop();
132 int DoWriteLoop(); 124 int DoWriteLoop();
133 int DoPayloadRead(); 125 int DoPayloadRead();
134 int DoPayloadWrite(); 126 int DoPayloadWrite();
135 127
128 // Called when an asynchronous event completes which may have blocked the
129 // pending Read or Write calls, if any. Retries both state machines and, if
130 // complete, runs the respective callbacks.
131 void PumpReadWriteEvents();
132
136 int BufferSend(); 133 int BufferSend();
137 int BufferRecv(); 134 int BufferRecv();
138 void BufferSendComplete(int result); 135 void BufferSendComplete(int result);
139 void BufferRecvComplete(int result); 136 void BufferRecvComplete(int result);
140 void TransportWriteComplete(int result); 137 void TransportWriteComplete(int result);
141 int TransportReadComplete(int result); 138 int TransportReadComplete(int result);
142 139
143 // Callback from the SSL layer that indicates the remote server is requesting 140 // Callback from the SSL layer that indicates the remote server is requesting
144 // a certificate for this client. 141 // a certificate for this client.
145 int ClientCertRequestCallback(SSL* ssl); 142 int ClientCertRequestCallback(SSL* ssl);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // the |ssl_info|.signed_certificate_timestamps list. 182 // the |ssl_info|.signed_certificate_timestamps list.
186 void AddSCTInfoToSSLInfo(SSLInfo* ssl_info) const; 183 void AddSCTInfoToSSLInfo(SSLInfo* ssl_info) const;
187 184
188 // Returns a unique key string for the SSL session cache for 185 // Returns a unique key string for the SSL session cache for
189 // this socket. 186 // this socket.
190 std::string GetSessionCacheKey() const; 187 std::string GetSessionCacheKey() const;
191 188
192 // Returns true if renegotiations are allowed. 189 // Returns true if renegotiations are allowed.
193 bool IsRenegotiationAllowed() const; 190 bool IsRenegotiationAllowed() const;
194 191
192 // Callbacks for operations with the private key.
193 int PrivateKeyTypeCallback();
194 int PrivateKeySupportsDigestCallback(const EVP_MD* md);
195 size_t PrivateKeyMaxSignatureLenCallback();
196 ssl_private_key_result_t PrivateKeySignCallback(uint8_t* out,
197 size_t* out_len,
198 size_t max_out,
199 const EVP_MD* md,
200 const uint8_t* in,
201 size_t in_len);
202 ssl_private_key_result_t PrivateKeySignCompleteCallback(uint8_t* out,
203 size_t* out_len,
204 size_t max_out);
205
206 void OnPrivateKeySignComplete(Error error,
207 const std::vector<uint8_t>& signature);
208
195 bool transport_send_busy_; 209 bool transport_send_busy_;
196 bool transport_recv_busy_; 210 bool transport_recv_busy_;
197 211
198 // Buffers which are shared by BoringSSL and SSLClientSocketOpenSSL. 212 // Buffers which are shared by BoringSSL and SSLClientSocketOpenSSL.
199 // GrowableIOBuffer is used to keep ownership and setting offset. 213 // GrowableIOBuffer is used to keep ownership and setting offset.
200 scoped_refptr<GrowableIOBuffer> send_buffer_; 214 scoped_refptr<GrowableIOBuffer> send_buffer_;
201 scoped_refptr<GrowableIOBuffer> recv_buffer_; 215 scoped_refptr<GrowableIOBuffer> recv_buffer_;
202 216
203 CompletionCallback user_connect_callback_; 217 CompletionCallback user_connect_callback_;
204 CompletionCallback user_read_callback_; 218 CompletionCallback user_read_callback_;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // True if the current session was newly-established, but the certificate had 309 // True if the current session was newly-established, but the certificate had
296 // not yet been verified externally, so it cannot be inserted into the cache 310 // not yet been verified externally, so it cannot be inserted into the cache
297 // until later. 311 // until later.
298 bool session_pending_; 312 bool session_pending_;
299 // True if the initial handshake's certificate has been verified. 313 // True if the initial handshake's certificate has been verified.
300 bool certificate_verified_; 314 bool certificate_verified_;
301 // The request handle for |channel_id_service_|. 315 // The request handle for |channel_id_service_|.
302 ChannelIDService::Request channel_id_request_; 316 ChannelIDService::Request channel_id_request_;
303 SSLFailureState ssl_failure_state_; 317 SSLFailureState ssl_failure_state_;
304 318
319 scoped_ptr<SSLPrivateKey> private_key_;
320 int signature_result_;
321 std::vector<uint8_t> signature_;
322
305 TransportSecurityState* transport_security_state_; 323 TransportSecurityState* transport_security_state_;
306 324
307 CertPolicyEnforcer* const policy_enforcer_; 325 CertPolicyEnforcer* const policy_enforcer_;
308 326
309 // pinning_failure_log contains a message produced by 327 // pinning_failure_log contains a message produced by
310 // TransportSecurityState::CheckPublicKeyPins in the event of a 328 // TransportSecurityState::CheckPublicKeyPins in the event of a
311 // pinning failure. It is a (somewhat) human-readable string. 329 // pinning failure. It is a (somewhat) human-readable string.
312 std::string pinning_failure_log_; 330 std::string pinning_failure_log_;
313 331
314 BoundNetLog net_log_; 332 BoundNetLog net_log_;
315 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_; 333 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_;
316 }; 334 };
317 335
318 } // namespace net 336 } // namespace net
319 337
320 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ 338 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_
OLDNEW
« no previous file with comments | « net/net_common.gypi ('k') | net/socket/ssl_client_socket_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698