Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/base/openssl_private_key_store.h" | 5 #include "net/base/openssl_private_key_store.h" |
| 6 | 6 |
| 7 #include <openssl/evp.h> | 7 #include <openssl/evp.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 return ret; | 40 return ret; |
| 41 } | 41 } |
| 42 | 42 |
| 43 virtual EVP_PKEY* FetchPrivateKey(EVP_PKEY* pkey) { | 43 virtual EVP_PKEY* FetchPrivateKey(EVP_PKEY* pkey) { |
| 44 // TODO(joth): Implement when client authentication is required. | 44 // TODO(joth): Implement when client authentication is required. |
| 45 NOTIMPLEMENTED(); | 45 NOTIMPLEMENTED(); |
| 46 return NULL; | 46 return NULL; |
| 47 } | 47 } |
| 48 | 48 |
| 49 static OpenSSLKeyStoreAndroid* GetInstance() { | 49 static OpenSSLKeyStoreAndroid* GetInstance() { |
| 50 return Singleton<OpenSSLKeyStoreAndroid>::get(); | 50 // We allow the OpenSSL key store to be leaked, because it is used |
| 51 // from a non-joinable worker that is not stopped on shutdown. | |
|
Ryan Sleevi
2012/09/05 17:29:00
comment nit: "we"
Johnny(Jianning) Ding
2012/09/06 10:34:44
Done.
| |
| 52 return Singleton<OpenSSLKeyStoreAndroid, | |
|
Ryan Sleevi
2012/09/05 17:29:00
style nit: In general, templates such as this tend
Johnny(Jianning) Ding
2012/09/06 10:34:44
Done.
| |
| 53 LeakySingletonTraits<OpenSSLKeyStoreAndroid> >::get(); | |
|
Ryan Sleevi
2012/09/05 17:29:00
nit: It may be helpful to have this as a typedef (
Johnny(Jianning) Ding
2012/09/06 10:34:44
Done.
| |
| 51 } | 54 } |
| 52 | 55 |
| 53 private: | 56 private: |
| 54 OpenSSLKeyStoreAndroid() {} | 57 OpenSSLKeyStoreAndroid() {} |
| 55 friend struct DefaultSingletonTraits<OpenSSLKeyStoreAndroid>; | 58 friend struct DefaultSingletonTraits<OpenSSLKeyStoreAndroid>; |
|
Ryan Sleevi
2012/09/05 17:29:00
nit: not needed anymore with leaky.
Johnny(Jianning) Ding
2012/09/06 10:34:44
it's still needed since the ctor is in private sec
| |
| 56 | 59 |
| 57 DISALLOW_COPY_AND_ASSIGN(OpenSSLKeyStoreAndroid); | 60 DISALLOW_COPY_AND_ASSIGN(OpenSSLKeyStoreAndroid); |
| 58 }; | 61 }; |
| 59 | 62 |
| 60 } // namespace | 63 } // namespace |
| 61 | 64 |
| 62 OpenSSLPrivateKeyStore* OpenSSLPrivateKeyStore::GetInstance() { | 65 OpenSSLPrivateKeyStore* OpenSSLPrivateKeyStore::GetInstance() { |
| 63 return OpenSSLKeyStoreAndroid::GetInstance(); | 66 return OpenSSLKeyStoreAndroid::GetInstance(); |
| 64 } | 67 } |
| 65 | 68 |
| 66 } // namespace net | 69 } // namespace net |
| OLD | NEW |