diff options
author | Nicholas Nethercote <nnethercote@mozilla.com> | 2014-11-18 15:16:24 -0800 |
---|---|---|
committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2014-11-18 15:16:24 -0800 |
commit | 40ab80997e8f2474a6c659334fb4eb6fa2c0c3f3 (patch) | |
tree | 84ba58ea9b93b24b22d453c8aae7ab8ccab5a0e9 /lib/pki/tdcache.c | |
parent | 91ff991ecc874cc295eb24fc4e0e04428adb37a8 (diff) | |
download | nss-hg-40ab80997e8f2474a6c659334fb4eb6fa2c0c3f3.tar.gz |
Bug 1095307 - Clean up nssPKIX509_GetIssuerAndSerialFromDER(). r=relyea.NSS_3_18_BETA3
This patch:
- Removes the two static issuer_and_serial_from_encoding() functions.
- Rewrites nssPKIX509_GetIssuerAndSerialFromDER() to be almost identical to the
issuer_and_serial_from_encoding() from pkistore.c. This new version avoids
unnecessary heap allocations (and so doesn't need an |arena| argument),
obtains the issuer and serial in the order suggested by the function name,
and is more readable than the old version.
- Tweaks nssTrustDomain_FindCertificateByEncodedCertificate() to be more like
nssTrustDomain_GetCertByDERFromCache() and
nssCertificateStore_FindCertificateByEncodedCertificate(), which are the
other two functions that now call nssPKIX509_GetIssuerAndSerialFromDER().
Diffstat (limited to 'lib/pki/tdcache.c')
-rw-r--r-- | lib/pki/tdcache.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/lib/pki/tdcache.c b/lib/pki/tdcache.c index 0842d8b2c..4d3ebbaab 100644 --- a/lib/pki/tdcache.c +++ b/lib/pki/tdcache.c @@ -1046,32 +1046,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 +1058,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; } |