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

Side by Side Diff: net/socket/ssl_server_socket_nss.cc

Issue 10919167: Increase the sizes of the circular buffers used by SSLClientSocketNSS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Use 17KB receive and read buffers Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/ssl_client_socket_nss.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 22 matching lines...) Expand all
33 #include "base/memory/ref_counted.h" 33 #include "base/memory/ref_counted.h"
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 // SSL plaintext fragments are shorter than 16KB. Although the record layer
44 // overhead is allowed to be 2K + 5 bytes, in practice the overhead is much
45 // smaller than 1KB. So a 17KB buffer should be large enough to hold an
46 // entire SSL record.
47 static const int kRecvBufferSize = 17 * 1024;
48 static const int kSendBufferSize = 17 * 1024;
44 49
45 #define GotoState(s) next_handshake_state_ = s 50 #define GotoState(s) next_handshake_state_ = s
46 51
47 namespace net { 52 namespace net {
48 53
49 namespace { 54 namespace {
50 55
51 bool g_nss_server_sockets_init = false; 56 bool g_nss_server_sockets_init = false;
52 57
53 class NSSSSLServerInitSingleton { 58 class NSSSSLServerInitSingleton {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 return kProtoUnknown; 311 return kProtoUnknown;
307 } 312 }
308 313
309 bool SSLServerSocketNSS::GetSSLInfo(SSLInfo* ssl_info) { 314 bool SSLServerSocketNSS::GetSSLInfo(SSLInfo* ssl_info) {
310 NOTIMPLEMENTED(); 315 NOTIMPLEMENTED();
311 return false; 316 return false;
312 } 317 }
313 318
314 int SSLServerSocketNSS::InitializeSSLOptions() { 319 int SSLServerSocketNSS::InitializeSSLOptions() {
315 // Transport connected, now hook it up to nss 320 // Transport connected, now hook it up to nss
316 // TODO(port): specify rx and tx buffer sizes separately 321 nss_fd_ = memio_CreateIOLayer(kRecvBufferSize, kSendBufferSize);
317 nss_fd_ = memio_CreateIOLayer(kRecvBufferSize);
318 if (nss_fd_ == NULL) { 322 if (nss_fd_ == NULL) {
319 return ERR_OUT_OF_MEMORY; // TODO(port): map NSPR error code. 323 return ERR_OUT_OF_MEMORY; // TODO(port): map NSPR error code.
320 } 324 }
321 325
322 // Grab pointer to buffers 326 // Grab pointer to buffers
323 nss_bufs_ = memio_GetSecret(nss_fd_); 327 nss_bufs_ = memio_GetSecret(nss_fd_);
324 328
325 /* Create SSL state machine */ 329 /* Create SSL state machine */
326 /* Push SSL onto our fake I/O socket */ 330 /* Push SSL onto our fake I/O socket */
327 nss_fd_ = SSL_ImportFD(NULL, nss_fd_); 331 nss_fd_ = SSL_ImportFD(NULL, nss_fd_);
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 // initializes the NSS base library. 825 // initializes the NSS base library.
822 EnsureNSSSSLInit(); 826 EnsureNSSSSLInit();
823 if (!NSS_IsInitialized()) 827 if (!NSS_IsInitialized())
824 return ERR_UNEXPECTED; 828 return ERR_UNEXPECTED;
825 829
826 EnableSSLServerSockets(); 830 EnableSSLServerSockets();
827 return OK; 831 return OK;
828 } 832 }
829 833
830 } // namespace net 834 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_nss.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698