Oops - fixed the fix. The prototype now correctly unpacks into a
authorchrisk%netscape.com
Wed, 21 Jun 2000 00:04:38 +0000
changeset 391 d003cffd9d65d5f3ef17bc332f6c80d64ccf1140
parent 386 afe3bc4ebfae21710de77c3e91297c770d6cd600
child 392 2e809c457ef640f0fa28b7ecaa726ebeee4faeb4
push idunknown
push userunknown
push dateunknown
Oops - fixed the fix. The prototype now correctly unpacks into a DHPublicKey structure.
security/nss/lib/cryptohi/seckey.c
--- a/security/nss/lib/cryptohi/seckey.c
+++ b/security/nss/lib/cryptohi/seckey.c
@@ -84,20 +84,19 @@ const SEC_ASN1Template SECKEY_PQGParamsT
 };
 
 const SEC_ASN1Template SECKEY_DHPublicKeyTemplate[] = {
     { SEC_ASN1_INTEGER, offsetof(SECKEYPublicKey,u.dh.publicValue), },
     { 0, }
 };
 
 const SEC_ASN1Template SECKEY_DHParamKeyTemplate[] = {
-    { SEC_ASN1_SEQUENCE,  0, NULL, sizeof(PQGParams) },
-    { SEC_ASN1_INTEGER, offsetof(PQGParams,prime), },
-    { SEC_ASN1_INTEGER, offsetof(PQGParams,subPrime), },
-    { SEC_ASN1_INTEGER, offsetof(PQGParams,base), },
+    { SEC_ASN1_SEQUENCE,  0, NULL, sizeof(SECKEYPublicKey) },
+    { SEC_ASN1_INTEGER, offsetof(SECKEYPublicKey,u.dh.prime), },
+    { SEC_ASN1_INTEGER, offsetof(SECKEYPublicKey,u.dh.base), },
     /* XXX chrisk: this needs to be expanded for decoding of j and validationParms (RFC2459 7.3.2) */
     { SEC_ASN1_SKIP_REST },
     { 0, }
 };
 
 const SEC_ASN1Template SECKEY_FortezzaParameterTemplate[] = {
     { SEC_ASN1_SEQUENCE,  0, NULL, sizeof(PQGParams) },
     { SEC_ASN1_OCTET_STRING, offsetof(PQGParams,prime), },
@@ -862,18 +861,17 @@ seckey_ExtractPublicKey(CERTSubjectPubli
 
 	if (rv == SECSuccess) return pubk;
 	break;
       case SEC_OID_X942_DIFFIE_HELMAN_KEY:
 	pubk->keyType = dhKey;
 	rv = SEC_ASN1DecodeItem(arena, pubk, SECKEY_DHPublicKeyTemplate, &os);
 	if (rv != SECSuccess) break;
 
-        rv = SEC_ASN1DecodeItem(arena, &pubk->u.dh,
-                             SECKEY_DHParamKeyTemplate,
+        rv = SEC_ASN1DecodeItem(arena, pubk, SECKEY_DHParamKeyTemplate,
                                  &spki->algorithm.parameters); 
 
 	if (rv == SECSuccess) return pubk;
 	break;
       case SEC_OID_MISSI_KEA_DSS_OLD:
       case SEC_OID_MISSI_KEA_DSS:
       case SEC_OID_MISSI_DSS_OLD:
       case SEC_OID_MISSI_DSS: