Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 // SSLClientSocket implementation. | 99 // SSLClientSocket implementation. |
| 100 virtual scoped_refptr<X509Certificate> GetUnverifiedServerCertificateChain() | 100 virtual scoped_refptr<X509Certificate> GetUnverifiedServerCertificateChain() |
| 101 const OVERRIDE; | 101 const OVERRIDE; |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 class PeerCertificateChain; | 104 class PeerCertificateChain; |
| 105 class SSLContext; | 105 class SSLContext; |
| 106 friend class SSLClientSocket; | 106 friend class SSLClientSocket; |
| 107 friend class SSLContext; | 107 friend class SSLContext; |
| 108 | 108 |
| 109 // Callback that is run by OpenSSL to obtain information about the | |
| 110 // state of the SSL handshake. | |
| 111 static void InfoCallback(const SSL* ssl, int result, int unused); | |
| 112 | |
| 113 int Init(); | 109 int Init(); |
| 114 void DoReadCallback(int result); | 110 void DoReadCallback(int result); |
| 115 void DoWriteCallback(int result); | 111 void DoWriteCallback(int result); |
| 116 | 112 |
| 117 // Compute a unique key string for the SSL session cache. | 113 // Compute a unique key string for the SSL session cache. |
| 118 std::string GetSessionCacheKey() const; | 114 std::string GetSessionCacheKey() const; |
| 119 void OnHandshakeCompletion(); | 115 void OnHandshakeCompletion(); |
| 120 | 116 |
| 121 bool DoTransportIO(); | 117 bool DoTransportIO(); |
| 122 int DoHandshake(); | 118 int DoHandshake(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 const char *argp, int argi, long argl, | 161 const char *argp, int argi, long argl, |
| 166 long retvalue); | 162 long retvalue); |
| 167 | 163 |
| 168 // Callback from the SSL layer when an operation is performed on | 164 // Callback from the SSL layer when an operation is performed on |
| 169 // |transport_bio_|'s peer. | 165 // |transport_bio_|'s peer. |
| 170 static long BIOCallback(BIO *bio, | 166 static long BIOCallback(BIO *bio, |
| 171 int cmd, | 167 int cmd, |
| 172 const char *argp, int argi, long argl, | 168 const char *argp, int argi, long argl, |
| 173 long retvalue); | 169 long retvalue); |
| 174 | 170 |
| 171 // Callback that is used to obtain information about the state of the SSL | |
| 172 // handshake. | |
| 173 static void InfoCallback(const SSL* ssl, int type, int /*val*/); | |
|
wtc
2014/08/07 23:25:31
Nit: The Style Guide only recommends commenting ou
| |
| 174 | |
| 175 void CheckIfHandshakeFinished(); | 175 void CheckIfHandshakeFinished(); |
| 176 | 176 |
| 177 bool transport_send_busy_; | 177 bool transport_send_busy_; |
| 178 bool transport_recv_busy_; | 178 bool transport_recv_busy_; |
| 179 | 179 |
| 180 scoped_refptr<DrainableIOBuffer> send_buffer_; | 180 scoped_refptr<DrainableIOBuffer> send_buffer_; |
| 181 scoped_refptr<IOBuffer> recv_buffer_; | 181 scoped_refptr<IOBuffer> recv_buffer_; |
| 182 | 182 |
| 183 CompletionCallback user_connect_callback_; | 183 CompletionCallback user_connect_callback_; |
| 184 CompletionCallback user_read_callback_; | 184 CompletionCallback user_read_callback_; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 204 | 204 |
| 205 // Used by TransportReadComplete() to signify an error reading from the | 205 // Used by TransportReadComplete() to signify an error reading from the |
| 206 // transport socket. A value of OK indicates the socket is still | 206 // transport socket. A value of OK indicates the socket is still |
| 207 // readable. EOFs are mapped to ERR_CONNECTION_CLOSED. | 207 // readable. EOFs are mapped to ERR_CONNECTION_CLOSED. |
| 208 int transport_read_error_; | 208 int transport_read_error_; |
| 209 | 209 |
| 210 // Used by TransportWriteComplete() and TransportReadComplete() to signify an | 210 // Used by TransportWriteComplete() and TransportReadComplete() to signify an |
| 211 // error writing to the transport socket. A value of OK indicates no error. | 211 // error writing to the transport socket. A value of OK indicates no error. |
| 212 int transport_write_error_; | 212 int transport_write_error_; |
| 213 | 213 |
| 214 // Set when handshake finishes. | 214 // Set when Connect finishes. |
| 215 scoped_ptr<PeerCertificateChain> server_cert_chain_; | 215 scoped_ptr<PeerCertificateChain> server_cert_chain_; |
| 216 scoped_refptr<X509Certificate> server_cert_; | 216 scoped_refptr<X509Certificate> server_cert_; |
| 217 CertVerifyResult server_cert_verify_result_; | 217 CertVerifyResult server_cert_verify_result_; |
| 218 bool completed_handshake_; | 218 bool completed_connect_; |
| 219 | 219 |
| 220 // Set when Read() or Write() successfully reads or writes data to or from the | 220 // Set when Read() or Write() successfully reads or writes data to or from the |
| 221 // network. | 221 // network. |
| 222 bool was_ever_used_; | 222 bool was_ever_used_; |
| 223 | 223 |
| 224 // Stores client authentication information between ClientAuthHandler and | 224 // Stores client authentication information between ClientAuthHandler and |
| 225 // GetSSLCertRequestInfo calls. | 225 // GetSSLCertRequestInfo calls. |
| 226 bool client_auth_cert_needed_; | 226 bool client_auth_cert_needed_; |
| 227 // List of DER-encoded X.509 DistinguishedName of certificate authorities | 227 // List of DER-encoded X.509 DistinguishedName of certificate authorities |
| 228 // allowed by the server. | 228 // allowed by the server. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 }; | 268 }; |
| 269 State next_handshake_state_; | 269 State next_handshake_state_; |
| 270 NextProtoStatus npn_status_; | 270 NextProtoStatus npn_status_; |
| 271 std::string npn_proto_; | 271 std::string npn_proto_; |
| 272 // Written by the |channel_id_service_|. | 272 // Written by the |channel_id_service_|. |
| 273 std::string channel_id_private_key_; | 273 std::string channel_id_private_key_; |
| 274 std::string channel_id_cert_; | 274 std::string channel_id_cert_; |
| 275 // True if channel ID extension was negotiated. | 275 // True if channel ID extension was negotiated. |
| 276 bool channel_id_xtn_negotiated_; | 276 bool channel_id_xtn_negotiated_; |
| 277 // True if InfoCallback has been run with result = SSL_CB_HANDSHAKE_DONE. | 277 // True if InfoCallback has been run with result = SSL_CB_HANDSHAKE_DONE. |
| 278 bool ran_handshake_finished_callback_; | 278 bool handshake_succeeded_; |
| 279 // True if MarkSSLSessionAsGood has been called for this socket's | 279 // True if MarkSSLSessionAsGood has been called for this socket's |
| 280 // connection's SSL session. | 280 // SSL session. |
| 281 bool marked_session_as_good_; | 281 bool marked_session_as_good_; |
| 282 // The request handle for |channel_id_service_|. | 282 // The request handle for |channel_id_service_|. |
| 283 ChannelIDService::RequestHandle channel_id_request_handle_; | 283 ChannelIDService::RequestHandle channel_id_request_handle_; |
| 284 BoundNetLog net_log_; | 284 BoundNetLog net_log_; |
| 285 }; | 285 }; |
| 286 | 286 |
| 287 } // namespace net | 287 } // namespace net |
| 288 | 288 |
| 289 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 289 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
| OLD | NEW |