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

Unified 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: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: net/socket/ssl_client_socket_openssl.h
diff --git a/net/socket/ssl_client_socket_openssl.h b/net/socket/ssl_client_socket_openssl.h
index fd7a68a3ea29f6e1484ea4168a2923fbd64d87a0..02600a9b2d748322e74704607b7c9bb523ba9337 100644
--- a/net/socket/ssl_client_socket_openssl.h
+++ b/net/socket/ssl_client_socket_openssl.h
@@ -5,7 +5,11 @@
#ifndef NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_
#define NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_
+#include <openssl/base.h>
+#include <openssl/ssl.h>
davidben 2015/06/12 21:39:01 base.h's main purpose in life is to forward-declar
+
#include <string>
+#include <vector>
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
@@ -23,24 +27,13 @@
#include "net/ssl/ssl_config_service.h"
#include "net/ssl/ssl_failure_state.h"
-// Avoid including misc OpenSSL headers, i.e.:
-// <openssl/bio.h>
-typedef struct bio_st BIO;
-// <openssl/evp.h>
-typedef struct evp_pkey_st EVP_PKEY;
-// <openssl/ssl.h>
-typedef struct ssl_st SSL;
-// <openssl/x509.h>
-typedef struct x509_st X509;
-// <openssl/ossl_type.h>
-typedef struct x509_store_ctx_st X509_STORE_CTX;
-
namespace net {
class CertVerifier;
class CTVerifier;
class SSLCertRequestInfo;
class SSLInfo;
+class SSLPrivateKey;
// An SSL client socket implemented with OpenSSL.
class SSLClientSocketOpenSSL : public SSLClientSocket {
@@ -137,6 +130,11 @@ class SSLClientSocketOpenSSL : public SSLClientSocket {
int DoPayloadRead();
int DoPayloadWrite();
+ // Runs both the Read and Write loops in response to an event that either or
+ // both may have been blocked on. This may occur during a renegotiation, at
+ // which point both state machines will block on the new handshake.
+ void RunReadWriteLoops();
+
int BufferSend();
int BufferRecv();
void BufferSendComplete(int result);
@@ -198,6 +196,26 @@ class SSLClientSocketOpenSSL : public SSLClientSocket {
// Returns true if renegotiations are allowed.
bool IsRenegotiationAllowed() const;
+ // Callbacks for operations with the private key.
+ static int PrivateKeyTypeCallback(SSL* ssl);
+ static int PrivateKeySupportsDigestCallback(SSL* ssl, const EVP_MD* md);
+ static size_t PrivateKeyMaxSignatureLenCallback(SSL* ssl);
+ static ssl_private_key_result_t PrivateKeySignCallback(SSL* ssl,
+ uint8_t* out,
+ size_t* out_len,
+ size_t max_out,
+ const EVP_MD* md,
+ const uint8_t* in,
+ size_t in_len);
+ static ssl_private_key_result_t PrivateKeySignCompleteCallback(
+ SSL* ssl,
+ uint8_t* out,
+ size_t* out_len,
+ size_t max_out);
Ryan Sleevi 2015/06/12 23:37:20 The growing number of these callbacks makes me won
davidben 2015/06/15 21:28:24 Arguably that's what SSLContext is. I opted not to
Ryan Sleevi 2015/06/15 22:25:22 https://www.chromium.org/developers/coding-style h
Ryan Sleevi 2015/06/15 22:35:27 Sorry, to be explicit: *This* reviewer highly valu
davidben 2015/06/15 22:37:44 The Chromium one you cited also says:
davidben 2015/06/15 22:53:36 Also note, by the way, that this is the entirety o
Ryan Sleevi 2015/06/15 23:02:06 Except we're not doing that here. And as the C++ D
+
+ void OnPrivateKeySignComplete(Error error,
+ const std::vector<uint8_t>& signature);
+
bool transport_send_busy_;
bool transport_recv_busy_;
@@ -306,6 +324,10 @@ class SSLClientSocketOpenSSL : public SSLClientSocket {
ChannelIDService::Request channel_id_request_;
SSLFailureState ssl_failure_state_;
+ scoped_ptr<SSLPrivateKey> private_key_;
+ int signature_result_;
+ std::vector<uint8_t> signature_;
+
TransportSecurityState* transport_security_state_;
CertPolicyEnforcer* const policy_enforcer_;

Powered by Google App Engine
This is Rietveld 408576698