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 | |
wtc
2014/08/07 20:04:04
obtain => "report" or "provide"
Alternatively, sa
| |
110 // state of the SSL handshake. | |
111 static void InfoCallback(const SSL* ssl, int result, int unused); | |
wtc
2014/08/07 20:04:04
The second parameter should be named "type". The t
| |
112 | |
109 int Init(); | 113 int Init(); |
110 void DoReadCallback(int result); | 114 void DoReadCallback(int result); |
111 void DoWriteCallback(int result); | 115 void DoWriteCallback(int result); |
112 | 116 |
113 // Compute a unique key string for the SSL session cache. | 117 // Compute a unique key string for the SSL session cache. |
114 std::string GetSessionCacheKey() const; | 118 std::string GetSessionCacheKey() const; |
115 void OnHandshakeCompletion(); | 119 void OnHandshakeCompletion(); |
116 | 120 |
117 bool DoTransportIO(); | 121 bool DoTransportIO(); |
118 int DoHandshake(); | 122 int DoHandshake(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 // Called during an operation on |transport_bio_|'s peer. Checks saved | 160 // Called during an operation on |transport_bio_|'s peer. Checks saved |
157 // transport error state and, if appropriate, returns an error through | 161 // transport error state and, if appropriate, returns an error through |
158 // OpenSSL's error system. | 162 // OpenSSL's error system. |
159 long MaybeReplayTransportError(BIO *bio, | 163 long MaybeReplayTransportError(BIO *bio, |
160 int cmd, | 164 int cmd, |
161 const char *argp, int argi, long argl, | 165 const char *argp, int argi, long argl, |
162 long retvalue); | 166 long retvalue); |
163 | 167 |
164 // Callback from the SSL layer when an operation is performed on | 168 // Callback from the SSL layer when an operation is performed on |
165 // |transport_bio_|'s peer. | 169 // |transport_bio_|'s peer. |
166 static long BIOCallback(BIO *bio, | 170 static long BIOCallback(BIO *bio, |
wtc
2014/08/07 20:04:04
Nit: I suggest moving the InfoCallback function he
| |
167 int cmd, | 171 int cmd, |
168 const char *argp, int argi, long argl, | 172 const char *argp, int argi, long argl, |
169 long retvalue); | 173 long retvalue); |
170 | 174 |
175 void CheckIfHandshakeFinished(); | |
176 | |
171 bool transport_send_busy_; | 177 bool transport_send_busy_; |
172 bool transport_recv_busy_; | 178 bool transport_recv_busy_; |
173 | 179 |
174 scoped_refptr<DrainableIOBuffer> send_buffer_; | 180 scoped_refptr<DrainableIOBuffer> send_buffer_; |
175 scoped_refptr<IOBuffer> recv_buffer_; | 181 scoped_refptr<IOBuffer> recv_buffer_; |
176 | 182 |
177 CompletionCallback user_connect_callback_; | 183 CompletionCallback user_connect_callback_; |
178 CompletionCallback user_read_callback_; | 184 CompletionCallback user_read_callback_; |
179 CompletionCallback user_write_callback_; | 185 CompletionCallback user_write_callback_; |
180 | 186 |
(...skipping 21 matching lines...) Expand all Loading... | |
202 int transport_read_error_; | 208 int transport_read_error_; |
203 | 209 |
204 // Used by TransportWriteComplete() and TransportReadComplete() to signify an | 210 // Used by TransportWriteComplete() and TransportReadComplete() to signify an |
205 // 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. |
206 int transport_write_error_; | 212 int transport_write_error_; |
207 | 213 |
208 // Set when handshake finishes. | 214 // Set when handshake finishes. |
209 scoped_ptr<PeerCertificateChain> server_cert_chain_; | 215 scoped_ptr<PeerCertificateChain> server_cert_chain_; |
210 scoped_refptr<X509Certificate> server_cert_; | 216 scoped_refptr<X509Certificate> server_cert_; |
211 CertVerifyResult server_cert_verify_result_; | 217 CertVerifyResult server_cert_verify_result_; |
212 bool completed_handshake_; | 218 bool completed_handshake_; |
wtc
2014/08/07 20:04:04
Hmmm... I wonder if the comment on line 214 and th
| |
213 | 219 |
214 // 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 |
215 // network. | 221 // network. |
216 bool was_ever_used_; | 222 bool was_ever_used_; |
217 | 223 |
218 // Stores client authentication information between ClientAuthHandler and | 224 // Stores client authentication information between ClientAuthHandler and |
219 // GetSSLCertRequestInfo calls. | 225 // GetSSLCertRequestInfo calls. |
220 bool client_auth_cert_needed_; | 226 bool client_auth_cert_needed_; |
221 // List of DER-encoded X.509 DistinguishedName of certificate authorities | 227 // List of DER-encoded X.509 DistinguishedName of certificate authorities |
222 // allowed by the server. | 228 // allowed by the server. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 STATE_VERIFY_CERT_COMPLETE, | 267 STATE_VERIFY_CERT_COMPLETE, |
262 }; | 268 }; |
263 State next_handshake_state_; | 269 State next_handshake_state_; |
264 NextProtoStatus npn_status_; | 270 NextProtoStatus npn_status_; |
265 std::string npn_proto_; | 271 std::string npn_proto_; |
266 // Written by the |channel_id_service_|. | 272 // Written by the |channel_id_service_|. |
267 std::string channel_id_private_key_; | 273 std::string channel_id_private_key_; |
268 std::string channel_id_cert_; | 274 std::string channel_id_cert_; |
269 // True if channel ID extension was negotiated. | 275 // True if channel ID extension was negotiated. |
270 bool channel_id_xtn_negotiated_; | 276 bool channel_id_xtn_negotiated_; |
277 // True if InfoCallback has been run with result = SSL_CB_HANDSHAKE_DONE. | |
278 bool ran_handshake_finished_callback_; | |
wtc
2014/08/07 20:04:04
Nit: this data member name is a little confusing b
| |
279 // True if MarkSSLSessionAsGood has been called for this socket's | |
280 // connection's SSL session. | |
wtc
2014/08/07 20:04:04
Nit: shorten "this socket's connection's SSL sessi
| |
281 bool marked_session_as_good_; | |
271 // The request handle for |channel_id_service_|. | 282 // The request handle for |channel_id_service_|. |
272 ChannelIDService::RequestHandle channel_id_request_handle_; | 283 ChannelIDService::RequestHandle channel_id_request_handle_; |
273 BoundNetLog net_log_; | 284 BoundNetLog net_log_; |
274 }; | 285 }; |
275 | 286 |
276 } // namespace net | 287 } // namespace net |
277 | 288 |
278 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 289 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
OLD | NEW |