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

Unified Diff: net/base/openssl_memory_private_key_store.cc

Issue 12220104: Wire up SSL client authentication for OpenSSL/Android through the net/ stack (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: remove chrome/browser changes + fix linux_redux build Created 7 years, 10 months 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_memory_private_key_store.cc
diff --git a/net/base/openssl_memory_private_key_store.cc b/net/base/openssl_memory_private_key_store.cc
index 92716f236e1d341edc1f392bdcaa40bd44c0f726..1ab6cc486ba37be5b2c3d4bbc01a4b914ac7defb 100644
--- a/net/base/openssl_memory_private_key_store.cc
+++ b/net/base/openssl_memory_private_key_store.cc
@@ -17,6 +17,8 @@ namespace net {
namespace {
+// This is the linux_redux specific implementation of
+// OpenSSLPrivateKeyStore.
class OpenSSLMemoryKeyStore : public OpenSSLPrivateKeyStore {
public:
OpenSSLMemoryKeyStore() {}
@@ -25,35 +27,14 @@ class OpenSSLMemoryKeyStore : public OpenSSLPrivateKeyStore {
return Singleton<OpenSSLMemoryKeyStore>::get();
}
- virtual ~OpenSSLMemoryKeyStore() {
- base::AutoLock lock(lock_);
- for (std::vector<EVP_PKEY*>::iterator it = keys_.begin();
- it != keys_.end(); ++it) {
- EVP_PKEY_free(*it);
- }
- }
-
- virtual bool StorePrivateKey(const GURL& url, EVP_PKEY* pkey) {
- CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
- base::AutoLock lock(lock_);
- keys_.push_back(pkey);
+ virtual bool StoreKeyPair(const GURL& url, EVP_PKEY* pkey) OVERRIDE {
+ // Since there is no real key store, just record the keys in
+ // memory.
+ AddKeyPair(pkey, pkey);
return true;
}
- virtual EVP_PKEY* FetchPrivateKey(EVP_PKEY* pkey) {
- base::AutoLock lock(lock_);
- for (std::vector<EVP_PKEY*>::iterator it = keys_.begin();
- it != keys_.end(); ++it) {
- if (EVP_PKEY_cmp(*it, pkey) == 1)
- return *it;
- }
- return NULL;
- }
-
private:
- std::vector<EVP_PKEY*> keys_;
- base::Lock lock_;
-
DISALLOW_COPY_AND_ASSIGN(OpenSSLMemoryKeyStore);
};

Powered by Google App Engine
This is Rietveld 408576698