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

Unified Diff: net/base/openssl_private_key_store_memory.cc

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « net/base/openssl_private_key_store_android.cc ('k') | net/base/platform_mime_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/openssl_private_key_store_memory.cc
diff --git a/net/base/openssl_private_key_store_memory.cc b/net/base/openssl_private_key_store_memory.cc
deleted file mode 100644
index 4d6a287c2a7b75e63f1fd7a7e8392557a28b0af5..0000000000000000000000000000000000000000
--- a/net/base/openssl_private_key_store_memory.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Defines an in-memory private key store, primarily used for testing.
-
-#include "net/base/openssl_private_key_store.h"
-
-#include <openssl/evp.h>
-
-#include "base/logging.h"
-#include "base/memory/singleton.h"
-#include "base/synchronization/lock.h"
-
-namespace net {
-
-namespace {
-
-// A small in-memory store for public/private key pairs held in
-// a single EVP_PKEY object. This is intentionally distinct from
-// net::SSLClientKeyStore.
-class MemoryKeyPairStore {
- public:
- MemoryKeyPairStore() {}
-
- static MemoryKeyPairStore* GetInstance() {
- return Singleton<MemoryKeyPairStore>::get();
- }
-
- ~MemoryKeyPairStore() {
- base::AutoLock lock(lock_);
- for (std::vector<EVP_PKEY*>::iterator it = keys_.begin();
- it != keys_.end(); ++it) {
- EVP_PKEY_free(*it);
- }
- }
-
- bool StoreKeyPair(EVP_PKEY* pkey) {
- EVP_PKEY_dup(pkey);
- base::AutoLock lock(lock_);
- keys_.push_back(pkey);
- return true;
- }
-
- bool HasPrivateKey(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 true;
- }
- return false;
- }
-
- private:
- std::vector<EVP_PKEY*> keys_;
- base::Lock lock_;
-
- DISALLOW_COPY_AND_ASSIGN(MemoryKeyPairStore);
-};
-
-} // namespace
-
-bool OpenSSLPrivateKeyStore::StoreKeyPair(const GURL& url,
- EVP_PKEY* pkey) {
- return MemoryKeyPairStore::GetInstance()->StoreKeyPair(pkey);
-}
-
-bool OpenSSLPrivateKeyStore::HasPrivateKey(EVP_PKEY* pub_key) {
- return MemoryKeyPairStore::GetInstance()->HasPrivateKey(pub_key);
-}
-
-} // namespace net
-
« no previous file with comments | « net/base/openssl_private_key_store_android.cc ('k') | net/base/platform_mime_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698