Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Side by Side Diff: net/socket/ssl_server_socket_openssl.h

Issue 1518613002: Support for server session cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@client_certs
Patch Set: Rebase only Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/scoped_openssl_types.h"
16 #include "net/ssl/ssl_server_config.h" 17 #include "net/ssl/ssl_server_config.h"
17 18
18 // Avoid including misc OpenSSL headers, i.e.: 19 // Avoid including misc OpenSSL headers, i.e.:
19 // <openssl/bio.h> 20 // <openssl/bio.h>
20 typedef struct bio_st BIO; 21 typedef struct bio_st BIO;
21 // <openssl/ssl.h> 22 // <openssl/ssl.h>
22 typedef struct ssl_st SSL; 23 typedef struct ssl_st SSL;
23 typedef struct x509_store_ctx_st X509_STORE_CTX; 24 typedef struct x509_store_ctx_st X509_STORE_CTX;
24 25
25 namespace net { 26 namespace net {
26 27
27 class SSLInfo; 28 class SSLInfo;
28 29
30 class SSLServerSocketContextOpenSSL : public SSLServerSocketContext {
31 public:
32 SSLServerSocketContextOpenSSL(scoped_refptr<X509Certificate> certificate,
33 const crypto::RSAPrivateKey& key,
34 const SSLServerConfig& ssl_server_config);
35
36 scoped_ptr<SSLServerSocket> CreateSSLServerSocket(
37 scoped_ptr<StreamSocket> socket) override;
38
39 private:
40 ~SSLServerSocketContextOpenSSL();
41
42 ScopedSSL_CTX ssl_ctx_;
43
44 // Options for the SSL socket.
45 SSLServerConfig ssl_server_config_;
46
47 // Certificate for the server.
48 scoped_refptr<X509Certificate> cert_;
49
50 // Private key used by the server.
51 scoped_ptr<crypto::RSAPrivateKey> key_;
52 };
53
29 class SSLServerSocketOpenSSL : public SSLServerSocket { 54 class SSLServerSocketOpenSSL : public SSLServerSocket {
davidben 2016/01/22 23:57:48 Ditto that this needn't be in the header file now.
ryanchung 2016/01/29 23:28:16 Done.
30 public: 55 public:
31 // See comments on CreateSSLServerSocket for details of how these
32 // parameters are used.
33 SSLServerSocketOpenSSL(scoped_ptr<StreamSocket> socket,
34 scoped_refptr<X509Certificate> certificate,
35 const crypto::RSAPrivateKey& key,
36 const SSLServerConfig& ssl_server_config);
37 ~SSLServerSocketOpenSSL() override; 56 ~SSLServerSocketOpenSSL() override;
38 57
39 // SSLServerSocket interface. 58 // SSLServerSocket interface.
40 int Handshake(const CompletionCallback& callback) override; 59 int Handshake(const CompletionCallback& callback) override;
41 60
42 // SSLSocket interface. 61 // SSLSocket interface.
43 int ExportKeyingMaterial(const base::StringPiece& label, 62 int ExportKeyingMaterial(const base::StringPiece& label,
44 bool has_context, 63 bool has_context,
45 const base::StringPiece& context, 64 const base::StringPiece& context,
46 unsigned char* out, 65 unsigned char* out,
(...skipping 29 matching lines...) Expand all
76 void ClearConnectionAttempts() override {} 95 void ClearConnectionAttempts() override {}
77 void AddConnectionAttempts(const ConnectionAttempts& attempts) override {} 96 void AddConnectionAttempts(const ConnectionAttempts& attempts) override {}
78 int64_t GetTotalReceivedBytes() const override; 97 int64_t GetTotalReceivedBytes() const override;
79 98
80 private: 99 private:
81 enum State { 100 enum State {
82 STATE_NONE, 101 STATE_NONE,
83 STATE_HANDSHAKE, 102 STATE_HANDSHAKE,
84 }; 103 };
85 104
105 // See comments on CreateSSLServerSocket for details of how these
106 // parameters are used.
107 SSLServerSocketOpenSSL(scoped_ptr<StreamSocket> socket,
108 scoped_refptr<X509Certificate> certificate,
109 const crypto::RSAPrivateKey& key,
110 const SSLServerConfig& ssl_server_config,
111 SSL* ssl);
112 friend class SSLServerSocketContextOpenSSL;
113
86 void OnSendComplete(int result); 114 void OnSendComplete(int result);
87 void OnRecvComplete(int result); 115 void OnRecvComplete(int result);
88 void OnHandshakeIOComplete(int result); 116 void OnHandshakeIOComplete(int result);
89 117
90 int BufferSend(); 118 int BufferSend();
91 void BufferSendComplete(int result); 119 void BufferSendComplete(int result);
92 void TransportWriteComplete(int result); 120 void TransportWriteComplete(int result);
93 int BufferRecv(); 121 int BufferRecv();
94 void BufferRecvComplete(int result); 122 void BufferRecvComplete(int result);
95 int TransportReadComplete(int result); 123 int TransportReadComplete(int result);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 184
157 State next_handshake_state_; 185 State next_handshake_state_;
158 bool completed_handshake_; 186 bool completed_handshake_;
159 187
160 DISALLOW_COPY_AND_ASSIGN(SSLServerSocketOpenSSL); 188 DISALLOW_COPY_AND_ASSIGN(SSLServerSocketOpenSSL);
161 }; 189 };
162 190
163 } // namespace net 191 } // namespace net
164 192
165 #endif // NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_ 193 #endif // NET_SOCKET_SSL_SERVER_SOCKET_OPENSSL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698