Fix the checks of EVP_PKEY_param_check

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)
This commit is contained in:
Peiwei Hu 2022-05-29 00:05:28 +08:00 committed by Todd Short
parent 5755c11fd6
commit e85bef981c
2 changed files with 2 additions and 2 deletions

View 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;
}

View 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;
}