diff options
author | Matt Caswell <matt@openssl.org> | 2020-10-07 15:59:28 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2020-10-15 10:00:28 +0100 |
commit | 7022d9b9032794330cd2d753f077670db95d33d4 (patch) | |
tree | d582bbfaf07740c420a4115794fd1210076437b2 /crypto/cms | |
parent | 9ab7fe483629704b09dc43c1998e0e489615390f (diff) |
Remove CMS recipient info information out of the algorithm implementations
Low level algorithm implementations have no business knowing about details
of the higher level CMS concept. This knowledge is therefore moved into 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')
-rw-r--r-- | crypto/cms/cms_env.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/crypto/cms/cms_env.c b/crypto/cms/cms_env.c index 84d9e5b948..8f3e2db339 100644 --- a/crypto/cms/cms_env.c +++ b/crypto/cms/cms_env.c @@ -1303,6 +1303,20 @@ err: */ int cms_pkey_get_ri_type(EVP_PKEY *pk) { + /* Check types that we know about */ + if (EVP_PKEY_is_a(pk, "DH")) + return CMS_RECIPINFO_AGREE; + else if (EVP_PKEY_is_a(pk, "DSA")) + return CMS_RECIPINFO_NONE; + else if (EVP_PKEY_is_a(pk, "EC")) + return CMS_RECIPINFO_AGREE; + else if (EVP_PKEY_is_a(pk, "RSA")) + return CMS_RECIPINFO_TRANS; + + /* + * Otherwise this might ben an engine implementation, so see if we can get + * the type from the ameth. + */ if (pk->ameth && pk->ameth->pkey_ctrl) { int i, r; i = pk->ameth->pkey_ctrl(pk, ASN1_PKEY_CTRL_CMS_RI_TYPE, 0, &r); |