OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 // The given hostname will be compared with the name(s) in the server's | 36 // The given hostname will be compared with the name(s) in the server's |
37 // certificate during the SSL handshake. ssl_config specifies the SSL | 37 // certificate during the SSL handshake. ssl_config specifies the SSL |
38 // settings. | 38 // settings. |
39 SSLClientSocketOpenSSL(ClientSocketHandle* transport_socket, | 39 SSLClientSocketOpenSSL(ClientSocketHandle* transport_socket, |
40 const HostPortPair& host_and_port, | 40 const HostPortPair& host_and_port, |
41 const SSLConfig& ssl_config, | 41 const SSLConfig& ssl_config, |
42 const SSLClientSocketContext& context); | 42 const SSLClientSocketContext& context); |
43 ~SSLClientSocketOpenSSL(); | 43 ~SSLClientSocketOpenSSL(); |
44 | 44 |
45 const HostPortPair& host_and_port() const { return host_and_port_; } | 45 const HostPortPair& host_and_port() const { return host_and_port_; } |
| 46 const std::string& ssl_session_cache_shard() const { |
| 47 return ssl_session_cache_shard_; |
| 48 } |
46 | 49 |
47 // Callback from the SSL layer that indicates the remote server is requesting | 50 // Callback from the SSL layer that indicates the remote server is requesting |
48 // a certificate for this client. | 51 // a certificate for this client. |
49 int ClientCertRequestCallback(SSL* ssl, X509** x509, EVP_PKEY** pkey); | 52 int ClientCertRequestCallback(SSL* ssl, X509** x509, EVP_PKEY** pkey); |
50 | 53 |
51 // Callback from the SSL layer to check which NPN protocol we are supporting | 54 // Callback from the SSL layer to check which NPN protocol we are supporting |
52 int SelectNextProtoCallback(unsigned char** out, unsigned char* outlen, | 55 int SelectNextProtoCallback(unsigned char** out, unsigned char* outlen, |
53 const unsigned char* in, unsigned int inlen); | 56 const unsigned char* in, unsigned int inlen); |
54 | 57 |
55 // SSLClientSocket implementation. | 58 // SSLClientSocket implementation. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 CertVerifier* const cert_verifier_; | 147 CertVerifier* const cert_verifier_; |
145 scoped_ptr<SingleRequestCertVerifier> verifier_; | 148 scoped_ptr<SingleRequestCertVerifier> verifier_; |
146 | 149 |
147 // OpenSSL stuff | 150 // OpenSSL stuff |
148 SSL* ssl_; | 151 SSL* ssl_; |
149 BIO* transport_bio_; | 152 BIO* transport_bio_; |
150 | 153 |
151 scoped_ptr<ClientSocketHandle> transport_; | 154 scoped_ptr<ClientSocketHandle> transport_; |
152 const HostPortPair host_and_port_; | 155 const HostPortPair host_and_port_; |
153 SSLConfig ssl_config_; | 156 SSLConfig ssl_config_; |
| 157 // ssl_session_cache_shard_ is an opaque string that partitions the SSL |
| 158 // session cache. i.e. sessions created with one value will not attempt to |
| 159 // resume on the socket with a different value. |
| 160 const std::string ssl_session_cache_shard_; |
154 | 161 |
155 // Used for session cache diagnostics. | 162 // Used for session cache diagnostics. |
156 bool trying_cached_session_; | 163 bool trying_cached_session_; |
157 | 164 |
158 enum State { | 165 enum State { |
159 STATE_NONE, | 166 STATE_NONE, |
160 STATE_HANDSHAKE, | 167 STATE_HANDSHAKE, |
161 STATE_VERIFY_CERT, | 168 STATE_VERIFY_CERT, |
162 STATE_VERIFY_CERT_COMPLETE, | 169 STATE_VERIFY_CERT_COMPLETE, |
163 }; | 170 }; |
164 State next_handshake_state_; | 171 State next_handshake_state_; |
165 NextProtoStatus npn_status_; | 172 NextProtoStatus npn_status_; |
166 std::string npn_proto_; | 173 std::string npn_proto_; |
167 std::string server_protos_; | 174 std::string server_protos_; |
168 BoundNetLog net_log_; | 175 BoundNetLog net_log_; |
169 }; | 176 }; |
170 | 177 |
171 } // namespace net | 178 } // namespace net |
172 | 179 |
173 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 180 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
OLD | NEW |