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

Unified Diff: net/socket/ssl_client_socket_nss.cc

Issue 2944008: Refactor X509Certificate caching to cache the OS handle, rather than the X509Certificate (Closed)
Patch Set: Removed unnecessary bits Created 9 years, 5 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/socket/ssl_client_socket_nss.cc
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index 41bd5cc0cfc4d07f0dcd9ffe14a2007ca10377c0..a95fd41bdd264079fa59ac3bd602625b3a08095f 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -2035,11 +2035,10 @@ SECStatus SSLClientSocketNSS::PlatformClientAuthHandler(
// Get the leaf certificate.
PCCERT_CONTEXT cert_context =
chain_context->rgpChain[0]->rgpElement[0]->pCertContext;
- // Copy it to our own certificate store, so that we can close the "MY"
- // certificate store before returning from this function.
+ // Copy the certificate into a NULL store, so that we can close the "MY"
+ // store before returning from this function.
PCCERT_CONTEXT cert_context2;
- BOOL ok = CertAddCertificateContextToStore(X509Certificate::cert_store(),
- cert_context,
+ BOOL ok = CertAddCertificateContextToStore(NULL, cert_context,
CERT_STORE_ADD_USE_EXISTING,
&cert_context2);
if (!ok) {
@@ -2054,7 +2053,8 @@ SECStatus SSLClientSocketNSS::PlatformClientAuthHandler(
net::X509Certificate::OSCertHandles intermediates;
for (DWORD i = 1; i < chain_context->rgpChain[0]->cElement; i++) {
PCCERT_CONTEXT intermediate_copy;
- ok = CertAddCertificateContextToStore(X509Certificate::cert_store(),
+ ok = CertAddCertificateContextToStore(
+ NULL,
chain_context->rgpChain[0]->rgpElement[i]->pCertContext,
wtc 2011/07/17 01:55:32 Move this to the previous line.
CERT_STORE_ADD_USE_EXISTING, &intermediate_copy);
if (!ok) {
@@ -2065,8 +2065,7 @@ SECStatus SSLClientSocketNSS::PlatformClientAuthHandler(
}
scoped_refptr<X509Certificate> cert = X509Certificate::CreateFromHandle(
- cert_context2, X509Certificate::SOURCE_LONE_CERT_IMPORT,
- intermediates);
+ cert_context2, intermediates);
that->client_certs_.push_back(cert);
X509Certificate::FreeOSCertHandle(cert_context2);
@@ -2229,8 +2228,7 @@ SECStatus SSLClientSocketNSS::ClientAuthHandler(
NSS_CmpCertChainWCANames(node->cert, ca_names) != SECSuccess)
continue;
X509Certificate* x509_cert = X509Certificate::CreateFromHandle(
- node->cert, X509Certificate::SOURCE_LONE_CERT_IMPORT,
- net::X509Certificate::OSCertHandles());
+ node->cert, net::X509Certificate::OSCertHandles());
that->client_certs_.push_back(x509_cert);
}
CERT_DestroyCertList(client_certs);

Powered by Google App Engine
This is Rietveld 408576698