From: Pauli Date: Thu, 24 Jul 2025 02:01:03 +0000 (+1000) Subject: ecx: convert key exchange to using generated param decoder X-Git-Tag: openssl-3.6.0-alpha1~149 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=213135a758c2914ce1c983b1feb89f28f2082400;p=thirdparty%2Fopenssl.git ecx: convert key exchange to using generated param decoder Reviewed-by: Paul Yang Reviewed-by: Shane Lontis Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/28148) --- diff --git a/providers/implementations/exchange/ecx_exch.c.in b/providers/implementations/exchange/ecx_exch.c.in index 28e2ff61c7c..a1efcf7253e 100644 --- a/providers/implementations/exchange/ecx_exch.c.in +++ b/providers/implementations/exchange/ecx_exch.c.in @@ -6,6 +6,9 @@ * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ +{- +use OpenSSL::paramnames qw(produce_param_decoder); +-} #include #include @@ -177,24 +180,34 @@ static void *ecx_dupctx(void *vecxctx) return dstctx; } +#ifdef FIPS_MODULE +{- produce_param_decoder('ecx_get_ctx_params', + (['ALG_PARAM_FIPS_APPROVED_INDICATOR', 'ind', 'int'], + )); -} +#endif + static const OSSL_PARAM *ecx_gettable_ctx_params(ossl_unused void *vctx, ossl_unused void *provctx) { - static const OSSL_PARAM known_gettable_ctx_params[] = { - OSSL_FIPS_IND_GETTABLE_CTX_PARAM() - OSSL_PARAM_END - }; - return known_gettable_ctx_params; +#ifdef FIPS_MODULE + return ecx_get_ctx_params_list; +#else + static OSSL_PARAM params[] = { OSSL_PARAM_END }; + + return params; +#endif } static int ecx_get_ctx_params(ossl_unused void *vctx, OSSL_PARAM params[]) { #ifdef FIPS_MODULE int approved = 0; - OSSL_PARAM *p = OSSL_PARAM_locate(params, - OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR); + struct ecx_get_ctx_params_st p; + + if (vctx == NULL || !ecx_get_ctx_params_decoder(params, &p)) + return 0; - if (p != NULL && !OSSL_PARAM_set_int(p, approved)) + if (p.ind != NULL && !OSSL_PARAM_set_int(p.ind, approved)) return 0; #endif return 1;