| Index: net/socket/ssl_client_socket_impl.h
|
| diff --git a/net/socket/ssl_client_socket_impl.h b/net/socket/ssl_client_socket_impl.h
|
| index ff235ed4bdfa0bd771c6cf326f1bdbabba5dfaab..010a6f008b7f1d97d86d4c1e6a8f3010d0e507d2 100644
|
| --- a/net/socket/ssl_client_socket_impl.h
|
| +++ b/net/socket/ssl_client_socket_impl.h
|
| @@ -26,6 +26,7 @@
|
| #include "net/cert/ct_verify_result.h"
|
| #include "net/log/net_log_with_source.h"
|
| #include "net/socket/client_socket_handle.h"
|
| +#include "net/socket/socket_bio_adapter.h"
|
| #include "net/socket/ssl_client_socket.h"
|
| #include "net/ssl/channel_id_service.h"
|
| #include "net/ssl/openssl_ssl_util.h"
|
| @@ -45,6 +46,7 @@ namespace net {
|
|
|
| class CertVerifier;
|
| class CTVerifier;
|
| +class SocketBIOAdapter;
|
| class SSLCertRequestInfo;
|
| class SSLInfo;
|
|
|
| @@ -52,7 +54,8 @@ using TokenBindingSignatureMap =
|
| base::MRUCache<std::pair<TokenBindingType, std::string>,
|
| std::vector<uint8_t>>;
|
|
|
| -class SSLClientSocketImpl : public SSLClientSocket {
|
| +class SSLClientSocketImpl : public SSLClientSocket,
|
| + public SocketBIOAdapter::Delegate {
|
| public:
|
| // Takes ownership of the transport_socket, which may already be connected.
|
| // The given hostname will be compared with the name(s) in the server's
|
| @@ -121,6 +124,10 @@ class SSLClientSocketImpl : public SSLClientSocket {
|
| int SetReceiveBufferSize(int32_t size) override;
|
| int SetSendBufferSize(int32_t size) override;
|
|
|
| + // SocketBIOAdapter implementation:
|
| + void OnReadReady() override;
|
| + void OnWriteReady() override;
|
| +
|
| private:
|
| class PeerCertificateChain;
|
| class SSLContext;
|
| @@ -131,7 +138,6 @@ class SSLClientSocketImpl : public SSLClientSocket {
|
| void DoReadCallback(int result);
|
| void DoWriteCallback(int result);
|
|
|
| - bool DoTransportIO();
|
| int DoHandshake();
|
| int DoHandshakeComplete(int result);
|
| int DoChannelIDLookup();
|
| @@ -142,26 +148,16 @@ class SSLClientSocketImpl : public SSLClientSocket {
|
| void UpdateServerCert();
|
|
|
| void OnHandshakeIOComplete(int result);
|
| - void OnSendComplete(int result);
|
| - void OnRecvComplete(int result);
|
|
|
| int DoHandshakeLoop(int last_io_result);
|
| - int DoReadLoop();
|
| - int DoWriteLoop();
|
| int DoPayloadRead();
|
| int DoPayloadWrite();
|
|
|
| // Called when an asynchronous event completes which may have blocked the
|
| - // pending Read or Write calls, if any. Retries both state machines and, if
|
| - // complete, runs the respective callbacks.
|
| - void PumpReadWriteEvents();
|
| -
|
| - int BufferSend();
|
| - int BufferRecv();
|
| - void BufferSendComplete(int result);
|
| - void BufferRecvComplete(int result);
|
| - void TransportWriteComplete(int result);
|
| - int TransportReadComplete(int result);
|
| + // pending Connect, Read or Write calls, if any. Retries all state machines
|
| + // and, if complete, runs the respective callbacks.
|
| + void RetryAllOperations();
|
| +
|
| int VerifyCT();
|
|
|
| // Callback from the SSL layer that indicates the remote server is requesting
|
| @@ -173,25 +169,6 @@ class SSLClientSocketImpl : public SSLClientSocket {
|
| // certificates don't change during renegotiation.
|
| int CertVerifyCallback(X509_STORE_CTX* store_ctx);
|
|
|
| - // Called during an operation on |transport_bio_|'s peer. Checks saved
|
| - // transport error state and, if appropriate, returns an error through
|
| - // OpenSSL's error system.
|
| - long MaybeReplayTransportError(BIO* bio,
|
| - int cmd,
|
| - const char* argp,
|
| - int argi,
|
| - long argl,
|
| - long retvalue);
|
| -
|
| - // Callback from the SSL layer when an operation is performed on
|
| - // |transport_bio_|'s peer.
|
| - static long BIOCallback(BIO* bio,
|
| - int cmd,
|
| - const char* argp,
|
| - int argi,
|
| - long argl,
|
| - long retvalue);
|
| -
|
| // Called after the initial handshake completes and after the server
|
| // certificate has been verified. The order of handshake completion and
|
| // certificate verification depends on whether the connection was false
|
| @@ -258,14 +235,6 @@ class SSLClientSocketImpl : public SSLClientSocket {
|
| const crypto::OpenSSLErrStackTracer& tracer,
|
| OpenSSLErrorInfo* info);
|
|
|
| - bool transport_send_busy_;
|
| - bool transport_recv_busy_;
|
| -
|
| - // Buffers which are shared by BoringSSL and SSLClientSocketImpl.
|
| - // GrowableIOBuffer is used to keep ownership and setting offset.
|
| - scoped_refptr<GrowableIOBuffer> send_buffer_;
|
| - scoped_refptr<GrowableIOBuffer> recv_buffer_;
|
| -
|
| CompletionCallback user_connect_callback_;
|
| CompletionCallback user_read_callback_;
|
| CompletionCallback user_write_callback_;
|
| @@ -293,15 +262,6 @@ class SSLClientSocketImpl : public SSLClientSocket {
|
| // If there is a pending read result, the OpenSSLErrorInfo associated with it.
|
| OpenSSLErrorInfo pending_read_error_info_;
|
|
|
| - // Used by TransportReadComplete() to signify an error reading from the
|
| - // transport socket. A value of OK indicates the socket is still
|
| - // readable. EOFs are mapped to ERR_CONNECTION_CLOSED.
|
| - int transport_read_error_;
|
| -
|
| - // Used by TransportWriteComplete() and TransportReadComplete() to signify an
|
| - // error writing to the transport socket. A value of OK indicates no error.
|
| - int transport_write_error_;
|
| -
|
| // Set when Connect finishes.
|
| std::unique_ptr<PeerCertificateChain> server_cert_chain_;
|
| scoped_refptr<X509Certificate> server_cert_;
|
| @@ -336,9 +296,9 @@ class SSLClientSocketImpl : public SSLClientSocket {
|
|
|
| // OpenSSL stuff
|
| bssl::UniquePtr<SSL> ssl_;
|
| - bssl::UniquePtr<BIO> transport_bio_;
|
|
|
| std::unique_ptr<ClientSocketHandle> transport_;
|
| + std::unique_ptr<SocketBIOAdapter> transport_adapter_;
|
| const HostPortPair host_and_port_;
|
| SSLConfig ssl_config_;
|
| // ssl_session_cache_shard_ is an opaque string that partitions the SSL
|
|
|