Fix the checks of EVP_PKEY_param_check
authorPeiwei Hu <jlu.hpw@foxmail.com>
Sat, 28 May 2022 16:05:28 +0000 (00:05 +0800)
committerTodd Short <todd.short@me.com>
Thu, 2 Jun 2022 14:36:56 +0000 (10:36 -0400)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/18424)

apps/dhparam.c
apps/ecparam.c

index 764f7929d462e4f269606105ab90b0dbcb603815..c1d7168a6089d223912f4c0376972cbb67108e1a 100644 (file)
@@ -329,7 +329,7 @@ int dhparam_main(int argc, char **argv)
             BIO_printf(bio_err, "Error, failed to check DH parameters\n");
             goto end;
         }
-        if (!EVP_PKEY_param_check(ctx)) {
+        if (EVP_PKEY_param_check(ctx) <= 0) {
             BIO_printf(bio_err, "Error, invalid parameters generated\n");
             goto end;
         }
index 7ee19349dc4cb7ab6bbb8407c7ff4d8ab2f7d78c..608014be8f13e470bdebd219bdaa79781c1353e8 100644 (file)
@@ -283,7 +283,7 @@ int ecparam_main(int argc, char **argv)
                 goto end;
         }
         pctx = EVP_PKEY_CTX_new_from_pkey(NULL, params_key, NULL);
-        if (pctx == NULL || !EVP_PKEY_param_check(pctx)) {
+        if (pctx == NULL || EVP_PKEY_param_check(pctx) <= 0) {
             BIO_printf(bio_err, "failed\n");
             goto end;
         }