| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_OPENSSL_H_ | 5 #ifndef NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_ |
| 6 #define NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_ | 6 #define NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| 11 #include "net/log/net_log.h" | 11 #include "net/log/net_log.h" |
| 12 #include "net/socket/ssl_server_socket.h" | 12 #include "net/socket/ssl_server_socket.h" |
| 13 #include "net/ssl/ssl_config_service.h" | 13 #include "net/ssl/ssl_server_config.h" |
| 14 | 14 |
| 15 // Avoid including misc OpenSSL headers, i.e.: | 15 // Avoid including misc OpenSSL headers, i.e.: |
| 16 // <openssl/bio.h> | 16 // <openssl/bio.h> |
| 17 typedef struct bio_st BIO; | 17 typedef struct bio_st BIO; |
| 18 // <openssl/ssl.h> | 18 // <openssl/ssl.h> |
| 19 typedef struct ssl_st SSL; | 19 typedef struct ssl_st SSL; |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 | 22 |
| 23 class SSLInfo; | 23 class SSLInfo; |
| 24 | 24 |
| 25 class SSLServerSocketOpenSSL : public SSLServerSocket { | 25 class SSLServerSocketOpenSSL : public SSLServerSocket { |
| 26 public: | 26 public: |
| 27 // See comments on CreateSSLServerSocket for details of how these | 27 // See comments on CreateSSLServerSocket for details of how these |
| 28 // parameters are used. | 28 // parameters are used. |
| 29 SSLServerSocketOpenSSL(scoped_ptr<StreamSocket> socket, | 29 SSLServerSocketOpenSSL(scoped_ptr<StreamSocket> socket, |
| 30 scoped_refptr<X509Certificate> certificate, | 30 scoped_refptr<X509Certificate> certificate, |
| 31 crypto::RSAPrivateKey* key, | 31 crypto::RSAPrivateKey* key, |
| 32 const SSLConfig& ssl_config); | 32 const SSLServerConfig& ssl_config); |
| 33 ~SSLServerSocketOpenSSL() override; | 33 ~SSLServerSocketOpenSSL() override; |
| 34 | 34 |
| 35 // SSLServerSocket interface. | 35 // SSLServerSocket interface. |
| 36 int Handshake(const CompletionCallback& callback) override; | 36 int Handshake(const CompletionCallback& callback) override; |
| 37 | 37 |
| 38 // SSLSocket interface. | 38 // SSLSocket interface. |
| 39 int ExportKeyingMaterial(const base::StringPiece& label, | 39 int ExportKeyingMaterial(const base::StringPiece& label, |
| 40 bool has_context, | 40 bool has_context, |
| 41 const base::StringPiece& context, | 41 const base::StringPiece& context, |
| 42 unsigned char* out, | 42 unsigned char* out, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 int transport_write_error_; | 129 int transport_write_error_; |
| 130 | 130 |
| 131 // OpenSSL stuff | 131 // OpenSSL stuff |
| 132 SSL* ssl_; | 132 SSL* ssl_; |
| 133 BIO* transport_bio_; | 133 BIO* transport_bio_; |
| 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(SSLServerSocketOpenSSL); | 150 DISALLOW_COPY_AND_ASSIGN(SSLServerSocketOpenSSL); |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 } // namespace net | 153 } // namespace net |
| 154 | 154 |
| 155 #endif // NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_ | 155 #endif // NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_ |
| OLD | NEW |