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 #include "net/socket/ssl_server_socket_nss.h" | 5 #include "net/socket/ssl_server_socket_nss.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
8 #include <winsock2.h> | 10 #include <winsock2.h> |
9 #endif | 11 #endif |
10 | 12 |
11 #if defined(USE_SYSTEM_SSL) | 13 #if defined(USE_SYSTEM_SSL) |
12 #include <dlfcn.h> | 14 #include <dlfcn.h> |
13 #endif | 15 #endif |
14 #if defined(OS_MACOSX) | 16 #if defined(OS_MACOSX) |
15 #include <Security/Security.h> | 17 #include <Security/Security.h> |
16 #endif | 18 #endif |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 83 |
82 scoped_ptr<SSLServerSocket> CreateSSLServerSocket( | 84 scoped_ptr<SSLServerSocket> CreateSSLServerSocket( |
83 scoped_ptr<StreamSocket> socket, | 85 scoped_ptr<StreamSocket> socket, |
84 X509Certificate* cert, | 86 X509Certificate* cert, |
85 const crypto::RSAPrivateKey& key, | 87 const crypto::RSAPrivateKey& key, |
86 const SSLServerConfig& ssl_config) { | 88 const SSLServerConfig& ssl_config) { |
87 DCHECK(g_nss_server_sockets_init) << "EnableSSLServerSockets() has not been" | 89 DCHECK(g_nss_server_sockets_init) << "EnableSSLServerSockets() has not been" |
88 << " called yet!"; | 90 << " called yet!"; |
89 | 91 |
90 return scoped_ptr<SSLServerSocket>( | 92 return scoped_ptr<SSLServerSocket>( |
91 new SSLServerSocketNSS(socket.Pass(), cert, key, ssl_config)); | 93 new SSLServerSocketNSS(std::move(socket), cert, key, ssl_config)); |
92 } | 94 } |
93 | 95 |
94 SSLServerSocketNSS::SSLServerSocketNSS( | 96 SSLServerSocketNSS::SSLServerSocketNSS( |
95 scoped_ptr<StreamSocket> transport_socket, | 97 scoped_ptr<StreamSocket> transport_socket, |
96 scoped_refptr<X509Certificate> cert, | 98 scoped_refptr<X509Certificate> cert, |
97 const crypto::RSAPrivateKey& key, | 99 const crypto::RSAPrivateKey& key, |
98 const SSLServerConfig& ssl_config) | 100 const SSLServerConfig& ssl_config) |
99 : transport_send_busy_(false), | 101 : transport_send_busy_(false), |
100 transport_recv_busy_(false), | 102 transport_recv_busy_(false), |
101 user_read_buf_len_(0), | 103 user_read_buf_len_(0), |
102 user_write_buf_len_(0), | 104 user_write_buf_len_(0), |
103 nss_fd_(NULL), | 105 nss_fd_(NULL), |
104 nss_bufs_(NULL), | 106 nss_bufs_(NULL), |
105 transport_socket_(transport_socket.Pass()), | 107 transport_socket_(std::move(transport_socket)), |
106 ssl_config_(ssl_config), | 108 ssl_config_(ssl_config), |
107 cert_(cert), | 109 cert_(cert), |
108 key_(key.Copy()), | 110 key_(key.Copy()), |
109 next_handshake_state_(STATE_NONE), | 111 next_handshake_state_(STATE_NONE), |
110 completed_handshake_(false) { | 112 completed_handshake_(false) { |
111 CHECK(key_); | 113 CHECK(key_); |
112 } | 114 } |
113 | 115 |
114 SSLServerSocketNSS::~SSLServerSocketNSS() { | 116 SSLServerSocketNSS::~SSLServerSocketNSS() { |
115 if (nss_fd_ != NULL) { | 117 if (nss_fd_ != NULL) { |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 // initializes the NSS base library. | 847 // initializes the NSS base library. |
846 EnsureNSSSSLInit(); | 848 EnsureNSSSSLInit(); |
847 if (!NSS_IsInitialized()) | 849 if (!NSS_IsInitialized()) |
848 return ERR_UNEXPECTED; | 850 return ERR_UNEXPECTED; |
849 | 851 |
850 EnableSSLServerSockets(); | 852 EnableSSLServerSockets(); |
851 return OK; | 853 return OK; |
852 } | 854 } |
853 | 855 |
854 } // namespace net | 856 } // namespace net |
OLD | NEW |