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_NSS_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <certt.h> | 9 #include <certt.h> |
10 #include <keyt.h> | 10 #include <keyt.h> |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "net/base/host_port_pair.h" | 24 #include "net/base/host_port_pair.h" |
25 #include "net/base/net_export.h" | 25 #include "net/base/net_export.h" |
26 #include "net/base/net_log.h" | 26 #include "net/base/net_log.h" |
27 #include "net/base/nss_memio.h" | 27 #include "net/base/nss_memio.h" |
28 #include "net/base/server_bound_cert_service.h" | 28 #include "net/base/server_bound_cert_service.h" |
29 #include "net/base/ssl_config_service.h" | 29 #include "net/base/ssl_config_service.h" |
30 #include "net/base/x509_certificate.h" | 30 #include "net/base/x509_certificate.h" |
31 #include "net/socket/ssl_client_socket.h" | 31 #include "net/socket/ssl_client_socket.h" |
32 | 32 |
33 namespace base { | 33 namespace base { |
34 class SingleThreadTaskRunner; | 34 class SequencedTaskRunner; |
35 } | 35 } |
36 | 36 |
37 namespace net { | 37 namespace net { |
38 | 38 |
39 class BoundNetLog; | 39 class BoundNetLog; |
40 class CertVerifier; | 40 class CertVerifier; |
41 class ClientSocketHandle; | 41 class ClientSocketHandle; |
42 class ServerBoundCertService; | 42 class ServerBoundCertService; |
43 class SingleRequestCertVerifier; | 43 class SingleRequestCertVerifier; |
44 class TransportSecurityState; | 44 class TransportSecurityState; |
45 class X509Certificate; | 45 class X509Certificate; |
46 | 46 |
47 // An SSL client socket implemented with Mozilla NSS. | 47 // An SSL client socket implemented with Mozilla NSS. |
48 class SSLClientSocketNSS : public SSLClientSocket { | 48 class SSLClientSocketNSS : public SSLClientSocket { |
49 public: | 49 public: |
50 // Takes ownership of the |transport_socket|, which must already be connected. | 50 // Takes ownership of the |transport_socket|, which must already be connected. |
51 // The hostname specified in |host_and_port| will be compared with the name(s) | 51 // The hostname specified in |host_and_port| will be compared with the name(s) |
52 // in the server's certificate during the SSL handshake. If SSL client | 52 // in the server's certificate during the SSL handshake. If SSL client |
53 // authentication is requested, the host_and_port field of SSLCertRequestInfo | 53 // authentication is requested, the host_and_port field of SSLCertRequestInfo |
54 // will be populated with |host_and_port|. |ssl_config| specifies | 54 // will be populated with |host_and_port|. |ssl_config| specifies |
55 // the SSL settings. | 55 // the SSL settings. |
56 // | 56 // |
57 // Because calls to NSS may block, such as due to needing to access slow | 57 // Because calls to NSS may block, such as due to needing to access slow |
58 // hardware or needing to synchronously unlock protected tokens, calls to | 58 // hardware or needing to synchronously unlock protected tokens, calls to |
59 // NSS may optionally be run on a dedicated thread. If synchronous/blocking | 59 // NSS may optionally be run on a dedicated thread. If synchronous/blocking |
60 // behaviour is desired, for performance or compatibility, the current task | 60 // behaviour is desired, for performance or compatibility, the current task |
61 // runner should be supplied instead. | 61 // runner should be supplied instead. |
62 SSLClientSocketNSS(base::SingleThreadTaskRunner* nss_task_runner, | 62 SSLClientSocketNSS(base::SequencedTaskRunner* nss_task_runner, |
63 ClientSocketHandle* transport_socket, | 63 ClientSocketHandle* transport_socket, |
64 const HostPortPair& host_and_port, | 64 const HostPortPair& host_and_port, |
65 const SSLConfig& ssl_config, | 65 const SSLConfig& ssl_config, |
66 const SSLClientSocketContext& context); | 66 const SSLClientSocketContext& context); |
67 virtual ~SSLClientSocketNSS(); | 67 virtual ~SSLClientSocketNSS(); |
68 | 68 |
69 // SSLClientSocket implementation. | 69 // SSLClientSocket implementation. |
70 virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; | 70 virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; |
71 virtual void GetSSLCertRequestInfo( | 71 virtual void GetSSLCertRequestInfo( |
72 SSLCertRequestInfo* cert_request_info) OVERRIDE; | 72 SSLCertRequestInfo* cert_request_info) OVERRIDE; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 int DoVerifyCertComplete(int result); | 138 int DoVerifyCertComplete(int result); |
139 | 139 |
140 void LogConnectionTypeMetrics() const; | 140 void LogConnectionTypeMetrics() const; |
141 | 141 |
142 // The following methods are for debugging bug 65948. Will remove this code | 142 // The following methods are for debugging bug 65948. Will remove this code |
143 // after fixing bug 65948. | 143 // after fixing bug 65948. |
144 void EnsureThreadIdAssigned() const; | 144 void EnsureThreadIdAssigned() const; |
145 bool CalledOnValidThread() const; | 145 bool CalledOnValidThread() const; |
146 | 146 |
147 // The task runner used to perform NSS operations. | 147 // The task runner used to perform NSS operations. |
148 scoped_refptr<base::SingleThreadTaskRunner> nss_task_runner_; | 148 scoped_refptr<base::SequencedTaskRunner> nss_task_runner_; |
149 scoped_ptr<ClientSocketHandle> transport_; | 149 scoped_ptr<ClientSocketHandle> transport_; |
150 HostPortPair host_and_port_; | 150 HostPortPair host_and_port_; |
151 SSLConfig ssl_config_; | 151 SSLConfig ssl_config_; |
152 | 152 |
153 scoped_refptr<Core> core_; | 153 scoped_refptr<Core> core_; |
154 | 154 |
155 CompletionCallback user_connect_callback_; | 155 CompletionCallback user_connect_callback_; |
156 | 156 |
157 CertVerifyResult server_cert_verify_result_; | 157 CertVerifyResult server_cert_verify_result_; |
158 std::vector<SHA1Fingerprint> side_pinned_public_keys_; | 158 std::vector<SHA1Fingerprint> side_pinned_public_keys_; |
(...skipping 30 matching lines...) Expand all Loading... |
189 // Added the following code Debugging in release mode. | 189 // Added the following code Debugging in release mode. |
190 mutable base::Lock lock_; | 190 mutable base::Lock lock_; |
191 // This is mutable so that CalledOnValidThread can set it. | 191 // This is mutable so that CalledOnValidThread can set it. |
192 // It's guarded by |lock_|. | 192 // It's guarded by |lock_|. |
193 mutable base::PlatformThreadId valid_thread_id_; | 193 mutable base::PlatformThreadId valid_thread_id_; |
194 }; | 194 }; |
195 | 195 |
196 } // namespace net | 196 } // namespace net |
197 | 197 |
198 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ | 198 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
OLD | NEW |