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/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
13 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
14 #include "net/log/net_log.h" | 14 #include "net/log/net_log.h" |
15 #include "net/socket/ssl_server_socket.h" | 15 #include "net/socket/ssl_server_socket.h" |
16 #include "net/ssl/ssl_server_config.h" | 16 #include "net/ssl/ssl_server_config.h" |
17 | 17 |
18 // Avoid including misc OpenSSL headers, i.e.: | 18 // Avoid including misc OpenSSL headers, i.e.: |
19 // <openssl/bio.h> | 19 // <openssl/bio.h> |
20 typedef struct bio_st BIO; | 20 typedef struct bio_st BIO; |
21 // <openssl/ssl.h> | 21 // <openssl/ssl.h> |
22 typedef struct ssl_st SSL; | 22 typedef struct ssl_st SSL; |
23 typedef struct x509_store_ctx_st X509_STORE_CTX; | |
23 | 24 |
24 namespace net { | 25 namespace net { |
25 | 26 |
26 class SSLInfo; | 27 class SSLInfo; |
27 | 28 |
28 class SSLServerSocketOpenSSL : public SSLServerSocket { | 29 class SSLServerSocketOpenSSL : public SSLServerSocket { |
29 public: | 30 public: |
30 // See comments on CreateSSLServerSocket for details of how these | 31 // See comments on CreateSSLServerSocket for details of how these |
31 // parameters are used. | 32 // parameters are used. |
32 SSLServerSocketOpenSSL(scoped_ptr<StreamSocket> socket, | 33 SSLServerSocketOpenSSL(scoped_ptr<StreamSocket> socket, |
33 scoped_refptr<X509Certificate> certificate, | 34 scoped_refptr<X509Certificate> certificate, |
34 const crypto::RSAPrivateKey& key, | 35 const crypto::RSAPrivateKey& key, |
35 const SSLServerConfig& ssl_config); | 36 const SSLServerConfig& ssl_server_config); |
36 ~SSLServerSocketOpenSSL() override; | 37 ~SSLServerSocketOpenSSL() override; |
37 | 38 |
38 // SSLServerSocket interface. | 39 // SSLServerSocket interface. |
39 int Handshake(const CompletionCallback& callback) override; | 40 int Handshake(const CompletionCallback& callback) override; |
40 | 41 |
41 // SSLSocket interface. | 42 // SSLSocket interface. |
42 int ExportKeyingMaterial(const base::StringPiece& label, | 43 int ExportKeyingMaterial(const base::StringPiece& label, |
43 bool has_context, | 44 bool has_context, |
44 const base::StringPiece& context, | 45 const base::StringPiece& context, |
45 unsigned char* out, | 46 unsigned char* out, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 | 99 |
99 int DoHandshakeLoop(int last_io_result); | 100 int DoHandshakeLoop(int last_io_result); |
100 int DoReadLoop(int result); | 101 int DoReadLoop(int result); |
101 int DoWriteLoop(int result); | 102 int DoWriteLoop(int result); |
102 int DoHandshake(); | 103 int DoHandshake(); |
103 void DoHandshakeCallback(int result); | 104 void DoHandshakeCallback(int result); |
104 void DoReadCallback(int result); | 105 void DoReadCallback(int result); |
105 void DoWriteCallback(int result); | 106 void DoWriteCallback(int result); |
106 | 107 |
107 int Init(); | 108 int Init(); |
109 void ExtractClientCert(); | |
davidben
2016/01/25 20:56:10
This function does not seem to exist.
ryanchung
2016/01/29 23:22:13
Done. Removed.
| |
110 static int CertVerifyCallback(X509_STORE_CTX* store_ctx, void* arg); | |
108 | 111 |
109 // Members used to send and receive buffer. | 112 // Members used to send and receive buffer. |
110 bool transport_send_busy_; | 113 bool transport_send_busy_; |
111 bool transport_recv_busy_; | 114 bool transport_recv_busy_; |
112 bool transport_recv_eof_; | 115 bool transport_recv_eof_; |
113 | 116 |
114 scoped_refptr<DrainableIOBuffer> send_buffer_; | 117 scoped_refptr<DrainableIOBuffer> send_buffer_; |
115 scoped_refptr<IOBuffer> recv_buffer_; | 118 scoped_refptr<IOBuffer> recv_buffer_; |
116 | 119 |
117 BoundNetLog net_log_; | 120 BoundNetLog net_log_; |
(...skipping 15 matching lines...) Expand all Loading... | |
133 int transport_write_error_; | 136 int transport_write_error_; |
134 | 137 |
135 // OpenSSL stuff | 138 // OpenSSL stuff |
136 SSL* ssl_; | 139 SSL* ssl_; |
137 BIO* transport_bio_; | 140 BIO* transport_bio_; |
138 | 141 |
139 // StreamSocket for sending and receiving data. | 142 // StreamSocket for sending and receiving data. |
140 scoped_ptr<StreamSocket> transport_socket_; | 143 scoped_ptr<StreamSocket> transport_socket_; |
141 | 144 |
142 // Options for the SSL socket. | 145 // Options for the SSL socket. |
143 SSLServerConfig ssl_config_; | 146 SSLServerConfig ssl_server_config_; |
144 | 147 |
145 // Certificate for the server. | 148 // Certificate for the server. |
146 scoped_refptr<X509Certificate> cert_; | 149 scoped_refptr<X509Certificate> cert_; |
147 | 150 |
148 // Private key used by the server. | 151 // Private key used by the server. |
149 scoped_ptr<crypto::RSAPrivateKey> key_; | 152 scoped_ptr<crypto::RSAPrivateKey> key_; |
150 | 153 |
154 // Certificate for the client. | |
155 scoped_refptr<X509Certificate> client_cert_; | |
156 | |
151 State next_handshake_state_; | 157 State next_handshake_state_; |
152 bool completed_handshake_; | 158 bool completed_handshake_; |
153 | 159 |
154 DISALLOW_COPY_AND_ASSIGN(SSLServerSocketOpenSSL); | 160 DISALLOW_COPY_AND_ASSIGN(SSLServerSocketOpenSSL); |
155 }; | 161 }; |
156 | 162 |
157 } // namespace net | 163 } // namespace net |
158 | 164 |
159 #endif // NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_ | 165 #endif // NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_ |
OLD | NEW |