]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
decode_epki2pki: convert to use generated parameter parsing
authorPauli <ppzgs1@gmail.com>
Wed, 30 Jul 2025 02:31:55 +0000 (12:31 +1000)
committerPauli <ppzgs1@gmail.com>
Wed, 13 Aug 2025 02:10:58 +0000 (12:10 +1000)
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28152)

providers/implementations/encode_decode/decode_epki2pki.c.in

index a5c116a9cf79daabbcf06bf5dc6f4b071c8f01dc..3e684a8cfe02fec4dc19cd7469421e40c467546b 100644 (file)
@@ -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 <openssl/core.h>
 #include <openssl/core_dispatch.h>
@@ -17,6 +20,7 @@
 #include <openssl/pkcs12.h>
 #include <openssl/x509.h>
 #include <openssl/proverr.h>
+#include "internal/cryptlib.h"
 #include "internal/asn1.h"
 #include "internal/sizes.h"
 #include "prov/bio.h"
@@ -54,23 +58,27 @@ static void epki2pki_freectx(void *vctx)
     OPENSSL_free(ctx);
 }
 
+{- produce_param_decoder('epki2pki_set_ctx_params',
+                         (['DECODER_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+                         )); -}
+
 static const OSSL_PARAM *epki2pki_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 epki2pki_set_ctx_params_list;
 }
 
 static int epki2pki_set_ctx_params(void *vctx, const OSSL_PARAM params[])
 {
     struct epki2pki_ctx_st *ctx = vctx;
-    const OSSL_PARAM *p;
-    char *str = ctx->propq;
+    struct epki2pki_set_ctx_params_st p;
+    char *str;
+
+    if (ctx == NULL || !epki2pki_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;