summaryrefslogtreecommitdiffstats
path: root/crypto/cms
diff options
context:
space:
mode:
authorPeiwei Hu <jlu.hpw@foxmail.com>2022-05-24 23:57:33 +0800
committerTomas Mraz <tomas@openssl.org>2022-06-02 11:06:41 +0200
commit2cba2e160d5b028e4a777e8038744a8bc4280629 (patch)
tree806dd88d75132a8b1b91c29c171f600885a75efe /crypto/cms
parent00d5193b688019a85d1bd0196f2837a4476394bb (diff)
Fix the checks of EVP_PKEY_CTX_set/get_* functions
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18399)
Diffstat (limited to 'crypto/cms')
-rw-r--r--crypto/cms/cms_dh.c2
-rw-r--r--crypto/cms/cms_ec.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/crypto/cms/cms_dh.c b/crypto/cms/cms_dh.c
index 283a75facf..31082894eb 100644
--- a/crypto/cms/cms_dh.c
+++ b/crypto/cms/cms_dh.c
@@ -244,7 +244,7 @@ static int dh_cms_encrypt(CMS_RecipientInfo *ri)
/* See if custom parameters set */
kdf_type = EVP_PKEY_CTX_get_dh_kdf_type(pctx);
- if (kdf_type <= 0 || !EVP_PKEY_CTX_get_dh_kdf_md(pctx, &kdf_md))
+ if (kdf_type <= 0 || EVP_PKEY_CTX_get_dh_kdf_md(pctx, &kdf_md) <= 0)
goto err;
if (kdf_type == EVP_PKEY_DH_KDF_NONE) {
diff --git a/crypto/cms/cms_ec.c b/crypto/cms/cms_ec.c
index be9c6ff893..e82115934e 100644
--- a/crypto/cms/cms_ec.c
+++ b/crypto/cms/cms_ec.c
@@ -289,7 +289,7 @@ static int ecdh_cms_encrypt(CMS_RecipientInfo *ri)
kdf_type = EVP_PKEY_CTX_get_ecdh_kdf_type(pctx);
if (kdf_type <= 0)
goto err;
- if (!EVP_PKEY_CTX_get_ecdh_kdf_md(pctx, &kdf_md))
+ if (EVP_PKEY_CTX_get_ecdh_kdf_md(pctx, &kdf_md) <= 0)
goto err;
ecdh_nid = EVP_PKEY_CTX_get_ecdh_cofactor_mode(pctx);
if (ecdh_nid < 0)