From a76ccb9d0ddc24f6551afbc220b41fb3c4e64c6a Mon Sep 17 00:00:00 2001 From: slontis Date: Wed, 22 Feb 2023 14:16:05 +1000 Subject: FFC cleanups Discovered during coverage testing. Remove unneccesary check when using ossl_dh_get0_params() and ossl_dsa_get0_params(). These point to addresses and can not fail for any existing calls. Make dsa keygen tests only available in the FIPS module - as they are not used in the default provider. Change ossl_ffc_set_digest() to return void as it cannot fail. Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/20359) --- providers/implementations/keymgmt/dh_kmgmt.c | 6 ++---- providers/implementations/keymgmt/dsa_kmgmt.c | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'providers') diff --git a/providers/implementations/keymgmt/dh_kmgmt.c b/providers/implementations/keymgmt/dh_kmgmt.c index 2ca12df442..1de182ce6f 100644 --- a/providers/implementations/keymgmt/dh_kmgmt.c +++ b/providers/implementations/keymgmt/dh_kmgmt.c @@ -735,10 +735,8 @@ static void *dh_gen(void *genctx, OSSL_CALLBACK *osslcb, void *cbarg) } else if (gctx->hindex != 0) { ossl_ffc_params_set_h(ffc, gctx->hindex); } - if (gctx->mdname != NULL) { - if (!ossl_ffc_set_digest(ffc, gctx->mdname, gctx->mdprops)) - goto end; - } + if (gctx->mdname != NULL) + ossl_ffc_set_digest(ffc, gctx->mdname, gctx->mdprops); gctx->cb = osslcb; gctx->cbarg = cbarg; gencb = BN_GENCB_new(); diff --git a/providers/implementations/keymgmt/dsa_kmgmt.c b/providers/implementations/keymgmt/dsa_kmgmt.c index 881680c085..24316028b5 100644 --- a/providers/implementations/keymgmt/dsa_kmgmt.c +++ b/providers/implementations/keymgmt/dsa_kmgmt.c @@ -587,10 +587,9 @@ static void *dsa_gen(void *genctx, OSSL_CALLBACK *osslcb, void *cbarg) } else if (gctx->hindex != 0) { ossl_ffc_params_set_h(ffc, gctx->hindex); } - if (gctx->mdname != NULL) { - if (!ossl_ffc_set_digest(ffc, gctx->mdname, gctx->mdprops)) - goto end; - } + if (gctx->mdname != NULL) + ossl_ffc_set_digest(ffc, gctx->mdname, gctx->mdprops); + if ((gctx->selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0) { if (ossl_dsa_generate_ffc_parameters(dsa, gctx->gen_type, -- cgit v1.2.1