Return correct enveloped data type in ASN1 methods.
authorDr. Stephen Henson <steve@openssl.org>
Wed, 17 Jul 2013 14:18:01 +0000 (15:18 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Tue, 1 Oct 2013 13:01:18 +0000 (14:01 +0100)
For RSA and DSA keys return an appropriate RecipientInfo type. By setting
CMS_RECIPINFO_NONE for DSA keys an appropriate error is returned if
an attempt is made to use DSA with enveloped data.
(cherry picked from commit 41b920ef01abeb4c4b1c0f11e647370ae6533d02)

crypto/dsa/dsa_ameth.c
crypto/rsa/rsa_ameth.c

index 376156ec5ef3a6ad23539296601180f7b4fa1472..cdf49ac862d58ae9fd0e9ae281a669fc6f4ba38a 100644 (file)
@@ -625,6 +625,10 @@ static int dsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
                        X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0);
                        }
                return 1;
+
+               case ASN1_PKEY_CTRL_CMS_RI_TYPE:
+               *(int *)arg2 = CMS_RECIPINFO_NONE;
+               return 1;
 #endif
 
                case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
index bc6a5786342f8d7ce6568e38cd800f700752bb2f..db926b0e4260a8f67959c4502c37dd7002bf11ae 100644 (file)
@@ -448,6 +448,10 @@ static int rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
                else if (arg1 == 1)
                        return rsa_cms_decrypt(arg2);
                break;
+
+               case ASN1_PKEY_CTRL_CMS_RI_TYPE:
+               *(int *)arg2 = CMS_RECIPINFO_TRANS;
+               return 1;
 #endif
 
                case ASN1_PKEY_CTRL_DEFAULT_MD_NID: