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

Unified Diff: net/ssl/ssl_platform_key_win.cc

Issue 1304143010: Plumbing SSLPrivateKey Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 3 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/ssl/ssl_platform_key_win.cc
diff --git a/net/ssl/ssl_platform_key_win.cc b/net/ssl/ssl_platform_key_win.cc
index 5bd99554446139a757666ff56078838ba6002cdb..867b8c48b071fbc5a1763e2cc4c959119882277d 100644
--- a/net/ssl/ssl_platform_key_win.cc
+++ b/net/ssl/ssl_platform_key_win.cc
@@ -35,6 +35,9 @@ namespace net {
namespace {
+base::LazyInstance<SSLPlatformKeyTaskRunner>::Leaky g_platform_key_task_runner =
+ LAZY_INSTANCE_INITIALIZER;
+
using NCryptFreeObjectFunc = SECURITY_STATUS(WINAPI*)(NCRYPT_HANDLE);
using NCryptSignHashFunc = SECURITY_STATUS(WINAPI*)(NCRYPT_KEY_HANDLE, // hKey
VOID*, // pPaddingInfo
@@ -317,9 +320,12 @@ bool GetKeyInfo(const X509Certificate* certificate,
} // namespace
-scoped_ptr<SSLPrivateKey> FetchClientCertPrivateKey(
- X509Certificate* certificate,
- scoped_refptr<base::SequencedTaskRunner> task_runner) {
+scoped_refptr<SSLPrivateKey> FetchClientCertPrivateKey(
+ X509Certificate* certificate) {
+ if (!certificate) {
davidben 2015/09/25 20:10:12 Ditto about caller's problem.
svaldez 2015/09/28 16:54:53 Ditto.
+ return nullptr;
+ }
+
// Rather than query the private key for metadata, extract the public key from
// the certificate without using Windows APIs. CAPI and CNG do not
// consistently work depending on the system. See https://crbug.com/468345.
@@ -354,8 +360,8 @@ scoped_ptr<SSLPrivateKey> FetchClientCertPrivateKey(
DCHECK(SSLPrivateKey::Type::RSA == key_type);
delegate.reset(new SSLPlatformKeyCAPI(prov_or_key, key_spec, max_length));
}
- return make_scoped_ptr(
- new ThreadedSSLPrivateKey(delegate.Pass(), task_runner.Pass()));
+ return make_scoped_refptr(new ThreadedSSLPrivateKey(
+ delegate.Pass(), g_platform_key_task_runner.Get().task_runner().Pass()));
}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698