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

Unified Diff: nss/lib/pki/tdcache.c

Issue 1017413002: Uprev NSS to 3.18 RTM (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss.git@nspr_uprev
Patch Set: Rebased 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 | « nss/lib/pki/pkistore.c ('k') | nss/lib/pki/trustdomain.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: nss/lib/pki/tdcache.c
diff --git a/nss/lib/pki/tdcache.c b/nss/lib/pki/tdcache.c
index 0842d8b2c2b73a649cbbe694c2d70ae2f37c3e3f..7842189ca7e6693a4d0de9aaa0795d25471a4fbd 100644
--- a/nss/lib/pki/tdcache.c
+++ b/nss/lib/pki/tdcache.c
@@ -391,6 +391,7 @@ remove_token_certs(const void *k, void *v, void *a)
nssPKIObject *object = &c->object;
struct token_cert_dtor *dtor = a;
PRUint32 i;
+ nssPKIObject_AddRef(object);
nssPKIObject_Lock(object);
for (i=0; i<object->numInstances; i++) {
if (object->instances[i]->token == dtor->token) {
@@ -409,6 +410,7 @@ remove_token_certs(const void *k, void *v, void *a)
}
}
nssPKIObject_Unlock(object);
+ nssPKIObject_Destroy(object);
return;
}
@@ -435,17 +437,21 @@ nssTrustDomain_RemoveTokenCertsFromCache (
dtor.numCerts = 0;
dtor.arrSize = arrSize;
PZ_Lock(td->cache->lock);
- nssHash_Iterate(td->cache->issuerAndSN, remove_token_certs, (void *)&dtor);
+ nssHash_Iterate(td->cache->issuerAndSN, remove_token_certs, &dtor);
for (i=0; i<dtor.numCerts; i++) {
if (dtor.certs[i]->object.numInstances == 0) {
nssTrustDomain_RemoveCertFromCacheLOCKED(td, dtor.certs[i]);
dtor.certs[i] = NULL; /* skip this cert in the second for loop */
+ } else {
+ /* make sure it doesn't disappear on us before we finish */
+ nssCertificate_AddRef(dtor.certs[i]);
}
}
PZ_Unlock(td->cache->lock);
for (i=0; i<dtor.numCerts; i++) {
if (dtor.certs[i]) {
STAN_ForceCERTCertificateUpdate(dtor.certs[i]);
+ nssCertificate_Destroy(dtor.certs[i]);
}
}
nss_ZFreeIf(dtor.certs);
@@ -1046,32 +1052,6 @@ nssTrustDomain_GetCertForIssuerAndSNFromCache (
return rvCert;
}
-static PRStatus
-issuer_and_serial_from_encoding (
- NSSBER *encoding,
- NSSDER *issuer,
- NSSDER *serial
-)
-{
- SECItem derCert, derIssuer, derSerial;
- SECStatus secrv;
- derCert.data = (unsigned char *)encoding->data;
- derCert.len = encoding->size;
- secrv = CERT_IssuerNameFromDERCert(&derCert, &derIssuer);
- if (secrv != SECSuccess) {
- return PR_FAILURE;
- }
- secrv = CERT_SerialNumberFromDERCert(&derCert, &derSerial);
- if (secrv != SECSuccess) {
- return PR_FAILURE;
- }
- issuer->data = derIssuer.data;
- issuer->size = derIssuer.len;
- serial->data = derSerial.data;
- serial->size = derSerial.len;
- return PR_SUCCESS;
-}
-
/*
* Look for a specific cert in the cache
*/
@@ -1084,7 +1064,7 @@ nssTrustDomain_GetCertByDERFromCache (
PRStatus nssrv = PR_FAILURE;
NSSDER issuer, serial;
NSSCertificate *rvCert;
- nssrv = issuer_and_serial_from_encoding(der, &issuer, &serial);
+ nssrv = nssPKIX509_GetIssuerAndSerialFromDER(der, &issuer, &serial);
if (nssrv != PR_SUCCESS) {
return NULL;
}
« no previous file with comments | « nss/lib/pki/pkistore.c ('k') | nss/lib/pki/trustdomain.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698