From: Pauli Date: Wed, 30 Jul 2025 02:31:55 +0000 (+1000) Subject: decode_pvk2key: convert to use generated parameter parsing X-Git-Tag: openssl-3.6.0-alpha1~133 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f9a5796357688ae75730933e9ad590c1a8fbae82;p=thirdparty%2Fopenssl.git decode_pvk2key: convert to use generated parameter parsing Reviewed-by: Paul Yang Reviewed-by: Shane Lontis Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/28152) --- diff --git a/providers/implementations/encode_decode/decode_pvk2key.c.in b/providers/implementations/encode_decode/decode_pvk2key.c.in index 57685b2e9f7..f0f5fbe7a9b 100644 --- a/providers/implementations/encode_decode/decode_pvk2key.c.in +++ b/providers/implementations/encode_decode/decode_pvk2key.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); +-} /* * low level APIs are deprecated for public use, but still ok for @@ -21,8 +24,10 @@ #include #include #include +#include #include /* For public PVK functions */ #include +#include "internal/cryptlib.h" #include "internal/passphrase.h" #include "internal/sizes.h" #include "crypto/pem.h" /* For internal PVK and "blob" headers */ @@ -83,23 +88,27 @@ static void pvk2key_freectx(void *vctx) OPENSSL_free(ctx); } +{- produce_param_decoder('pvk2key_set_ctx_params', + (['DECODER_PARAM_PROPERTIES', 'propq', 'utf8_string'], + )); -} + static const OSSL_PARAM *pvk2key_settable_ctx_params(ossl_unused void *provctx) { - static const OSSL_PARAM settables[] = { - OSSL_PARAM_utf8_string(OSSL_DECODER_PARAM_PROPERTIES, NULL, 0), - OSSL_PARAM_END, - }; - return settables; + return pvk2key_set_ctx_params_list; } static int pvk2key_set_ctx_params(void *vctx, const OSSL_PARAM params[]) { struct pvk2key_ctx_st *ctx = vctx; - const OSSL_PARAM *p; - char *str = ctx->propq; + struct pvk2key_set_ctx_params_st p; + char *str; + + if (ctx == NULL || !pvk2key_set_ctx_params_decoder(params, &p)) + return 0; - p = OSSL_PARAM_locate_const(params, OSSL_DECODER_PARAM_PROPERTIES); - if (p != NULL && !OSSL_PARAM_get_utf8_string(p, &str, sizeof(ctx->propq))) + str = ctx->propq; + if (p.propq != NULL + && !OSSL_PARAM_get_utf8_string(p.propq, &str, sizeof(ctx->propq))) return 0; return 1;