summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-14 11:52:47 +0000
committerjoth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-14 11:52:47 +0000
commitb29af7d99bd1aede0ebb49e940dcb2fa319767cc (patch)
treef50c9516c16bb2198f485b8ff6686b6055b681a9
parente7931f3b1a2fd07b23e77b30c41770912f0784c3 (diff)
downloadchromium_src-b29af7d99bd1aede0ebb49e940dcb2fa319767cc.zip
chromium_src-b29af7d99bd1aede0ebb49e940dcb2fa319767cc.tar.gz
chromium_src-b29af7d99bd1aede0ebb49e940dcb2fa319767cc.tar.bz2
Fix openssl after singleton refactor
BUG=65298 TEST=Builds Review URL: http://codereview.chromium.org/5767005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69123 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/openssl_util.cc6
-rw-r--r--net/base/openssl_memory_private_key_store.cc6
-rw-r--r--net/base/x509_certificate_openssl.cc7
-rw-r--r--net/socket/ssl_client_socket_openssl.cc12
4 files changed, 18 insertions, 13 deletions
diff --git a/base/openssl_util.cc b/base/openssl_util.cc
index 8d47609..bc174fa 100644
--- a/base/openssl_util.cc
+++ b/base/openssl_util.cc
@@ -24,7 +24,7 @@ unsigned long CurrentThreadId() {
// Singleton for initializing and cleaning up the OpenSSL library.
class OpenSSLInitSingleton {
public:
- static OpenSSLInitSingleton* Get() {
+ static OpenSSLInitSingleton* GetInstance() {
// We allow the SSL environment to leak for multiple reasons:
// - it is used from a non-joinable worker thread that is not stopped on
// shutdown, hence may still be using OpenSSL library after the AtExit
@@ -58,7 +58,7 @@ class OpenSSLInitSingleton {
}
static void LockingCallback(int mode, int n, const char* file, int line) {
- OpenSSLInitSingleton::Get()->OnLockingCallback(mode, n, file, line);
+ OpenSSLInitSingleton::GetInstance()->OnLockingCallback(mode, n, file, line);
}
void OnLockingCallback(int mode, int n, const char* file, int line) {
@@ -92,7 +92,7 @@ int OpenSSLErrorCallback(const char* str, size_t len, void* context) {
} // namespace
void EnsureOpenSSLInit() {
- (void)OpenSSLInitSingleton::Get();
+ (void)OpenSSLInitSingleton::GetInstance();
}
void ClearOpenSSLERRStack(const tracked_objects::Location& location) {
diff --git a/net/base/openssl_memory_private_key_store.cc b/net/base/openssl_memory_private_key_store.cc
index 8dc69a0..6b65dbe 100644
--- a/net/base/openssl_memory_private_key_store.cc
+++ b/net/base/openssl_memory_private_key_store.cc
@@ -21,6 +21,10 @@ class OpenSSLMemoryKeyStore : public OpenSSLPrivateKeyStore {
public:
OpenSSLMemoryKeyStore() {}
+ static OpenSSLMemoryKeyStore* GetInstance() {
+ return Singleton<OpenSSLMemoryKeyStore>::get();
+ }
+
virtual ~OpenSSLMemoryKeyStore() {
AutoLock lock(lock_);
for (std::vector<EVP_PKEY*>::iterator it = keys_.begin();
@@ -57,7 +61,7 @@ class OpenSSLMemoryKeyStore : public OpenSSLPrivateKeyStore {
// static
OpenSSLPrivateKeyStore* OpenSSLPrivateKeyStore::GetInstance() {
- return Singleton<OpenSSLMemoryKeyStore>::get();
+ return OpenSSLMemoryKeyStore::GetInstance();
}
} // namespace net
diff --git a/net/base/x509_certificate_openssl.cc b/net/base/x509_certificate_openssl.cc
index 0d55c35..cee803f 100644
--- a/net/base/x509_certificate_openssl.cc
+++ b/net/base/x509_certificate_openssl.cc
@@ -206,7 +206,7 @@ void DERCache_free(void* parent, void* ptr, CRYPTO_EX_DATA* ad, int idx,
class X509InitSingleton {
public:
- static X509InitSingleton* Get() {
+ static X509InitSingleton* GetInstance() {
// We allow the X509 store to leak, because it is used from a non-joinable
// worker that is not stopped on shutdown, hence may still be using
// OpenSSL library after the AtExit runner has completed.
@@ -259,7 +259,8 @@ DERCache* SetDERCache(X509Certificate::OSCertHandle cert,
// not free it).
bool GetDERAndCacheIfNeeded(X509Certificate::OSCertHandle cert,
DERCache* der_cache) {
- int x509_der_cache_index = X509InitSingleton::Get()->der_cache_ex_index();
+ int x509_der_cache_index =
+ X509InitSingleton::GetInstance()->der_cache_ex_index();
// Re-encoding the DER data via i2d_X509 is an expensive operation, but it's
// necessary for comparing two certificates. We re-encode at most once per
@@ -392,7 +393,7 @@ void X509Certificate::GetDNSNames(std::vector<std::string>* dns_names) const {
// static
X509_STORE* X509Certificate::cert_store() {
- return X509InitSingleton::Get()->store();
+ return X509InitSingleton::GetInstance()->store();
}
int X509Certificate::Verify(const std::string& hostname,
diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc
index 145aec9..ab4ba6c 100644
--- a/net/socket/ssl_client_socket_openssl.cc
+++ b/net/socket/ssl_client_socket_openssl.cc
@@ -281,7 +281,7 @@ class SSLSessionCache {
class SSLContext {
public:
- static SSLContext* Get() { return Singleton<SSLContext>::get(); }
+ static SSLContext* GetInstance() { return Singleton<SSLContext>::get(); }
SSL_CTX* ssl_ctx() { return ssl_ctx_.get(); }
SSLSessionCache* session_cache() { return &session_cache_; }
@@ -322,7 +322,7 @@ class SSLContext {
}
static int NewSessionCallbackStatic(SSL* ssl, SSL_SESSION* session) {
- return Get()->NewSessionCallback(ssl, session);
+ return GetInstance()->NewSessionCallback(ssl, session);
}
int NewSessionCallback(SSL* ssl, SSL_SESSION* session) {
@@ -332,7 +332,7 @@ class SSLContext {
}
static void RemoveSessionCallbackStatic(SSL_CTX* ctx, SSL_SESSION* session) {
- return Get()->RemoveSessionCallback(ctx, session);
+ return GetInstance()->RemoveSessionCallback(ctx, session);
}
void RemoveSessionCallback(SSL_CTX* ctx, SSL_SESSION* session) {
@@ -341,7 +341,7 @@ class SSLContext {
}
static int ClientCertCallback(SSL* ssl, X509** x509, EVP_PKEY** pkey) {
- SSLClientSocketOpenSSL* socket = Get()->GetClientSocketFromSSL(ssl);
+ SSLClientSocketOpenSSL* socket = GetInstance()->GetClientSocketFromSSL(ssl);
CHECK(socket);
return socket->ClientCertRequestCallback(ssl, x509, pkey);
}
@@ -350,7 +350,7 @@ class SSLContext {
unsigned char** out, unsigned char* outlen,
const unsigned char* in,
unsigned int inlen, void* arg) {
- SSLClientSocketOpenSSL* socket = Get()->GetClientSocketFromSSL(ssl);
+ SSLClientSocketOpenSSL* socket = GetInstance()->GetClientSocketFromSSL(ssl);
return socket->SelectNextProtoCallback(out, outlen, in, inlen);
}
@@ -412,7 +412,7 @@ bool SSLClientSocketOpenSSL::Init() {
DCHECK(!ssl_);
DCHECK(!transport_bio_);
- SSLContext* context = SSLContext::Get();
+ SSLContext* context = SSLContext::GetInstance();
base::OpenSSLErrStackTracer err_tracer(FROM_HERE);
ssl_ = SSL_new(context->ssl_ctx());