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

Unified Diff: net/base/openssl_util.h

Issue 4646001: Implement LoadTemporaryRoot for Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/net/base
Patch Set: bulach and wtc feedback 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/openssl_util.h
diff --git a/net/base/openssl_util.h b/net/base/openssl_util.h
index d4603c6666a3db5ef2a0886bbb8fd3d0cb412ea6..158d9a49810bbc9a977c43977cc985f321af6fbb 100644
--- a/net/base/openssl_util.h
+++ b/net/base/openssl_util.h
@@ -18,6 +18,13 @@ class ScopedSSL {
explicit ScopedSSL(T* ptr_) : ptr_(ptr_) { }
~ScopedSSL() { if (ptr_) (*destructor)(ptr_); }
+ void reset(T* p = NULL) {
+ if (ptr_ != p) {
+ (*destructor)(ptr_);
+ ptr_ = p;
+ }
+ }
+
T* get() const { return ptr_; }
private:
@@ -33,12 +40,18 @@ class OpenSSLInitSingleton {
private:
friend struct DefaultSingletonTraits<OpenSSLInitSingleton>;
+ friend class TestRootCerts; // For unit tests.
OpenSSLInitSingleton();
~OpenSSLInitSingleton();
static void LockingCallback(int mode, int n, const char* file, int line);
void OnLockingCallback(int mode, int n, const char* file, int line);
+ // (Re-)initializes |store_| to the default state. This is used to revert
+ // any modifications that TestRootCerts may have done, by initializing
wtc 2010/11/18 02:12:49 Nit: remove the parentheses in "(Re-)initializes".
+ // |store_| to the default state.
+ void ReinitializeStore();
+
ScopedSSL<SSL_CTX, SSL_CTX_free> ssl_ctx_;
ScopedSSL<X509_STORE, X509_STORE_free> store_;
// These locks are used and managed by OpenSSL via LockingCallback().
« no previous file with comments | « net/base/cert_test_util.cc ('k') | net/base/openssl_util.cc » ('j') | net/base/test_root_certs.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698