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:51:52 +0000 (18:51 +0100)
PR#3789

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/cms/cms_kari.c

index 5aaba59..69a5115 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 */
 
@@ -360,6 +361,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 {