Index: net/base/x509_certificate_openssl.cc |
diff --git a/net/base/x509_certificate_openssl.cc b/net/base/x509_certificate_openssl.cc |
index cee803f2d424dd7ded806eaf5348c4088b7f93ba..5fd3a673e05cc9fe02916e8c26eb2dd458cbffe6 100644 |
--- a/net/base/x509_certificate_openssl.cc |
+++ b/net/base/x509_certificate_openssl.cc |
@@ -216,16 +216,20 @@ class X509InitSingleton { |
int der_cache_ex_index() const { return der_cache_ex_index_; } |
X509_STORE* store() const { return store_.get(); } |
+ void ResetCertStore() { |
+ store_.reset(X509_STORE_new()); |
+ DCHECK(store_.get()); |
+ X509_STORE_set_default_paths(store_.get()); |
+ // TODO(joth): Enable CRL (see X509_STORE_set_flags(X509_V_FLAG_CRL_CHECK)). |
+ } |
+ |
private: |
friend struct DefaultSingletonTraits<X509InitSingleton>; |
- X509InitSingleton() |
- : der_cache_ex_index_((base::EnsureOpenSSLInit(), |
- X509_get_ex_new_index(0, 0, 0, 0, |
- DERCache_free))), |
- store_(X509_STORE_new()) { |
+ X509InitSingleton() { |
+ base::EnsureOpenSSLInit(); |
+ der_cache_ex_index_ = X509_get_ex_new_index(0, 0, 0, 0, DERCache_free); |
DCHECK_NE(der_cache_ex_index_, -1); |
- X509_STORE_set_default_paths(store_.get()); |
- // TODO(joth): Enable CRL (see X509_STORE_set_flags(X509_V_FLAG_CRL_CHECK)). |
+ ResetCertStore(); |
} |
int der_cache_ex_index_; |
@@ -312,6 +316,11 @@ void X509Certificate::Initialize() { |
nxou::ParseDate(X509_get_notAfter(cert_handle_), &valid_expiry_); |
} |
+// static |
+void X509Certificate::ResetCertStore() { |
+ X509InitSingleton::Get()->ResetCertStore(); |
+} |
+ |
SHA1Fingerprint X509Certificate::CalculateFingerprint(OSCertHandle cert) { |
SHA1Fingerprint sha1; |
unsigned int sha1_size = static_cast<unsigned int>(sizeof(sha1.data)); |