From f5ea81843a7b5509fa6a627f72d0ef3e95ba5368 Mon Sep 17 00:00:00 2001 From: Pauli Date: Thu, 28 Aug 2025 14:47:52 +1000 Subject: [PATCH 1/5] hkdf: avoid using ossl_prov_digest_load_from_params() --- providers/implementations/kdfs/hkdf.c.in | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/providers/implementations/kdfs/hkdf.c.in b/providers/implementations/kdfs/hkdf.c.in index 3241f3fee3549..98a2bd3fa5aaf 100644 --- a/providers/implementations/kdfs/hkdf.c.in +++ b/providers/implementations/kdfs/hkdf.c.in @@ -501,16 +501,15 @@ static void *kdf_hkdf_fixed_digest_new(void *provctx, const char *digest) { OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(provctx); KDF_HKDF *ctx; - OSSL_PARAM params[2]; + OSSL_PARAM param; ctx = kdf_hkdf_new(provctx); if (ctx == NULL) return NULL; - params[0] = OSSL_PARAM_construct_utf8_string(OSSL_ALG_PARAM_DIGEST, - (char *)digest, 0); - params[1] = OSSL_PARAM_construct_end(); - if (!ossl_prov_digest_load_from_params(&ctx->digest, params, libctx)) { + param = OSSL_PARAM_construct_utf8_string(OSSL_ALG_PARAM_DIGEST, + (char *)digest, 0); + if (!ossl_prov_digest_load(&ctx->digest, ¶m, NULL, NULL, libctx)) { kdf_hkdf_free(ctx); return NULL; } From 4c310aab3fea3e6d5fbaa3a6f7be7d535a431e33 Mon Sep 17 00:00:00 2001 From: Pauli Date: Thu, 28 Aug 2025 14:48:10 +1000 Subject: [PATCH 2/5] pbkdf2: avoid using ossl_prov_digest_load_from_params() --- providers/implementations/kdfs/pbkdf2.c.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/providers/implementations/kdfs/pbkdf2.c.in b/providers/implementations/kdfs/pbkdf2.c.in index 10175614d843b..592a5cd15f56a 100644 --- a/providers/implementations/kdfs/pbkdf2.c.in +++ b/providers/implementations/kdfs/pbkdf2.c.in @@ -151,12 +151,12 @@ static void *kdf_pbkdf2_dup(void *vctx) static void kdf_pbkdf2_init(KDF_PBKDF2 *ctx) { - OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END }; + OSSL_PARAM param; OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx); - params[0] = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST, - SN_sha1, 0); - if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx)) + param = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST, + SN_sha1, 0); + if (!ossl_prov_digest_load(&ctx->digest, ¶m, NULL, NULL, provctx)) /* This is an error, but there is no way to indicate such directly */ ossl_prov_digest_reset(&ctx->digest); ctx->iter = PKCS5_DEFAULT_ITER; From bc423d3b06946633739940e319f8a5eae418389a Mon Sep 17 00:00:00 2001 From: Pauli Date: Thu, 28 Aug 2025 14:48:31 +1000 Subject: [PATCH 3/5] pvkkdf: avoid using ossl_prov_digest_load_from_params() --- providers/implementations/kdfs/pvkkdf.c.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/providers/implementations/kdfs/pvkkdf.c.in b/providers/implementations/kdfs/pvkkdf.c.in index f4f4baeff84fa..dc7bfe061bb6e 100644 --- a/providers/implementations/kdfs/pvkkdf.c.in +++ b/providers/implementations/kdfs/pvkkdf.c.in @@ -108,12 +108,12 @@ static void kdf_pvk_reset(void *vctx) static void kdf_pvk_init(KDF_PVK *ctx) { - OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END }; + OSSL_PARAM param; OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx); - params[0] = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST, - SN_sha1, 0); - if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx)) + param = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST, + SN_sha1, 0); + if (!ossl_prov_digest_load(&ctx->digest, ¶m, NULL, NULL, provctx)) /* This is an error, but there is no way to indicate such directly */ ossl_prov_digest_reset(&ctx->digest); } From 2b3835b2eb40a8639ad836dd2c90ba6bd6f97a18 Mon Sep 17 00:00:00 2001 From: Pauli Date: Thu, 28 Aug 2025 14:48:51 +1000 Subject: [PATCH 4/5] kmac: avoid using ossl_prov_digest_load_from_params() --- providers/implementations/macs/kmac_prov.c.in | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/providers/implementations/macs/kmac_prov.c.in b/providers/implementations/macs/kmac_prov.c.in index 1944be266fe13..f00a3a28fe45f 100644 --- a/providers/implementations/macs/kmac_prov.c.in +++ b/providers/implementations/macs/kmac_prov.c.in @@ -189,15 +189,24 @@ static struct kmac_data_st *kmac_new(void *provctx) return kctx; } +#define kmac_new_list + +{- produce_param_decoder('kmac_new', + (['MAC_PARAM_DIGEST', 'digest', 'utf8_string'], + ['MAC_PARAM_PROPERTIES', 'propq', 'utf8_string'], + ['ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'], + )); -} + static void *kmac_fetch_new(void *provctx, const OSSL_PARAM *params) { struct kmac_data_st *kctx = kmac_new(provctx); + struct kmac_new_st p; int md_size; - if (kctx == NULL) + if (kctx == NULL || !kmac_new_decoder(params, &p)) return 0; - if (!ossl_prov_digest_load_from_params(&kctx->digest, params, - PROV_LIBCTX_OF(provctx))) { + if (!ossl_prov_digest_load(&kctx->digest, p.digest, p.propq, p.engine, + PROV_LIBCTX_OF(provctx))) { kmac_free(kctx); return 0; } From cdf5bb5f58ca5087b4de7ba31069147ce3b661f3 Mon Sep 17 00:00:00 2001 From: Pauli Date: Thu, 28 Aug 2025 14:48:59 +1000 Subject: [PATCH 5/5] remove ossl_prov_digest_load_from_params() This is no longer used or needed and is internal, so away it goes. --- providers/common/include/prov/provider_util.h | 5 +---- providers/common/provider_util.c | 11 ----------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/providers/common/include/prov/provider_util.h b/providers/common/include/prov/provider_util.h index 8c0e29d17c0e2..4060992b4a09b 100644 --- a/providers/common/include/prov/provider_util.h +++ b/providers/common/include/prov/provider_util.h @@ -71,13 +71,10 @@ const EVP_MD *ossl_prov_digest_fetch(PROV_DIGEST *pd, OSSL_LIB_CTX *libctx, /* * Load a digest from the specified parameters with the specified context. - * The params "properties", "engine" and "digest" are used to determine the + * The params "propq", "engine" and "digest" are used to determine the * implementation used. If a provider cannot be found, it falls back to trying * non-provider based implementations. */ -int ossl_prov_digest_load_from_params(PROV_DIGEST *pd, - const OSSL_PARAM params[], - OSSL_LIB_CTX *ctx); int ossl_prov_digest_load(PROV_DIGEST *pd,const OSSL_PARAM *digest, const OSSL_PARAM *propq, const OSSL_PARAM *engine, OSSL_LIB_CTX *ctx); diff --git a/providers/common/provider_util.c b/providers/common/provider_util.c index 742f6dab3d15d..40b1aa81bed48 100644 --- a/providers/common/provider_util.c +++ b/providers/common/provider_util.c @@ -212,17 +212,6 @@ int ossl_prov_digest_load(PROV_DIGEST *pd, const OSSL_PARAM *digest, return pd->md != NULL; } -int ossl_prov_digest_load_from_params(PROV_DIGEST *pd, - const OSSL_PARAM params[], - OSSL_LIB_CTX *ctx) -{ - return ossl_prov_digest_load(pd, - OSSL_PARAM_locate_const(params, OSSL_ALG_PARAM_DIGEST), - OSSL_PARAM_locate_const(params, OSSL_ALG_PARAM_PROPERTIES), - OSSL_PARAM_locate_const(params, OSSL_ALG_PARAM_ENGINE), - ctx); -} - void ossl_prov_digest_set_md(PROV_DIGEST *pd, EVP_MD *md) { ossl_prov_digest_reset(pd);