summaryrefslogtreecommitdiffstats
path: root/crypto/ffc
diff options
context:
space:
mode:
authorslontis <shane.lontis@oracle.com>2023-02-22 14:16:05 +1000
committerTomas Mraz <tomas@openssl.org>2023-04-03 10:31:04 +0200
commita76ccb9d0ddc24f6551afbc220b41fb3c4e64c6a (patch)
tree93935d36fb68f37c5f3ad61797ba69d6a0cc756a /crypto/ffc
parenteb52450f5151e8e78743ab05de21a344823316f5 (diff)
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 <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20359)
Diffstat (limited to 'crypto/ffc')
-rw-r--r--crypto/ffc/ffc_backend.c12
-rw-r--r--crypto/ffc/ffc_params.c9
2 files changed, 4 insertions, 17 deletions
diff --git a/crypto/ffc/ffc_backend.c b/crypto/ffc/ffc_backend.c
index 01982bd6af..954efb27bb 100644
--- a/crypto/ffc/ffc_backend.c
+++ b/crypto/ffc/ffc_backend.c
@@ -24,9 +24,6 @@ int ossl_ffc_params_fromdata(FFC_PARAMS *ffc, const OSSL_PARAM params[])
BIGNUM *p = NULL, *q = NULL, *g = NULL, *j = NULL;
int i;
- if (ffc == NULL)
- return 0;
-
prm = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_GROUP_NAME);
if (prm != NULL) {
/*
@@ -76,9 +73,8 @@ int ossl_ffc_params_fromdata(FFC_PARAMS *ffc, const OSSL_PARAM params[])
}
prm = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_FFC_SEED);
if (prm != NULL) {
- if (prm->data_type != OSSL_PARAM_OCTET_STRING)
- goto err;
- if (!ossl_ffc_params_set_seed(ffc, prm->data, prm->data_size))
+ if (prm->data_type != OSSL_PARAM_OCTET_STRING
+ || !ossl_ffc_params_set_seed(ffc, prm->data, prm->data_size))
goto err;
}
prm = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_FFC_VALIDATE_PQ);
@@ -113,10 +109,8 @@ int ossl_ffc_params_fromdata(FFC_PARAMS *ffc, const OSSL_PARAM params[])
goto err;
props = p1->data;
}
- if (!ossl_ffc_set_digest(ffc, prm->data, props))
- goto err;
+ ossl_ffc_set_digest(ffc, prm->data, props);
}
-
ossl_ffc_params_set0_pqg(ffc, p, q, g);
ossl_ffc_params_set0_j(ffc, j);
return 1;
diff --git a/crypto/ffc/ffc_params.c b/crypto/ffc/ffc_params.c
index 647d356eca..54068cbd9e 100644
--- a/crypto/ffc/ffc_params.c
+++ b/crypto/ffc/ffc_params.c
@@ -75,9 +75,6 @@ void ossl_ffc_params_set0_j(FFC_PARAMS *d, BIGNUM *j)
int ossl_ffc_params_set_seed(FFC_PARAMS *params,
const unsigned char *seed, size_t seedlen)
{
- if (params == NULL)
- return 0;
-
if (params->seed != NULL) {
if (params->seed == seed)
return 1;
@@ -125,11 +122,10 @@ void ossl_ffc_params_enable_flags(FFC_PARAMS *params, unsigned int flags,
params->flags &= ~flags;
}
-int ossl_ffc_set_digest(FFC_PARAMS *params, const char *alg, const char *props)
+void ossl_ffc_set_digest(FFC_PARAMS *params, const char *alg, const char *props)
{
params->mdname = alg;
params->mdprops = props;
- return 1;
}
int ossl_ffc_params_set_validate_params(FFC_PARAMS *params,
@@ -214,9 +210,6 @@ int ossl_ffc_params_todata(const FFC_PARAMS *ffc, OSSL_PARAM_BLD *bld,
{
int test_flags;
- if (ffc == NULL)
- return 0;
-
if (ffc->p != NULL
&& !ossl_param_build_set_bn(bld, params, OSSL_PKEY_PARAM_FFC_P, ffc->p))
return 0;