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

Unified Diff: net/socket/nss_ssl_util.cc

Issue 10543106: Add an explicit function to init NSS for SSL server sockets (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: net/socket/nss_ssl_util.cc
diff --git a/net/socket/nss_ssl_util.cc b/net/socket/nss_ssl_util.cc
index b92600aad6e4c0bb6fac6c3e73225c9b43f43800..7ea3baf2488943d866069168868a8cfbcbdb6afd 100644
--- a/net/socket/nss_ssl_util.cc
+++ b/net/socket/nss_ssl_util.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "net/socket/nss_ssl_util.h"
+#include "net/socket/nss_ssl_util_internal.h"
#include <nss.h>
#include <secerr.h>
@@ -22,6 +23,8 @@
namespace net {
+namespace {
+
class NSSSSLInitSingleton {
public:
NSSSSLInitSingleton() {
@@ -69,9 +72,27 @@ class NSSSSLInitSingleton {
}
};
+class NSSSSLServerInitSingleton {
+ public:
+ NSSSSLServerInitSingleton() {
+ EnsureNSSSSLInit();
+
+ SSL_ConfigServerSessionIDCache(1024, 5, 5, NULL);
+ }
+
+ ~NSSSSLServerInitSingleton() {
+ SSL_ShutdownServerSessionIDCache();
+ }
+};
+
static base::LazyInstance<NSSSSLInitSingleton> g_nss_ssl_init_singleton =
LAZY_INSTANCE_INITIALIZER;
+static base::LazyInstance<NSSSSLServerInitSingleton>
+ g_nss_ssl_server_init_singleton = LAZY_INSTANCE_INITIALIZER;
+
+} // namespace
+
// Initialize the NSS SSL library if it isn't already initialized. This must
// be called before any other NSS SSL functions. This function is
// thread-safe, and the NSS SSL library will only ever be initialized once.
@@ -85,6 +106,10 @@ void EnsureNSSSSLInit() {
g_nss_ssl_init_singleton.Get();
}
+void EnsureNSSSSLServerInit() {
+ g_nss_ssl_server_init_singleton.Get();
+}
+
// Map a Chromium net error code to an NSS error code.
// See _MD_unix_map_default_error in the NSS source
// tree for inspiration.

Powered by Google App Engine
This is Rietveld 408576698