Fix ECDH key identifier support.
authorDr. Stephen Henson <steve@openssl.org>
Fri, 10 Apr 2015 01:33:44 +0000 (02:33 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 10 Apr 2015 17:52:49 +0000 (18:52 +0100)
PR#3789

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 7a317fa07cf3d9952c574e7d214d371798fee42a)

crypto/cms/cms_kari.c

index f8a6cbadb06c4adf740dab6a7647dc788e64059d..2cfcdb29cd50c8a37384a916dce3c4b5195e0360 100644 (file)
@@ -66,6 +66,7 @@
 DECLARE_ASN1_ITEM(CMS_KeyAgreeRecipientInfo)
 DECLARE_ASN1_ITEM(CMS_RecipientEncryptedKey)
 DECLARE_ASN1_ITEM(CMS_OriginatorPublicKey)
+DECLARE_ASN1_ITEM(CMS_RecipientKeyIdentifier)
 
 /* Key Agreement Recipient Info (KARI) routines */
 
@@ -362,6 +363,9 @@ int cms_RecipientInfo_kari_init(CMS_RecipientInfo *ri, X509 *recip,
 
     if (flags & CMS_USE_KEYID) {
         rek->rid->type = CMS_REK_KEYIDENTIFIER;
+        rek->rid->d.rKeyId = M_ASN1_new_of(CMS_RecipientKeyIdentifier);
+        if (rek->rid->d.rKeyId == NULL)
+            return 0;
         if (!cms_set1_keyid(&rek->rid->d.rKeyId->subjectKeyIdentifier, recip))
             return 0;
     } else {