summaryrefslogtreecommitdiffstats
path: root/apps/dhparam.c
diff options
context:
space:
mode:
authorPW Hu <jlu.hpw@foxmail.com>2021-10-08 16:59:00 +0800
committerTomas Mraz <tomas@openssl.org>2021-10-11 10:45:21 +0200
commit5e199c356d09aca3b625b5ea16966b36d24b0201 (patch)
tree0ff9a8d14dc635c79fe486759033f4954847d50f /apps/dhparam.c
parent518ce65d93692ecd4c004b96b47d58da8e5922ea (diff)
Bugfix: unsafe return check of EVP_PKEY_fromdata_init
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16783)
Diffstat (limited to 'apps/dhparam.c')
-rw-r--r--apps/dhparam.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/dhparam.c b/apps/dhparam.c
index 982b2db549..6b8546e93b 100644
--- a/apps/dhparam.c
+++ b/apps/dhparam.c
@@ -383,7 +383,7 @@ static EVP_PKEY *dsa_to_dh(EVP_PKEY *dh)
ctx = EVP_PKEY_CTX_new_from_name(NULL, "DHX", NULL);
if (ctx == NULL
- || !EVP_PKEY_fromdata_init(ctx)
+ || EVP_PKEY_fromdata_init(ctx) <= 0
|| !EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_KEY_PARAMETERS, params)) {
BIO_printf(bio_err, "Error, failed to set DH parameters\n");
goto err;