| 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_SERVER_SOCKET_NSS_H_ | 5 #ifndef NET_SOCKET_SSL_SERVER_SOCKET_NSS_H_ |
| 6 #define NET_SOCKET_SSL_SERVER_SOCKET_NSS_H_ | 6 #define NET_SOCKET_SSL_SERVER_SOCKET_NSS_H_ |
| 7 | 7 |
| 8 #include <certt.h> | 8 #include <certt.h> |
| 9 #include <keyt.h> | 9 #include <keyt.h> |
| 10 #include <nspr.h> | 10 #include <nspr.h> |
| 11 #include <nss.h> | 11 #include <nss.h> |
| 12 | 12 |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
| 15 #include "net/base/host_port_pair.h" | 15 #include "net/base/host_port_pair.h" |
| 16 #include "net/base/nss_memio.h" | 16 #include "net/base/nss_memio.h" |
| 17 #include "net/log/net_log.h" | 17 #include "net/log/net_log.h" |
| 18 #include "net/socket/ssl_server_socket.h" | 18 #include "net/socket/ssl_server_socket.h" |
| 19 #include "net/ssl/ssl_config_service.h" | 19 #include "net/ssl/ssl_server_config.h" |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 | 22 |
| 23 class SSLServerSocketNSS : public SSLServerSocket { | 23 class SSLServerSocketNSS : public SSLServerSocket { |
| 24 public: | 24 public: |
| 25 // See comments on CreateSSLServerSocket for details of how these | 25 // See comments on CreateSSLServerSocket for details of how these |
| 26 // parameters are used. | 26 // parameters are used. |
| 27 SSLServerSocketNSS(scoped_ptr<StreamSocket> socket, | 27 SSLServerSocketNSS(scoped_ptr<StreamSocket> socket, |
| 28 scoped_refptr<X509Certificate> certificate, | 28 scoped_refptr<X509Certificate> certificate, |
| 29 crypto::RSAPrivateKey* key, | 29 crypto::RSAPrivateKey* key, |
| 30 const SSLConfig& ssl_config); | 30 const SSLServerConfig& ssl_config); |
| 31 ~SSLServerSocketNSS() override; | 31 ~SSLServerSocketNSS() override; |
| 32 | 32 |
| 33 // SSLServerSocket interface. | 33 // SSLServerSocket interface. |
| 34 int Handshake(const CompletionCallback& callback) override; | 34 int Handshake(const CompletionCallback& callback) override; |
| 35 | 35 |
| 36 // SSLSocket interface. | 36 // SSLSocket interface. |
| 37 int ExportKeyingMaterial(const base::StringPiece& label, | 37 int ExportKeyingMaterial(const base::StringPiece& label, |
| 38 bool has_context, | 38 bool has_context, |
| 39 const base::StringPiece& context, | 39 const base::StringPiece& context, |
| 40 unsigned char* out, | 40 unsigned char* out, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // The NSS SSL state machine | 129 // The NSS SSL state machine |
| 130 PRFileDesc* nss_fd_; | 130 PRFileDesc* nss_fd_; |
| 131 | 131 |
| 132 // Buffers for the network end of the SSL state machine | 132 // Buffers for the network end of the SSL state machine |
| 133 memio_Private* nss_bufs_; | 133 memio_Private* nss_bufs_; |
| 134 | 134 |
| 135 // StreamSocket for sending and receiving data. | 135 // StreamSocket for sending and receiving data. |
| 136 scoped_ptr<StreamSocket> transport_socket_; | 136 scoped_ptr<StreamSocket> transport_socket_; |
| 137 | 137 |
| 138 // Options for the SSL socket. | 138 // Options for the SSL socket. |
| 139 SSLConfig ssl_config_; | 139 SSLServerConfig ssl_config_; |
| 140 | 140 |
| 141 // Certificate for the server. | 141 // Certificate for the server. |
| 142 scoped_refptr<X509Certificate> cert_; | 142 scoped_refptr<X509Certificate> cert_; |
| 143 | 143 |
| 144 // Private key used by the server. | 144 // Private key used by the server. |
| 145 scoped_ptr<crypto::RSAPrivateKey> key_; | 145 scoped_ptr<crypto::RSAPrivateKey> key_; |
| 146 | 146 |
| 147 State next_handshake_state_; | 147 State next_handshake_state_; |
| 148 bool completed_handshake_; | 148 bool completed_handshake_; |
| 149 | 149 |
| 150 DISALLOW_COPY_AND_ASSIGN(SSLServerSocketNSS); | 150 DISALLOW_COPY_AND_ASSIGN(SSLServerSocketNSS); |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 } // namespace net | 153 } // namespace net |
| 154 | 154 |
| 155 #endif // NET_SOCKET_SSL_SERVER_SOCKET_NSS_H_ | 155 #endif // NET_SOCKET_SSL_SERVER_SOCKET_NSS_H_ |
| OLD | NEW |