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

Unified Diff: net/base/x509_certificate_openssl.cc

Issue 4646001: Implement LoadTemporaryRoot for Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/net/base
Patch Set: New Win method & unittests Created 10 years, 1 month 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/base/x509_certificate_openssl.cc
diff --git a/net/base/x509_certificate_openssl.cc b/net/base/x509_certificate_openssl.cc
index 2be38dd0518e310d3ad065051fb5088d9e5d818a..0b273d592250d840364609c15a3107ead0d58e93 100644
--- a/net/base/x509_certificate_openssl.cc
+++ b/net/base/x509_certificate_openssl.cc
@@ -209,16 +209,20 @@ class X509InitSingleton {
int der_cache_ex_index() const { return der_cache_ex_index_; }
X509_STORE* store() const { return store_.get(); }
+ void ResetStore() {
+ 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)).
+ ResetStore();
}
int der_cache_ex_index_;
@@ -305,6 +309,11 @@ void X509Certificate::Initialize() {
nxou::ParseDate(X509_get_notAfter(cert_handle_), &valid_expiry_);
}
+// static
+void X509Certificate::ResetStore() {
+ Singleton<X509InitSingleton>::get()->ResetStore();
+}
+
SHA1Fingerprint X509Certificate::CalculateFingerprint(OSCertHandle cert) {
SHA1Fingerprint sha1;
unsigned int sha1_size = static_cast<unsigned int>(sizeof(sha1.data));

Powered by Google App Engine
This is Rietveld 408576698