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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <winsock2.h> | 8 #include <winsock2.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... | |
34 #include "crypto/rsa_private_key.h" | 34 #include "crypto/rsa_private_key.h" |
35 #include "crypto/nss_util_internal.h" | 35 #include "crypto/nss_util_internal.h" |
36 #include "net/base/io_buffer.h" | 36 #include "net/base/io_buffer.h" |
37 #include "net/base/net_errors.h" | 37 #include "net/base/net_errors.h" |
38 #include "net/base/net_log.h" | 38 #include "net/base/net_log.h" |
39 #include "net/ocsp/nss_ocsp.h" | 39 #include "net/ocsp/nss_ocsp.h" |
40 #include "net/socket/nss_ssl_util.h" | 40 #include "net/socket/nss_ssl_util.h" |
41 #include "net/socket/ssl_error_params.h" | 41 #include "net/socket/ssl_error_params.h" |
42 | 42 |
43 static const int kRecvBufferSize = 4096; | 43 static const int kRecvBufferSize = 4096; |
44 static const int kSendBufferSize = 4096; | |
Ryan Sleevi
2012/09/08 01:14:57
I suppose we'll want to tune these at some point.
| |
44 | 45 |
45 #define GotoState(s) next_handshake_state_ = s | 46 #define GotoState(s) next_handshake_state_ = s |
46 | 47 |
47 namespace net { | 48 namespace net { |
48 | 49 |
49 namespace { | 50 namespace { |
50 | 51 |
51 bool g_nss_server_sockets_init = false; | 52 bool g_nss_server_sockets_init = false; |
52 | 53 |
53 class NSSSSLServerInitSingleton { | 54 class NSSSSLServerInitSingleton { |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
306 return kProtoUnknown; | 307 return kProtoUnknown; |
307 } | 308 } |
308 | 309 |
309 bool SSLServerSocketNSS::GetSSLInfo(SSLInfo* ssl_info) { | 310 bool SSLServerSocketNSS::GetSSLInfo(SSLInfo* ssl_info) { |
310 NOTIMPLEMENTED(); | 311 NOTIMPLEMENTED(); |
311 return false; | 312 return false; |
312 } | 313 } |
313 | 314 |
314 int SSLServerSocketNSS::InitializeSSLOptions() { | 315 int SSLServerSocketNSS::InitializeSSLOptions() { |
315 // Transport connected, now hook it up to nss | 316 // Transport connected, now hook it up to nss |
316 // TODO(port): specify rx and tx buffer sizes separately | 317 nss_fd_ = memio_CreateIOLayer(kRecvBufferSize, kSendBufferSize); |
317 nss_fd_ = memio_CreateIOLayer(kRecvBufferSize); | |
318 if (nss_fd_ == NULL) { | 318 if (nss_fd_ == NULL) { |
319 return ERR_OUT_OF_MEMORY; // TODO(port): map NSPR error code. | 319 return ERR_OUT_OF_MEMORY; // TODO(port): map NSPR error code. |
320 } | 320 } |
321 | 321 |
322 // Grab pointer to buffers | 322 // Grab pointer to buffers |
323 nss_bufs_ = memio_GetSecret(nss_fd_); | 323 nss_bufs_ = memio_GetSecret(nss_fd_); |
324 | 324 |
325 /* Create SSL state machine */ | 325 /* Create SSL state machine */ |
326 /* Push SSL onto our fake I/O socket */ | 326 /* Push SSL onto our fake I/O socket */ |
327 nss_fd_ = SSL_ImportFD(NULL, nss_fd_); | 327 nss_fd_ = SSL_ImportFD(NULL, nss_fd_); |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
821 // initializes the NSS base library. | 821 // initializes the NSS base library. |
822 EnsureNSSSSLInit(); | 822 EnsureNSSSSLInit(); |
823 if (!NSS_IsInitialized()) | 823 if (!NSS_IsInitialized()) |
824 return ERR_UNEXPECTED; | 824 return ERR_UNEXPECTED; |
825 | 825 |
826 EnableSSLServerSockets(); | 826 EnableSSLServerSockets(); |
827 return OK; | 827 return OK; |
828 } | 828 } |
829 | 829 |
830 } // namespace net | 830 } // namespace net |
OLD | NEW |