0
Files
src/base/nss_init.cc
dkegel@google.com b43c97c9b0 Port SSLClientSocket to Linux
Passes tests (once you enable them by removing DISABLED_).
Probably want to add a mock https server so we can leave those tests enabled when we check in.

Had to add full duplex support to TCPClientSocket on Linux
to avoid kludgy plumbing issues.
Also had to add dummy implementation of 
X509Certificate::~X509Certificate to prevent link error.

Rediffed to current trunk, addressed all review issues. 

Review URL: http://codereview.chromium.org/4049

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3751 0039d316-1c4b-4281-b951-d872f2087c98
2008-10-22 19:50:58 +00:00

48 lines
1012 B
C++

// Copyright (c) 2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/nss_init.h"
#include <nss.h>
// Work around https://bugzilla.mozilla.org/show_bug.cgi?id=455424
// until NSS 3.12.2 comes out and we update to it.
#define Lock FOO_NSS_Lock
#include <ssl.h>
#undef Lock
#include "base/logging.h"
#include "base/singleton.h"
namespace {
class NSSInitSingleton {
public:
NSSInitSingleton() {
CHECK(NSS_NoDB_Init(".") == SECSuccess);
// Enable ciphers
NSS_SetDomesticPolicy();
// Enable SSL
SSL_OptionSetDefault(SSL_SECURITY, PR_TRUE);
}
~NSSInitSingleton() {
// Have to clear the cache, or NSS_Shutdown fails with SEC_ERROR_BUSY
SSL_ClearSessionCache();
SECStatus status = NSS_Shutdown();
DCHECK(status == SECSuccess);
}
};
} // namespace
namespace base {
void EnsureNSSInit() {
Singleton<NSSInitSingleton>::get();
}
} // namespace base