| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "net/base/completion_callback.h" | 11 #include "net/base/completion_callback.h" |
| 12 #include "net/base/io_buffer.h" | 12 #include "net/base/io_buffer.h" |
| 13 #include "net/log/net_log.h" | 13 #include "net/log/net_log.h" |
| 14 #include "net/socket/ssl_server_socket.h" | 14 #include "net/socket/ssl_server_socket.h" |
| 15 #include "net/ssl/ssl_config_service.h" | 15 #include "net/ssl/ssl_server_config.h" |
| 16 | 16 |
| 17 // Avoid including misc OpenSSL headers, i.e.: | 17 // Avoid including misc OpenSSL headers, i.e.: |
| 18 // <openssl/bio.h> | 18 // <openssl/bio.h> |
| 19 typedef struct bio_st BIO; | 19 typedef struct bio_st BIO; |
| 20 // <openssl/ssl.h> | 20 // <openssl/ssl.h> |
| 21 typedef struct ssl_st SSL; | 21 typedef struct ssl_st SSL; |
| 22 | 22 |
| 23 namespace net { | 23 namespace net { |
| 24 | 24 |
| 25 class SSLInfo; | 25 class SSLInfo; |
| 26 | 26 |
| 27 class SSLServerSocketOpenSSL : public SSLServerSocket { | 27 class SSLServerSocketOpenSSL : public SSLServerSocket { |
| 28 public: | 28 public: |
| 29 // See comments on CreateSSLServerSocket for details of how these | 29 // See comments on CreateSSLServerSocket for details of how these |
| 30 // parameters are used. | 30 // parameters are used. |
| 31 SSLServerSocketOpenSSL(scoped_ptr<StreamSocket> socket, | 31 SSLServerSocketOpenSSL(scoped_ptr<StreamSocket> socket, |
| 32 scoped_refptr<X509Certificate> certificate, | 32 scoped_refptr<X509Certificate> certificate, |
| 33 crypto::RSAPrivateKey* key, | 33 crypto::RSAPrivateKey* key, |
| 34 const SSLConfig& ssl_config); | 34 const SSLServerConfig& ssl_config); |
| 35 ~SSLServerSocketOpenSSL() override; | 35 ~SSLServerSocketOpenSSL() override; |
| 36 | 36 |
| 37 // SSLServerSocket interface. | 37 // SSLServerSocket interface. |
| 38 int Handshake(const CompletionCallback& callback) override; | 38 int Handshake(const CompletionCallback& callback) override; |
| 39 | 39 |
| 40 // SSLSocket interface. | 40 // SSLSocket interface. |
| 41 int ExportKeyingMaterial(const base::StringPiece& label, | 41 int ExportKeyingMaterial(const base::StringPiece& label, |
| 42 bool has_context, | 42 bool has_context, |
| 43 const base::StringPiece& context, | 43 const base::StringPiece& context, |
| 44 unsigned char* out, | 44 unsigned char* out, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 int transport_write_error_; | 132 int transport_write_error_; |
| 133 | 133 |
| 134 // OpenSSL stuff | 134 // OpenSSL stuff |
| 135 SSL* ssl_; | 135 SSL* ssl_; |
| 136 BIO* transport_bio_; | 136 BIO* transport_bio_; |
| 137 | 137 |
| 138 // StreamSocket for sending and receiving data. | 138 // StreamSocket for sending and receiving data. |
| 139 scoped_ptr<StreamSocket> transport_socket_; | 139 scoped_ptr<StreamSocket> transport_socket_; |
| 140 | 140 |
| 141 // Options for the SSL socket. | 141 // Options for the SSL socket. |
| 142 SSLConfig ssl_config_; | 142 SSLServerConfig ssl_config_; |
| 143 | 143 |
| 144 // Certificate for the server. | 144 // Certificate for the server. |
| 145 scoped_refptr<X509Certificate> cert_; | 145 scoped_refptr<X509Certificate> cert_; |
| 146 | 146 |
| 147 // Private key used by the server. | 147 // Private key used by the server. |
| 148 scoped_ptr<crypto::RSAPrivateKey> key_; | 148 scoped_ptr<crypto::RSAPrivateKey> key_; |
| 149 | 149 |
| 150 State next_handshake_state_; | 150 State next_handshake_state_; |
| 151 bool completed_handshake_; | 151 bool completed_handshake_; |
| 152 | 152 |
| 153 DISALLOW_COPY_AND_ASSIGN(SSLServerSocketOpenSSL); | 153 DISALLOW_COPY_AND_ASSIGN(SSLServerSocketOpenSSL); |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 } // namespace net | 156 } // namespace net |
| 157 | 157 |
| 158 #endif // NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_ | 158 #endif // NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_ |
| OLD | NEW |