summaryrefslogtreecommitdiff
path: root/security/nss/lib/cryptohi
diff options
context:
space:
mode:
authorjpierre%netscape.com <devnull@localhost>2002-10-29 22:52:31 +0000
committerjpierre%netscape.com <devnull@localhost>2002-10-29 22:52:31 +0000
commitc8a5d4609270c437231eed0fdac33d86f4a2142d (patch)
treef5467fb8d4fb1caf4661cad1faae1d2d9b849f6d /security/nss/lib/cryptohi
parentbf7dceb699a7dda410f5b83f3de556db9374b0be (diff)
downloadnss-hg-c8a5d4609270c437231eed0fdac33d86f4a2142d.tar.gz
Use QuickDER to decode DER public key. Bug #95311
Diffstat (limited to 'security/nss/lib/cryptohi')
-rw-r--r--security/nss/lib/cryptohi/seckey.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/security/nss/lib/cryptohi/seckey.c b/security/nss/lib/cryptohi/seckey.c
index f6c2f0f7c..a078120d0 100644
--- a/security/nss/lib/cryptohi/seckey.c
+++ b/security/nss/lib/cryptohi/seckey.c
@@ -1814,24 +1814,27 @@ SECKEY_ImportDERPublicKey(SECItem *derKey, CK_KEY_TYPE type)
if(pubk == NULL) {
goto finish;
}
- pubk->arena = NULL;
+ pubk->arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
+ if (NULL == pubk->arena) {
+ goto finish;
+ }
pubk->pkcs11Slot = NULL;
pubk->pkcs11ID = CK_INVALID_HANDLE;
switch( type ) {
case CKK_RSA:
prepare_rsa_pub_key_for_asn1(pubk);
- rv = SEC_ASN1DecodeItem(NULL, pubk, SECKEY_RSAPublicKeyTemplate,derKey);
+ rv = SEC_QuickDERDecodeItem(pubk->arena, pubk, SECKEY_RSAPublicKeyTemplate,derKey);
pubk->keyType = rsaKey;
break;
case CKK_DSA:
prepare_dsa_pub_key_for_asn1(pubk);
- rv = SEC_ASN1DecodeItem(NULL, pubk, SECKEY_DSAPublicKeyTemplate,derKey);
+ rv = SEC_QuickDERDecodeItem(pubk->arena, pubk, SECKEY_DSAPublicKeyTemplate,derKey);
pubk->keyType = dsaKey;
break;
case CKK_DH:
prepare_dh_pub_key_for_asn1(pubk);
- rv = SEC_ASN1DecodeItem(NULL, pubk, SECKEY_DHPublicKeyTemplate, derKey);
+ rv = SEC_QuickDERDecodeItem(pubk->arena, pubk, SECKEY_DHPublicKeyTemplate, derKey);
pubk->keyType = dhKey;
break;
default: