]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
signature: Use include file for generated code
authorSimo Sorce <simo@redhat.com>
Thu, 16 Oct 2025 19:48:09 +0000 (15:48 -0400)
committerDmitry Belyavskiy <beldmit@gmail.com>
Mon, 20 Oct 2025 07:45:54 +0000 (09:45 +0200)
Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28838)

16 files changed:
.gitignore
build.info
providers/implementations/signature/dsa_sig.c [moved from providers/implementations/signature/dsa_sig.c.in with 95% similarity]
providers/implementations/signature/dsa_sig.inc.in [new file with mode: 0644]
providers/implementations/signature/ecdsa_sig.c [moved from providers/implementations/signature/ecdsa_sig.c.in with 94% similarity]
providers/implementations/signature/ecdsa_sig.inc.in [new file with mode: 0644]
providers/implementations/signature/eddsa_sig.c [moved from providers/implementations/signature/eddsa_sig.c.in with 98% similarity]
providers/implementations/signature/eddsa_sig.inc.in [new file with mode: 0644]
providers/implementations/signature/ml_dsa_sig.c [moved from providers/implementations/signature/ml_dsa_sig.c.in with 92% similarity]
providers/implementations/signature/ml_dsa_sig.inc.in [new file with mode: 0644]
providers/implementations/signature/rsa_sig.c [moved from providers/implementations/signature/rsa_sig.c.in with 95% similarity]
providers/implementations/signature/rsa_sig.inc.in [new file with mode: 0644]
providers/implementations/signature/slh_dsa_sig.c [moved from providers/implementations/signature/slh_dsa_sig.c.in with 95% similarity]
providers/implementations/signature/slh_dsa_sig.inc.in [new file with mode: 0644]
providers/implementations/signature/sm2_sig.c [moved from providers/implementations/signature/sm2_sig.c.in with 95% similarity]
providers/implementations/signature/sm2_sig.inc.in [new file with mode: 0644]

index 918ecc7da443e00db8e965bc79ae407508bb4225..129335aa443f47463a230dd06bc59f19dcad985e 100644 (file)
@@ -119,8 +119,8 @@ providers/implementations/kem/rsa_kem.inc
 providers/implementations/keymgmt/ml_dsa_kmgmt.inc
 providers/implementations/keymgmt/ml_kem_kmgmt.inc
 providers/implementations/keymgmt/mlx_kmgmt.inc
-providers/implementations/signature/dsa_sig.c
-providers/implementations/signature/ecdsa_sig.c
+providers/implementations/signature/dsa_sig.inc
+providers/implementations/signature/ecdsa_sig.inc
 providers/implementations/keymgmt/dh_kmgmt.inc
 providers/implementations/keymgmt/dsa_kmgmt.inc
 providers/implementations/keymgmt/ecx_kmgmt.inc
@@ -131,11 +131,11 @@ providers/implementations/keymgmt/ml_kem_kmgmt.inc
 providers/implementations/keymgmt/mlx_kmgmt.inc
 providers/implementations/keymgmt/slh_dsa_kmgmt.inc
 providers/implementations/keymgmt/template_kmgmt.inc
-providers/implementations/signature/eddsa_sig.c
-providers/implementations/signature/ml_dsa_sig.c
-providers/implementations/signature/rsa_sig.c
-providers/implementations/signature/slh_dsa_sig.c
-providers/implementations/signature/sm2_sig.c
+providers/implementations/signature/eddsa_sig.inc
+providers/implementations/signature/ml_dsa_sig.inc
+providers/implementations/signature/rsa_sig.inc
+providers/implementations/signature/slh_dsa_sig.inc
+providers/implementations/signature/sm2_sig.inc
 providers/implementations/skeymgmt/generic.inc
 providers/implementations/storemgmt/file_store_any2obj.inc
 providers/implementations/storemgmt/file_store.inc
index 149e3c46f2069ce182ca7e1ff339e00b29b650dd..92b698ab1382d27e8c07da6df1f0222924aa2ebd 100644 (file)
@@ -88,13 +88,13 @@ DEPEND[]=include/openssl/asn1.h \
          providers/implementations/keymgmt/mlx_kmgmt.inc \
          providers/implementations/keymgmt/slh_dsa_kmgmt.inc \
          providers/implementations/keymgmt/template_kmgmt.inc \
-         providers/implementations/signature/dsa_sig.c \
-         providers/implementations/signature/ecdsa_sig.c \
-         providers/implementations/signature/eddsa_sig.c \
-         providers/implementations/signature/ml_dsa_sig.c \
-         providers/implementations/signature/rsa_sig.c \
-         providers/implementations/signature/slh_dsa_sig.c \
-         providers/implementations/signature/sm2_sig.c \
+         providers/implementations/signature/dsa_sig.inc \
+         providers/implementations/signature/ecdsa_sig.inc \
+         providers/implementations/signature/eddsa_sig.inc \
+         providers/implementations/signature/ml_dsa_sig.inc \
+         providers/implementations/signature/rsa_sig.inc \
+         providers/implementations/signature/slh_dsa_sig.inc \
+         providers/implementations/signature/sm2_sig.inc \
          providers/implementations/skeymgmt/generic.inc \
          providers/implementations/storemgmt/file_store_any2obj.inc \
          providers/implementations/storemgmt/file_store.inc \
@@ -206,13 +206,13 @@ DEPEND[providers/implementations/asymciphers/rsa_enc.inc \
        providers/implementations/keymgmt/mlx_kmgmt.inc \
        providers/implementations/keymgmt/slh_dsa_kmgmt.inc \
        providers/implementations/keymgmt/template_kmgmt.inc \
-       providers/implementations/signature/dsa_sig.c \
-       providers/implementations/signature/ecdsa_sig.c \
-       providers/implementations/signature/eddsa_sig.c \
-       providers/implementations/signature/ml_dsa_sig.c \
-       providers/implementations/signature/rsa_sig.c \
-       providers/implementations/signature/slh_dsa_sig.c \
-       providers/implementations/signature/sm2_sig.c \
+       providers/implementations/signature/dsa_sig.inc \
+       providers/implementations/signature/ecdsa_sig.inc \
+       providers/implementations/signature/eddsa_sig.inc \
+       providers/implementations/signature/ml_dsa_sig.inc \
+       providers/implementations/signature/rsa_sig.inc \
+       providers/implementations/signature/slh_dsa_sig.inc \
+       providers/implementations/signature/sm2_sig.inc \
        providers/implementations/skeymgmt/generic.inc \
        providers/implementations/storemgmt/file_store_any2obj.inc \
        providers/implementations/storemgmt/file_store.inc \
@@ -331,20 +331,20 @@ GENERATE[providers/implementations/keymgmt/slh_dsa_kmgmt.inc]=\
     providers/implementations/keymgmt/slh_dsa_kmgmt.inc.in
 GENERATE[providers/implementations/keymgmt/template_kmgmt.inc]=\
     providers/implementations/keymgmt/template_kmgmt.inc.in
-GENERATE[providers/implementations/signature/dsa_sig.c]=\
-    providers/implementations/signature/dsa_sig.c.in
-GENERATE[providers/implementations/signature/ecdsa_sig.c]=\
-    providers/implementations/signature/ecdsa_sig.c.in
-GENERATE[providers/implementations/signature/eddsa_sig.c]=\
-    providers/implementations/signature/eddsa_sig.c.in
-GENERATE[providers/implementations/signature/ml_dsa_sig.c]=\
-    providers/implementations/signature/ml_dsa_sig.c.in
-GENERATE[providers/implementations/signature/rsa_sig.c]=\
-    providers/implementations/signature/rsa_sig.c.in
-GENERATE[providers/implementations/signature/slh_dsa_sig.c]=\
-    providers/implementations/signature/slh_dsa_sig.c.in
-GENERATE[providers/implementations/signature/sm2_sig.c]=\
-    providers/implementations/signature/sm2_sig.c.in
+GENERATE[providers/implementations/signature/dsa_sig.inc]=\
+    providers/implementations/signature/dsa_sig.inc.in
+GENERATE[providers/implementations/signature/ecdsa_sig.inc]=\
+    providers/implementations/signature/ecdsa_sig.inc.in
+GENERATE[providers/implementations/signature/eddsa_sig.inc]=\
+    providers/implementations/signature/eddsa_sig.inc.in
+GENERATE[providers/implementations/signature/ml_dsa_sig.inc]=\
+    providers/implementations/signature/ml_dsa_sig.inc.in
+GENERATE[providers/implementations/signature/rsa_sig.inc]=\
+    providers/implementations/signature/rsa_sig.inc.in
+GENERATE[providers/implementations/signature/slh_dsa_sig.inc]=\
+    providers/implementations/signature/slh_dsa_sig.inc.in
+GENERATE[providers/implementations/signature/sm2_sig.inc]=\
+    providers/implementations/signature/sm2_sig.inc.in
 GENERATE[providers/implementations/skeymgmt/generic.inc]=\
     providers/implementations/skeymgmt/generic.inc.in
 GENERATE[providers/implementations/storemgmt/file_store_any2obj.inc]=\
similarity index 95%
rename from providers/implementations/signature/dsa_sig.c.in
rename to providers/implementations/signature/dsa_sig.c
index b208992ee193306b145ab80c7d9ab0190d6dff38..ab76bbe5dbaebfe4526c88f19776dd5d21c995b5 100644 (file)
@@ -6,9 +6,6 @@
  * in the file LICENSE in the source distribution or at
  * https://www.openssl.org/source/license.html
  */
-{-
-use OpenSSL::paramnames qw(produce_param_decoder);
--}
 
 /*
  * DSA low level APIs are deprecated for public use, but still ok for
@@ -672,12 +669,22 @@ static void *dsa_dupctx(void *vpdsactx)
     return NULL;
 }
 
-{- produce_param_decoder('dsa_get_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_ALGORITHM_ID',            'algid',  'octet_string'],
-                          ['OSSL_SIGNATURE_PARAM_DIGEST',                  'digest', 'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_NONCE_TYPE',              'nonce',  'uint'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_APPROVED_INDICATOR', 'ind',    'int', 'fips'],
-                         )); -}
+struct dsa_all_set_ctx_params_st {
+    OSSL_PARAM *digest;     /* dsa_set_ctx_params */
+    OSSL_PARAM *propq;      /* dsa_set_ctx_params */
+#ifdef FIPS_MODULE
+    OSSL_PARAM *ind_d;
+    OSSL_PARAM *ind_k;
+    OSSL_PARAM *ind_sign;
+#endif
+    OSSL_PARAM *nonce;
+    OSSL_PARAM *sig;        /* dsa_sigalg_set_ctx_params */
+};
+
+#define dsa_set_ctx_params_st dsa_all_set_ctx_params_st
+#define dsa_sigalg_set_ctx_params_st dsa_all_set_ctx_params_st
+
+#include "providers/implementations/signature/dsa_sig.inc"
 
 static int dsa_get_ctx_params(void *vpdsactx, OSSL_PARAM *params)
 {
@@ -711,18 +718,6 @@ static const OSSL_PARAM *dsa_gettable_ctx_params(ossl_unused void *ctx,
     return dsa_get_ctx_params_list;
 }
 
-struct dsa_all_set_ctx_params_st {
-    OSSL_PARAM *digest;     /* dsa_set_ctx_params */
-    OSSL_PARAM *propq;      /* dsa_set_ctx_params */
-#ifdef FIPS_MODULE
-    OSSL_PARAM *ind_d;
-    OSSL_PARAM *ind_k;
-    OSSL_PARAM *ind_sign;
-#endif
-    OSSL_PARAM *nonce;
-    OSSL_PARAM *sig;        /* dsa_sigalg_set_ctx_params */
-};
-
 /**
  * @brief Setup common params for dsa_set_ctx_params and dsa_sigalg_set_ctx_params
  * The caller is responsible for checking |vpdsactx| is not NULL and |params|
@@ -747,17 +742,6 @@ static int dsa_common_set_ctx_params(PROV_DSA_CTX *pdsactx,
     return 1;
 }
 
-#define dsa_set_ctx_params_st  dsa_all_set_ctx_params_st
-
-{- produce_param_decoder('dsa_set_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_DIGEST',            'digest',   'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_PROPERTIES',        'propq',    'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_NONCE_TYPE',        'nonce',    'uint'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK',    'ind_k',    'int', 'fips'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK', 'ind_d',    'int', 'fips'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_SIGN_CHECK',   'ind_sign', 'int', 'fips'],
-                         )); -}
-
 static int dsa_set_ctx_params(void *vpdsactx, const OSSL_PARAM params[])
 {
     PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx;
@@ -936,16 +920,6 @@ static const char **dsa_sigalg_query_key_types(void)
     return keytypes;
 }
 
-#define dsa_sigalg_set_ctx_params_st  dsa_all_set_ctx_params_st
-
-{- produce_param_decoder('dsa_sigalg_set_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_SIGNATURE',         'sig',      'octet_string'],
-                          ['OSSL_SIGNATURE_PARAM_NONCE_TYPE',        'nonce',    'uint'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK',    'ind_k',    'int', 'fips'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK', 'ind_d',    'int', 'fips'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_SIGN_CHECK',   'ind_sign', 'int', 'fips'],
-                         )); -}
-
 static const OSSL_PARAM *dsa_sigalg_settable_ctx_params(void *vpdsactx,
                                                         ossl_unused void *provctx)
 {
diff --git a/providers/implementations/signature/dsa_sig.inc.in b/providers/implementations/signature/dsa_sig.inc.in
new file mode 100644 (file)
index 0000000..af329e9
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2025 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the \"License\").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+{-
+use OpenSSL::paramnames qw(produce_param_decoder);
+-}
+
+{- produce_param_decoder('dsa_get_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_ALGORITHM_ID',            'algid',  'octet_string'],
+                          ['OSSL_SIGNATURE_PARAM_DIGEST',                  'digest', 'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_NONCE_TYPE',              'nonce',  'uint'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_APPROVED_INDICATOR', 'ind',    'int', 'fips'],
+                         )); -}
+
+{- produce_param_decoder('dsa_set_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_DIGEST',            'digest',   'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_PROPERTIES',        'propq',    'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_NONCE_TYPE',        'nonce',    'uint'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK',    'ind_k',    'int', 'fips'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK', 'ind_d',    'int', 'fips'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_SIGN_CHECK',   'ind_sign', 'int', 'fips'],
+                         )); -}
+
+{- produce_param_decoder('dsa_sigalg_set_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_SIGNATURE',         'sig',      'octet_string'],
+                          ['OSSL_SIGNATURE_PARAM_NONCE_TYPE',        'nonce',    'uint'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK',    'ind_k',    'int', 'fips'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK', 'ind_d',    'int', 'fips'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_SIGN_CHECK',   'ind_sign', 'int', 'fips'],
+                         )); -}
similarity index 94%
rename from providers/implementations/signature/ecdsa_sig.c.in
rename to providers/implementations/signature/ecdsa_sig.c
index d2e954b1af6fc6f619d734f8d1dbf4bca6e29893..7f1428fbb002547d86f082cc56d365b76dcffcb5 100644 (file)
@@ -6,9 +6,6 @@
  * in the file LICENSE in the source distribution or at
  * https://www.openssl.org/source/license.html
  */
-{-
-use OpenSSL::paramnames qw(produce_param_decoder);
--}
 
 /*
  * ECDSA low level APIs are deprecated for public use, but still ok for
@@ -36,6 +33,26 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "prov/der_ec.h"
 #include "crypto/ec.h"
 
+struct ecdsa_all_set_ctx_params_st {
+    OSSL_PARAM *digest;     /* ecdsa_set_ctx_params */
+    OSSL_PARAM *propq;      /* ecdsa_set_ctx_params */
+    OSSL_PARAM *size;       /* ecdsa_set_ctx_params */
+#ifdef FIPS_MODULE
+    OSSL_PARAM *ind_d;
+    OSSL_PARAM *ind_k;
+#endif
+#if !defined(OPENSSL_NO_ACVP_TESTS)
+    OSSL_PARAM *kat;
+#endif
+    OSSL_PARAM *nonce;
+    OSSL_PARAM *sig;        /* ecdsa_sigalg_set_ctx_params */
+};
+
+#define ecdsa_set_ctx_params_st ecdsa_all_set_ctx_params_st
+#define ecdsa_sigalg_set_ctx_params_st ecdsa_all_set_ctx_params_st
+
+#include "providers/implementations/signature/ecdsa_sig.inc"
+
 static OSSL_FUNC_signature_newctx_fn ecdsa_newctx;
 static OSSL_FUNC_signature_sign_init_fn ecdsa_sign_init;
 static OSSL_FUNC_signature_verify_init_fn ecdsa_verify_init;
@@ -675,15 +692,6 @@ static void *ecdsa_dupctx(void *vctx)
     return NULL;
 }
 
-{- produce_param_decoder('ecdsa_get_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_ALGORITHM_ID',            'algid',  'octet_string'],
-                          ['OSSL_SIGNATURE_PARAM_DIGEST_SIZE',             'size',   'size_t'],
-                          ['OSSL_SIGNATURE_PARAM_DIGEST',                  'digest', 'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_NONCE_TYPE',              'nonce',  'uint'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_VERIFY_MESSAGE',     'verify', 'uint', 'fips'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_APPROVED_INDICATOR', 'ind',    'int', 'fips'],
-                         )); -}
-
 static int ecdsa_get_ctx_params(void *vctx, OSSL_PARAM *params)
 {
     PROV_ECDSA_CTX *ctx = (PROV_ECDSA_CTX *)vctx;
@@ -726,21 +734,6 @@ static const OSSL_PARAM *ecdsa_gettable_ctx_params(ossl_unused void *vctx,
     return ecdsa_get_ctx_params_list;
 }
 
-struct ecdsa_all_set_ctx_params_st {
-    OSSL_PARAM *digest;     /* ecdsa_set_ctx_params */
-    OSSL_PARAM *propq;      /* ecdsa_set_ctx_params */
-    OSSL_PARAM *size;       /* ecdsa_set_ctx_params */
-#ifdef FIPS_MODULE
-    OSSL_PARAM *ind_d;
-    OSSL_PARAM *ind_k;
-#endif
-#if !defined(OPENSSL_NO_ACVP_TESTS)
-    OSSL_PARAM *kat;
-#endif
-    OSSL_PARAM *nonce;
-    OSSL_PARAM *sig;        /* ecdsa_sigalg_set_ctx_params */
-};
-
 /**
  * @brief Set up common params for ecdsa_set_ctx_params and
  * ecdsa_sigalg_set_ctx_params. The caller is responsible for checking |vctx| is
@@ -766,19 +759,6 @@ static int ecdsa_common_set_ctx_params(PROV_ECDSA_CTX *ctx,
     return 1;
 }
 
-#define ecdsa_set_ctx_params_st  ecdsa_all_set_ctx_params_st
-
-{- produce_param_decoder('ecdsa_set_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_DIGEST',            'digest',   'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_PROPERTIES',        'propq',    'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_DIGEST_SIZE',       'size',     'size_t'],
-                          ['OSSL_SIGNATURE_PARAM_KAT',               'kat',      'uint',
-                           "#if !defined(OPENSSL_NO_ACVP_TESTS)"],
-                          ['OSSL_SIGNATURE_PARAM_NONCE_TYPE',        'nonce',    'uint'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK',    'ind_k',    'int', 'fips'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK', 'ind_d',    'int', 'fips'],
-                         )); -}
-
 static int ecdsa_set_ctx_params(void *vctx, const OSSL_PARAM params[])
 {
     PROV_ECDSA_CTX *ctx = (PROV_ECDSA_CTX *)vctx;
@@ -957,17 +937,6 @@ static const char **ecdsa_sigalg_query_key_types(void)
     return keytypes;
 }
 
-#define ecdsa_sigalg_set_ctx_params_st  ecdsa_all_set_ctx_params_st
-
-{- produce_param_decoder('ecdsa_sigalg_set_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_SIGNATURE',         'sig',   'octet_string'],
-                          ['OSSL_SIGNATURE_PARAM_KAT',               'kat',   'uint',
-                           "#if !defined(OPENSSL_NO_ACVP_TESTS)"],
-                          ['OSSL_SIGNATURE_PARAM_NONCE_TYPE',        'nonce', 'uint'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK',    'ind_k', 'int', 'fips'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK', 'ind_d', 'int', 'fips'],
-                         )); -}
-
 static const OSSL_PARAM *ecdsa_sigalg_settable_ctx_params(void *vctx,
                                                         ossl_unused void *provctx)
 {
diff --git a/providers/implementations/signature/ecdsa_sig.inc.in b/providers/implementations/signature/ecdsa_sig.inc.in
new file mode 100644 (file)
index 0000000..4907b8d
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2025 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the \"License\").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+{-
+use OpenSSL::paramnames qw(produce_param_decoder);
+-}
+
+{- produce_param_decoder('ecdsa_get_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_ALGORITHM_ID',            'algid',  'octet_string'],
+                          ['OSSL_SIGNATURE_PARAM_DIGEST_SIZE',             'size',   'size_t'],
+                          ['OSSL_SIGNATURE_PARAM_DIGEST',                  'digest', 'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_NONCE_TYPE',              'nonce',  'uint'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_VERIFY_MESSAGE',     'verify', 'uint', 'fips'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_APPROVED_INDICATOR', 'ind',    'int', 'fips'],
+                         )); -}
+
+{- produce_param_decoder('ecdsa_set_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_DIGEST',            'digest',   'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_PROPERTIES',        'propq',    'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_DIGEST_SIZE',       'size',     'size_t'],
+                          ['OSSL_SIGNATURE_PARAM_KAT',               'kat',      'uint',
+                           "#if !defined(OPENSSL_NO_ACVP_TESTS)"],
+                          ['OSSL_SIGNATURE_PARAM_NONCE_TYPE',        'nonce',    'uint'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK',    'ind_k',    'int', 'fips'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK', 'ind_d',    'int', 'fips'],
+                         )); -}
+
+{- produce_param_decoder('ecdsa_sigalg_set_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_SIGNATURE',         'sig',   'octet_string'],
+                          ['OSSL_SIGNATURE_PARAM_KAT',               'kat',   'uint',
+                           "#if !defined(OPENSSL_NO_ACVP_TESTS)"],
+                          ['OSSL_SIGNATURE_PARAM_NONCE_TYPE',        'nonce', 'uint'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK',    'ind_k', 'int', 'fips'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK', 'ind_d', 'int', 'fips'],
+                         )); -}
similarity index 98%
rename from providers/implementations/signature/eddsa_sig.c.in
rename to providers/implementations/signature/eddsa_sig.c
index 1ef925253d6a361b8ffa3da717651cfc60894a2c..2c069cf3c12e6d29b8ab11ee4c42ef94813d5228 100644 (file)
@@ -6,9 +6,6 @@
  * 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/crypto.h>
 #include <openssl/core_dispatch.h>
@@ -27,6 +24,10 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "prov/der_ecx.h"
 #include "crypto/ecx.h"
 
+#define eddsa_set_variant_ctx_params_st eddsa_set_ctx_params_st
+
+#include "providers/implementations/signature/eddsa_sig.inc"
+
 #ifdef S390X_EC_ASM
 # include "s390x_arch.h"
 
@@ -792,10 +793,6 @@ static const char **ed448_sigalg_query_key_types(void)
     return keytypes;
 }
 
-{- produce_param_decoder('eddsa_get_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_ALGORITHM_ID', 'id', 'octet_string'],
-                         )); -}
-
 static int eddsa_get_ctx_params(void *vpeddsactx, OSSL_PARAM *params)
 {
     PROV_EDDSA_CTX *peddsactx = (PROV_EDDSA_CTX *)vpeddsactx;
@@ -819,11 +816,6 @@ static const OSSL_PARAM *eddsa_gettable_ctx_params(ossl_unused void *vpeddsactx,
     return eddsa_get_ctx_params_list;
 }
 
-{- produce_param_decoder('eddsa_set_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_INSTANCE',       'inst', 'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_CONTEXT_STRING', 'ctx',  'octet_string'],
-                         )); -}
-
 static int eddsa_set_ctx_params_internal
         (PROV_EDDSA_CTX *peddsactx, const struct eddsa_set_ctx_params_st *p)
 {
@@ -891,7 +883,6 @@ static const OSSL_PARAM *eddsa_settable_ctx_params(ossl_unused void *vpeddsactx,
     return eddsa_set_ctx_params_list;
 }
 
-
 static int eddsa_set_ctx_params(void *vpeddsactx, const OSSL_PARAM params[])
 {
     PROV_EDDSA_CTX *peddsactx = (PROV_EDDSA_CTX *)vpeddsactx;
@@ -902,11 +893,6 @@ static int eddsa_set_ctx_params(void *vpeddsactx, const OSSL_PARAM params[])
     return eddsa_set_ctx_params_internal(peddsactx, &p);
 }
 
-#define eddsa_set_variant_ctx_params_st         eddsa_set_ctx_params_st
-{- produce_param_decoder('eddsa_set_variant_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_CONTEXT_STRING', 'ctx',  'octet_string'],
-                         )); -}
-
 static const OSSL_PARAM *
 eddsa_settable_variant_ctx_params(ossl_unused void *vpeddsactx,
                                   ossl_unused void *provctx)
diff --git a/providers/implementations/signature/eddsa_sig.inc.in b/providers/implementations/signature/eddsa_sig.inc.in
new file mode 100644 (file)
index 0000000..ec1ba23
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2025 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the \"License\").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+{-
+use OpenSSL::paramnames qw(produce_param_decoder);
+-}
+
+{- produce_param_decoder('eddsa_get_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_ALGORITHM_ID', 'id', 'octet_string'],
+                         )); -}
+
+{- produce_param_decoder('eddsa_set_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_INSTANCE',       'inst', 'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_CONTEXT_STRING', 'ctx',  'octet_string'],
+                         )); -}
+
+{- produce_param_decoder('eddsa_set_variant_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_CONTEXT_STRING', 'ctx',  'octet_string'],
+                         )); -}
similarity index 92%
rename from providers/implementations/signature/ml_dsa_sig.c.in
rename to providers/implementations/signature/ml_dsa_sig.c
index a12618ac7159a74426bc4b4a7b7ec209cfb92daa..b4397c0974fad3d9905e7753ba07c536a785efa2 100644 (file)
@@ -6,9 +6,6 @@
  * 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 "internal/deprecated.h"
 
@@ -27,6 +24,11 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "internal/packet.h"
 #include "internal/sizes.h"
 
+#define ml_dsa_set_ctx_params_st        ml_dsa_verifymsg_set_ctx_params_st
+#define ml_dsa_set_ctx_params_decoder   ml_dsa_verifymsg_set_ctx_params_decoder
+
+#include "providers/implementations/signature/ml_dsa_sig.inc"
+
 #define ML_DSA_MESSAGE_ENCODE_RAW  0
 #define ML_DSA_MESSAGE_ENCODE_PURE 1
 
@@ -365,25 +367,6 @@ static int ml_dsa_digest_verify(void *vctx,
  * Only need the param list for the signing case.  The decoder and structure
  * are shared between the sign and verify cases.
  */
-#define ml_dsa_set_ctx_params_st        ml_dsa_verifymsg_set_ctx_params_st
-#define ml_dsa_set_ctx_params_decoder   ml_dsa_verifymsg_set_ctx_params_decoder
-
-{- produce_param_decoder('ml_dsa_set_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_CONTEXT_STRING',   'ctx',    'octet_string'],
-                          ['OSSL_SIGNATURE_PARAM_TEST_ENTROPY',     'ent',    'octet_string'],
-                          ['OSSL_SIGNATURE_PARAM_DETERMINISTIC',    'det',    'int'],
-                          ['OSSL_SIGNATURE_PARAM_MESSAGE_ENCODING', 'msgenc', 'int'],
-                          ['OSSL_SIGNATURE_PARAM_MU',               'mu',     'int'],
-                         )); -}
-
-{- produce_param_decoder('ml_dsa_verifymsg_set_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_CONTEXT_STRING',   'ctx',    'octet_string'],
-                          ['OSSL_SIGNATURE_PARAM_TEST_ENTROPY',     'ent',    'octet_string'],
-                          ['OSSL_SIGNATURE_PARAM_DETERMINISTIC',    'det',    'int'],
-                          ['OSSL_SIGNATURE_PARAM_MESSAGE_ENCODING', 'msgenc', 'int'],
-                          ['OSSL_SIGNATURE_PARAM_MU',               'mu',     'int'],
-                          ['OSSL_SIGNATURE_PARAM_SIGNATURE',        'sig',    'octet_string'],
-                         )); -}
 
 static int ml_dsa_set_ctx_params(void *vctx, const OSSL_PARAM params[])
 {
@@ -449,10 +432,6 @@ static const OSSL_PARAM *ml_dsa_settable_ctx_params(void *vctx,
         return ml_dsa_set_ctx_params_list;
 }
 
-{- produce_param_decoder('ml_dsa_get_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_ALGORITHM_ID', 'id', 'octet_string'],
-                         )); -}
-
 static const OSSL_PARAM *ml_dsa_gettable_ctx_params(ossl_unused void *vctx,
                                                     ossl_unused void *provctx)
 {
diff --git a/providers/implementations/signature/ml_dsa_sig.inc.in b/providers/implementations/signature/ml_dsa_sig.inc.in
new file mode 100644 (file)
index 0000000..4cf5816
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2025 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the \"License\").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+{-
+use OpenSSL::paramnames qw(produce_param_decoder);
+-}
+
+{- produce_param_decoder('ml_dsa_set_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_CONTEXT_STRING',   'ctx',    'octet_string'],
+                          ['OSSL_SIGNATURE_PARAM_TEST_ENTROPY',     'ent',    'octet_string'],
+                          ['OSSL_SIGNATURE_PARAM_DETERMINISTIC',    'det',    'int'],
+                          ['OSSL_SIGNATURE_PARAM_MESSAGE_ENCODING', 'msgenc', 'int'],
+                          ['OSSL_SIGNATURE_PARAM_MU',               'mu',     'int'],
+                         )); -}
+
+{- produce_param_decoder('ml_dsa_verifymsg_set_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_CONTEXT_STRING',   'ctx',    'octet_string'],
+                          ['OSSL_SIGNATURE_PARAM_TEST_ENTROPY',     'ent',    'octet_string'],
+                          ['OSSL_SIGNATURE_PARAM_DETERMINISTIC',    'det',    'int'],
+                          ['OSSL_SIGNATURE_PARAM_MESSAGE_ENCODING', 'msgenc', 'int'],
+                          ['OSSL_SIGNATURE_PARAM_MU',               'mu',     'int'],
+                          ['OSSL_SIGNATURE_PARAM_SIGNATURE',        'sig',    'octet_string'],
+                         )); -}
+
+{- produce_param_decoder('ml_dsa_get_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_ALGORITHM_ID', 'id', 'octet_string'],
+                         )); -}
similarity index 95%
rename from providers/implementations/signature/rsa_sig.c.in
rename to providers/implementations/signature/rsa_sig.c
index cb0c73661944229f0e3de6b18e6b847603437016..7ad55468e803eb101011cc22b1ca2f2c0ba22026 100644 (file)
@@ -6,9 +6,6 @@
  * in the file LICENSE in the source distribution or at
  * https://www.openssl.org/source/license.html
  */
-{-
-use OpenSSL::paramnames qw(produce_param_decoder);
--}
 
 /*
  * RSA low level APIs are deprecated for public use, but still ok for
@@ -36,6 +33,10 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "prov/der_rsa.h"
 #include "prov/securitycheck.h"
 
+#define rsa_set_ctx_params_no_digest_st rsa_set_ctx_params_st
+
+#include "providers/implementations/signature/rsa_sig.inc"
+
 #define RSA_DEFAULT_DIGEST_NAME OSSL_DIGEST_NAME_SHA1
 
 static OSSL_FUNC_signature_newctx_fn rsa_newctx;
@@ -1385,18 +1386,6 @@ static void *rsa_dupctx(void *vprsactx)
     return NULL;
 }
 
-{- produce_param_decoder('rsa_get_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_ALGORITHM_ID',            'algid',  'octet_string'],
-                          ['OSSL_SIGNATURE_PARAM_PAD_MODE',                'pad',    'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_PAD_MODE',                'pad',    'int'],
-                          ['OSSL_SIGNATURE_PARAM_DIGEST',                  'digest', 'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_MGF1_DIGEST',             'mgf1',   'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_PSS_SALTLEN',             'slen',   'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_PSS_SALTLEN',             'slen',   'int'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_VERIFY_MESSAGE',     'verify', 'uint', 'fips'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_APPROVED_INDICATOR', 'ind',    'int', 'fips'],
-                         )); -}
-
 static int rsa_get_ctx_params(void *vprsactx, OSSL_PARAM *params)
 {
     PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
@@ -1519,36 +1508,6 @@ static int rsa_x931_padding_allowed(PROV_RSA_CTX *ctx)
 }
 #endif
 
-{- produce_param_decoder('rsa_set_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_DIGEST',                     'digest',   'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_PROPERTIES',                 'propq',    'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_PAD_MODE',                   'pad',      'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_PAD_MODE',                   'pad',      'int'],
-                          ['OSSL_SIGNATURE_PARAM_MGF1_DIGEST',                'mgf1',     'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_MGF1_PROPERTIES',            'mgf1pq',   'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_PSS_SALTLEN',                'slen',     'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_PSS_SALTLEN',                'slen',     'int'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK',             'ind_k',    'int', 'fips'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK',          'ind_d',    'int', 'fips'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_RSA_PSS_SALTLEN_CHECK', 'ind_slen', 'int', 'fips'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_SIGN_X931_PAD_CHECK',   'ind_xpad', 'int', 'fips'],
-                         )); -}
-
-#define rsa_set_ctx_params_no_digest_st  rsa_set_ctx_params_st
-
-{- produce_param_decoder('rsa_set_ctx_params_no_digest',
-                         (['OSSL_SIGNATURE_PARAM_PAD_MODE',                   'pad',      'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_PAD_MODE',                   'pad',      'int'],
-                          ['OSSL_SIGNATURE_PARAM_MGF1_DIGEST',                'mgf1',     'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_MGF1_PROPERTIES',            'mgf1pq',   'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_PSS_SALTLEN',                'slen',     'utf8_string'],
-                          ['OSSL_SIGNATURE_PARAM_PSS_SALTLEN',                'slen',     'int'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK',             'ind_k',    'int', 'fips'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK',          'ind_d',    'int', 'fips'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_RSA_PSS_SALTLEN_CHECK', 'ind_slen', 'int', 'fips'],
-                          ['OSSL_SIGNATURE_PARAM_FIPS_SIGN_X931_PAD_CHECK',   'ind_xpad', 'int', 'fips'],
-                         )); -}
-
 static int rsa_set_ctx_params(void *vprsactx, const OSSL_PARAM params[])
 {
     PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
@@ -1949,10 +1908,6 @@ static const char **rsa_sigalg_query_key_types(void)
     return keytypes;
 }
 
-{- produce_param_decoder('rsa_sigalg_set_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_SIGNATURE', 'sig', 'octet_string'],
-                         )); -}
-
 static const OSSL_PARAM *rsa_sigalg_settable_ctx_params(void *vprsactx,
                                                         ossl_unused void *provctx)
 {
diff --git a/providers/implementations/signature/rsa_sig.inc.in b/providers/implementations/signature/rsa_sig.inc.in
new file mode 100644 (file)
index 0000000..e73e26d
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2025 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the \"License\").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+{-
+use OpenSSL::paramnames qw(produce_param_decoder);
+-}
+
+{- produce_param_decoder('rsa_get_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_ALGORITHM_ID',            'algid',  'octet_string'],
+                          ['OSSL_SIGNATURE_PARAM_PAD_MODE',                'pad',    'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_PAD_MODE',                'pad',    'int'],
+                          ['OSSL_SIGNATURE_PARAM_DIGEST',                  'digest', 'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_MGF1_DIGEST',             'mgf1',   'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_PSS_SALTLEN',             'slen',   'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_PSS_SALTLEN',             'slen',   'int'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_VERIFY_MESSAGE',     'verify', 'uint', 'fips'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_APPROVED_INDICATOR', 'ind',    'int', 'fips'],
+                         )); -}
+
+{- produce_param_decoder('rsa_set_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_DIGEST',                     'digest',   'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_PROPERTIES',                 'propq',    'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_PAD_MODE',                   'pad',      'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_PAD_MODE',                   'pad',      'int'],
+                          ['OSSL_SIGNATURE_PARAM_MGF1_DIGEST',                'mgf1',     'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_MGF1_PROPERTIES',            'mgf1pq',   'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_PSS_SALTLEN',                'slen',     'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_PSS_SALTLEN',                'slen',     'int'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK',             'ind_k',    'int', 'fips'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK',          'ind_d',    'int', 'fips'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_RSA_PSS_SALTLEN_CHECK', 'ind_slen', 'int', 'fips'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_SIGN_X931_PAD_CHECK',   'ind_xpad', 'int', 'fips'],
+                         )); -}
+
+{- produce_param_decoder('rsa_set_ctx_params_no_digest',
+                         (['OSSL_SIGNATURE_PARAM_PAD_MODE',                   'pad',      'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_PAD_MODE',                   'pad',      'int'],
+                          ['OSSL_SIGNATURE_PARAM_MGF1_DIGEST',                'mgf1',     'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_MGF1_PROPERTIES',            'mgf1pq',   'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_PSS_SALTLEN',                'slen',     'utf8_string'],
+                          ['OSSL_SIGNATURE_PARAM_PSS_SALTLEN',                'slen',     'int'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK',             'ind_k',    'int', 'fips'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK',          'ind_d',    'int', 'fips'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_RSA_PSS_SALTLEN_CHECK', 'ind_slen', 'int', 'fips'],
+                          ['OSSL_SIGNATURE_PARAM_FIPS_SIGN_X931_PAD_CHECK',   'ind_xpad', 'int', 'fips'],
+                         )); -}
+
+{- produce_param_decoder('rsa_sigalg_set_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_SIGNATURE', 'sig', 'octet_string'],
+                         )); -}
similarity index 95%
rename from providers/implementations/signature/slh_dsa_sig.c.in
rename to providers/implementations/signature/slh_dsa_sig.c
index 909691637c9871bbab5093ae2cca85ab2875dab8..23b27f2def8ff3481305a9975dce156b455b390a 100644 (file)
@@ -6,9 +6,6 @@
  * 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_names.h>
 #include <openssl/err.h>
@@ -21,6 +18,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "crypto/slh_dsa.h"
 #include "internal/cryptlib.h"
 #include "internal/sizes.h"
+#include "providers/implementations/signature/slh_dsa_sig.inc"
 
 #define SLH_DSA_MAX_ADD_RANDOM_LEN 32
 
@@ -260,13 +258,6 @@ static int slh_dsa_digest_verify(void *vctx, const uint8_t *sig, size_t siglen,
     return slh_dsa_verify(vctx, sig, siglen, tbs, tbslen);
 }
 
-{- produce_param_decoder('slh_dsa_set_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_CONTEXT_STRING',   'context', 'octet_string'],
-                          ['OSSL_SIGNATURE_PARAM_TEST_ENTROPY',     'entropy', 'octet_string'],
-                          ['OSSL_SIGNATURE_PARAM_DETERMINISTIC',    'det',     'int'],
-                          ['OSSL_SIGNATURE_PARAM_MESSAGE_ENCODING', 'msgenc',  'int'],
-                         )); -}
-
 static int slh_dsa_set_ctx_params(void *vctx, const OSSL_PARAM params[])
 {
     PROV_SLH_DSA_CTX *pctx = (PROV_SLH_DSA_CTX *)vctx;
@@ -311,10 +302,6 @@ static const OSSL_PARAM *slh_dsa_settable_ctx_params(void *vctx,
     return slh_dsa_set_ctx_params_list;
 }
 
-{- produce_param_decoder('slh_dsa_get_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_ALGORITHM_ID', 'algid', 'octet_string'],
-                         )); -}
-
 static const OSSL_PARAM *slh_dsa_gettable_ctx_params(ossl_unused void *vctx,
                                                      ossl_unused void *provctx)
 {
diff --git a/providers/implementations/signature/slh_dsa_sig.inc.in b/providers/implementations/signature/slh_dsa_sig.inc.in
new file mode 100644 (file)
index 0000000..a636ef8
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2025 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the \"License\").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+{-
+use OpenSSL::paramnames qw(produce_param_decoder);
+-}
+
+{- produce_param_decoder('slh_dsa_set_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_CONTEXT_STRING',   'context', 'octet_string'],
+                          ['OSSL_SIGNATURE_PARAM_TEST_ENTROPY',     'entropy', 'octet_string'],
+                          ['OSSL_SIGNATURE_PARAM_DETERMINISTIC',    'det',     'int'],
+                          ['OSSL_SIGNATURE_PARAM_MESSAGE_ENCODING', 'msgenc',  'int'],
+                         )); -}
+
+{- produce_param_decoder('slh_dsa_get_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_ALGORITHM_ID', 'algid', 'octet_string'],
+                         )); -}
similarity index 95%
rename from providers/implementations/signature/sm2_sig.c.in
rename to providers/implementations/signature/sm2_sig.c
index 0ce7f752e778630ffb2845145b11911459ab85a0..5a5f3d91261af36c5453ce4de7e50b7f609adb0c 100644 (file)
@@ -6,9 +6,6 @@
  * in the file LICENSE in the source distribution or at
  * https://www.openssl.org/source/license.html
  */
-{-
-use OpenSSL::paramnames qw(produce_param_decoder);
--}
 
 /*
  * ECDSA low level APIs are deprecated for public use, but still ok for
@@ -35,6 +32,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "crypto/ec.h"
 #include "crypto/sm2.h"
 #include "prov/der_sm2.h"
+#include "providers/implementations/signature/sm2_sig.inc"
 
 static OSSL_FUNC_signature_newctx_fn sm2sig_newctx;
 static OSSL_FUNC_signature_sign_init_fn sm2sig_signature_init;
@@ -314,7 +312,6 @@ int sm2sig_digest_sign_final(void *vpsm2ctx, unsigned char *sig, size_t *siglen,
     return sm2sig_sign(vpsm2ctx, sig, siglen, sigsize, digest, (size_t)dlen);
 }
 
-
 int sm2sig_digest_verify_final(void *vpsm2ctx, const unsigned char *sig,
                                size_t siglen)
 {
@@ -399,12 +396,6 @@ static void *sm2sig_dupctx(void *vpsm2ctx)
     return NULL;
 }
 
-{- produce_param_decoder('sm2sig_get_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_ALGORITHM_ID', 'algid',  'octet_string'],
-                          ['OSSL_SIGNATURE_PARAM_DIGEST_SIZE',  'size',   'size_t'],
-                          ['OSSL_SIGNATURE_PARAM_DIGEST',       'digest', 'utf8_string'],
-                         )); -}
-
 static int sm2sig_get_ctx_params(void *vpsm2ctx, OSSL_PARAM *params)
 {
     PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx;
@@ -437,12 +428,6 @@ static const OSSL_PARAM *sm2sig_gettable_ctx_params(ossl_unused void *vpsm2ctx,
     return sm2sig_get_ctx_params_list;
 }
 
-{- produce_param_decoder('sm2sig_set_ctx_params',
-                         (['OSSL_SIGNATURE_PARAM_DIGEST_SIZE', 'size',   'size_t'],
-                          ['OSSL_SIGNATURE_PARAM_DIGEST',      'digest', 'utf8_string'],
-                          ['OSSL_PKEY_PARAM_DIST_ID',          'distid', 'octet_string'],
-                         )); -}
-
 static int sm2sig_set_ctx_params(void *vpsm2ctx, const OSSL_PARAM params[])
 {
     PROV_SM2_CTX *psm2ctx = (PROV_SM2_CTX *)vpsm2ctx;
diff --git a/providers/implementations/signature/sm2_sig.inc.in b/providers/implementations/signature/sm2_sig.inc.in
new file mode 100644 (file)
index 0000000..f410d74
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2025 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the \"License\").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+{-
+use OpenSSL::paramnames qw(produce_param_decoder);
+-}
+
+{- produce_param_decoder('sm2sig_get_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_ALGORITHM_ID', 'algid',  'octet_string'],
+                          ['OSSL_SIGNATURE_PARAM_DIGEST_SIZE',  'size',   'size_t'],
+                          ['OSSL_SIGNATURE_PARAM_DIGEST',       'digest', 'utf8_string'],
+                         )); -}
+
+{- produce_param_decoder('sm2sig_set_ctx_params',
+                         (['OSSL_SIGNATURE_PARAM_DIGEST_SIZE', 'size',   'size_t'],
+                          ['OSSL_SIGNATURE_PARAM_DIGEST',      'digest', 'utf8_string'],
+                          ['OSSL_PKEY_PARAM_DIST_ID',          'distid', 'octet_string'],
+                         )); -}