From: Pauli Date: Thu, 24 Jul 2025 01:23:47 +0000 (+1000) Subject: win store: convert to using generated param decoder X-Git-Tag: openssl-3.6.0-alpha1~154 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6218a0a82292cf1b4e84d7c3f409dc94004067b9;p=thirdparty%2Fopenssl.git win store: 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/winstore_store.c.in b/providers/implementations/storemgmt/winstore_store.c.in index e94fd93a58a..7953a9ae835 100644 --- a/providers/implementations/storemgmt/winstore_store.c.in +++ b/providers/implementations/storemgmt/winstore_store.c.in @@ -6,6 +6,10 @@ * 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 #include @@ -104,40 +108,38 @@ static void *winstore_attach(void *provctx, OSSL_CORE_BIO *cin) return NULL; /* not supported */ } +{- produce_param_decoder('winstore_set_ctx_params', + (['STORE_PARAM_SUBJECT', 'sub', 'octet_string'], + ['STORE_PARAM_PROPERTIES', 'propq', 'utf8_string'], + )); -} + static const OSSL_PARAM *winstore_settable_ctx_params(void *loaderctx, const OSSL_PARAM params[]) { - static const OSSL_PARAM known_settable_ctx_params[] = { - OSSL_PARAM_octet_string(OSSL_STORE_PARAM_SUBJECT, NULL, 0), - OSSL_PARAM_utf8_string(OSSL_STORE_PARAM_PROPERTIES, NULL, 0), - OSSL_PARAM_END - }; - return known_settable_ctx_params; + return winstore_set_ctx_params_list; } static int winstore_set_ctx_params(void *loaderctx, const OSSL_PARAM params[]) { struct winstore_ctx_st *ctx = loaderctx; - const OSSL_PARAM *p; + struct winstore_set_ctx_params_st p; int do_reset = 0; - if (ossl_param_is_empty(params)) - return 1; + if (ctx == NULL || !winstore_set_ctx_params_decoder(params, &p)) + return 0; - p = OSSL_PARAM_locate_const(params, OSSL_STORE_PARAM_PROPERTIES); - if (p != NULL) { + if (p.propq != NULL) { do_reset = 1; OPENSSL_free(ctx->propq); ctx->propq = NULL; - if (!OSSL_PARAM_get_utf8_string(p, &ctx->propq, 0)) + if (!OSSL_PARAM_get_utf8_string(p.propq, &ctx->propq, 0)) return 0; } - p = OSSL_PARAM_locate_const(params, OSSL_STORE_PARAM_SUBJECT); - if (p != NULL) { + if (p.sub != NULL) { const unsigned char *der = NULL; size_t der_len = 0; - if (!OSSL_PARAM_get_octet_string_ptr(p, (const void **)&der, &der_len)) + if (!OSSL_PARAM_get_octet_string_ptr(p.sub, (const void **)&der, &der_len)) return 0; do_reset = 1;