summaryrefslogtreecommitdiffstats
path: root/crypto/cms
diff options
context:
space:
mode:
authorPaul Yang <kaishen.yy@antfin.com>2019-09-30 14:05:31 +0800
committerPaul Yang <kaishen.yy@antfin.com>2019-09-30 17:18:17 +0800
commit7e3ae24832e0705583b1471febf3dc0eb1cc021f (patch)
treee67320014f3adacefb760d3fe801b9e0593d2698 /crypto/cms
parentdf0822688fc3432cf800cdc07c7f9016ea201170 (diff)
Fix a bundle of mischecks of return values
Several EVP_PKEY_xxxx functions return 0 and a negative value for indicating errors. Some places call these functions with a zero return value check only, which misses the check for the negative scenarios. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10055)
Diffstat (limited to 'crypto/cms')
-rw-r--r--crypto/cms/cms_kari.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/cms/cms_kari.c b/crypto/cms/cms_kari.c
index bffa9351ae..3820d0e229 100644
--- a/crypto/cms/cms_kari.c
+++ b/crypto/cms/cms_kari.c
@@ -162,7 +162,7 @@ int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk)
if (!pk)
return 1;
pctx = EVP_PKEY_CTX_new(pk, NULL);
- if (!pctx || !EVP_PKEY_derive_init(pctx))
+ if (!pctx || EVP_PKEY_derive_init(pctx) <= 0)
goto err;
kari->pctx = pctx;
return 1;