diff options
author | Matt Caswell <matt@openssl.org> | 2020-10-07 14:45:22 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2020-10-15 10:00:28 +0100 |
commit | 9ab7fe483629704b09dc43c1998e0e489615390f (patch) | |
tree | 7080bba8815bbf809a077a4f2711838f5acbf2cd /crypto/cms/cms_sd.c | |
parent | 0b3a4ef27a6c2a427dc2d4a87c52677d57c90f4c (diff) |
Move CMS signing code out of the algorithms and into CMS
There is a large amount of CMS sepcific code in the algorithms. This is in
the wrong place and breaks layering. This code should be in the CMS layer.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13088)
Diffstat (limited to 'crypto/cms/cms_sd.c')
-rw-r--r-- | crypto/cms/cms_sd.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c index 1338211072..377fac5917 100644 --- a/crypto/cms/cms_sd.c +++ b/crypto/cms/cms_sd.c @@ -233,6 +233,15 @@ static int cms_sd_asn1_ctrl(CMS_SignerInfo *si, int cmd) EVP_PKEY *pkey = si->pkey; int i; +#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_EC) + if (EVP_PKEY_is_a(pkey, "DSA") || EVP_PKEY_is_a(pkey, "EC")) + return cms_ecdsa_dsa_sign(si, cmd); + else +#endif + if (EVP_PKEY_is_a(pkey, "RSA") || EVP_PKEY_is_a(pkey, "RSA-PSS")) + return cms_rsa_sign(si, cmd); + + /* Something else? We'll give engines etc a chance to handle this */ if (pkey->ameth == NULL || pkey->ameth->pkey_ctrl == NULL) return 1; i = pkey->ameth->pkey_ctrl(pkey, ASN1_PKEY_CTRL_CMS_SIGN, cmd, si); |