From: Pauli Date: Thu, 24 Jul 2025 01:24:00 +0000 (+1000) Subject: file_store_any: convert to using generated param decoder X-Git-Tag: openssl-3.6.0-alpha1~153 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0247b0ada1c7c849b4172c515c1c8861997f8fee;p=thirdparty%2Fopenssl.git file_store_any: convert 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/28147) --- diff --git a/providers/implementations/storemgmt/file_store_any2obj.c.in b/providers/implementations/storemgmt/file_store_any2obj.c.in index 3194b0d8edf..eef6f6f03ca 100644 --- a/providers/implementations/storemgmt/file_store_any2obj.c.in +++ b/providers/implementations/storemgmt/file_store_any2obj.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); +-} /* * This is a decoder that's completely internal to the 'file:' store @@ -30,6 +33,8 @@ #include #include #include +#include +#include "internal/cryptlib.h" #include #include "internal/asn1.h" #include "internal/sizes.h" @@ -65,16 +70,23 @@ static void any2obj_freectx(void *ctx) OPENSSL_free(ctx); } +{- produce_param_decoder('any2obj_set_ctx_params', + (['OBJECT_PARAM_DATA_STRUCTURE', 'datastruct', 'utf8_string'], + )); -} + static int any2obj_set_ctx_params(void *vctx, const OSSL_PARAM params[]) { struct any2obj_ctx_st *ctx = vctx; - const OSSL_PARAM *p; + struct any2obj_set_ctx_params_st p; char *str; - p = OSSL_PARAM_locate_const(params, OSSL_OBJECT_PARAM_DATA_STRUCTURE); + if (ctx == NULL || !any2obj_set_ctx_params_decoder(params, &p)) + return 0; + str = ctx->data_structure; - if (p != NULL - && !OSSL_PARAM_get_utf8_string(p, &str, sizeof(ctx->data_structure))) + if (p.datastruct != NULL + && !OSSL_PARAM_get_utf8_string(p.datastruct, &str, + sizeof(ctx->data_structure))) return 0; return 1; @@ -82,11 +94,7 @@ static int any2obj_set_ctx_params(void *vctx, const OSSL_PARAM params[]) static const OSSL_PARAM *any2obj_settable_ctx_params(ossl_unused void *provctx) { - static const OSSL_PARAM settables[] = { - OSSL_PARAM_utf8_string(OSSL_OBJECT_PARAM_DATA_STRUCTURE, NULL, 0), - OSSL_PARAM_END - }; - return settables; + return any2obj_set_ctx_params_list; } static int any2obj_decode_final(void *vctx, int objtype, const char *input_type,