]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
macs: Use include file for generated code
authorSimo Sorce <simo@redhat.com>
Thu, 16 Oct 2025 19:48:08 +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)

14 files changed:
.gitignore
build.info
providers/implementations/macs/cmac_prov.c [moved from providers/implementations/macs/cmac_prov.c.in with 90% similarity]
providers/implementations/macs/cmac_prov.inc.in [new file with mode: 0644]
providers/implementations/macs/gmac_prov.c [moved from providers/implementations/macs/gmac_prov.c.in with 91% similarity]
providers/implementations/macs/gmac_prov.inc.in [new file with mode: 0644]
providers/implementations/macs/hmac_prov.c [moved from providers/implementations/macs/hmac_prov.c.in with 92% similarity]
providers/implementations/macs/hmac_prov.inc.in [new file with mode: 0644]
providers/implementations/macs/kmac_prov.c [moved from providers/implementations/macs/kmac_prov.c.in with 94% similarity]
providers/implementations/macs/kmac_prov.inc.in [new file with mode: 0644]
providers/implementations/macs/poly1305_prov.c [moved from providers/implementations/macs/poly1305_prov.c.in with 93% similarity]
providers/implementations/macs/poly1305_prov.inc.in [new file with mode: 0644]
providers/implementations/macs/siphash_prov.c [moved from providers/implementations/macs/siphash_prov.c.in with 89% similarity]
providers/implementations/macs/siphash_prov.inc.in [new file with mode: 0644]

index 86ce3c69f81044058ff8bfc3ec0e15151a1b8589..a04cc765eb910d6dfc35dbf3f02c2bc7d290c274 100644 (file)
@@ -161,12 +161,12 @@ providers/implementations/digests/digestcommon.inc
 providers/implementations/digests/mdc2_prov.inc
 providers/implementations/digests/sha3_prov.inc
 providers/implementations/include/prov/blake2_params.inc
-providers/implementations/macs/cmac_prov.c
-providers/implementations/macs/gmac_prov.c
-providers/implementations/macs/hmac_prov.c
-providers/implementations/macs/kmac_prov.c
-providers/implementations/macs/poly1305_prov.c
-providers/implementations/macs/siphash_prov.c
+providers/implementations/macs/cmac_prov.inc
+providers/implementations/macs/gmac_prov.inc
+providers/implementations/macs/hmac_prov.inc
+providers/implementations/macs/kmac_prov.inc
+providers/implementations/macs/poly1305_prov.inc
+providers/implementations/macs/siphash_prov.inc
 providers/implementations/rands/drbg_ctr.c
 providers/implementations/rands/drbg_hash.c
 providers/implementations/rands/drbg_hmac.c
index c22fb273eccca69a852bb6728416d4de0dfb3e90..f69cddd936b856fe3f152700851e983dd869bb27 100644 (file)
@@ -119,12 +119,12 @@ DEPEND[]=include/openssl/asn1.h \
          providers/implementations/digests/mdc2_prov.inc \
          providers/implementations/digests/sha3_prov.inc \
          providers/implementations/include/prov/blake2_params.inc \
-         providers/implementations/macs/cmac_prov.c \
-         providers/implementations/macs/gmac_prov.c \
-         providers/implementations/macs/hmac_prov.c \
-         providers/implementations/macs/kmac_prov.c \
-         providers/implementations/macs/poly1305_prov.c \
-         providers/implementations/macs/siphash_prov.c \
+         providers/implementations/macs/cmac_prov.inc \
+         providers/implementations/macs/gmac_prov.inc \
+         providers/implementations/macs/hmac_prov.inc \
+         providers/implementations/macs/kmac_prov.inc \
+         providers/implementations/macs/poly1305_prov.inc \
+         providers/implementations/macs/siphash_prov.inc \
          providers/implementations/rands/drbg_ctr.c \
          providers/implementations/rands/drbg_hash.c \
          providers/implementations/rands/drbg_hmac.c \
@@ -237,12 +237,12 @@ DEPEND[providers/implementations/asymciphers/rsa_enc.inc \
        providers/implementations/digests/mdc2_prov.inc \
        providers/implementations/digests/sha3_prov.inc \
        providers/implementations/include/prov/blake2_params.inc \
-       providers/implementations/macs/cmac_prov.c \
-       providers/implementations/macs/gmac_prov.c \
-       providers/implementations/macs/hmac_prov.c \
-       providers/implementations/macs/kmac_prov.c \
-       providers/implementations/macs/poly1305_prov.c \
-       providers/implementations/macs/siphash_prov.c \
+       providers/implementations/macs/cmac_prov.inc \
+       providers/implementations/macs/gmac_prov.inc \
+       providers/implementations/macs/hmac_prov.inc \
+       providers/implementations/macs/kmac_prov.inc \
+       providers/implementations/macs/poly1305_prov.inc \
+       providers/implementations/macs/siphash_prov.inc \
        providers/implementations/rands/drbg_ctr.c \
        providers/implementations/rands/drbg_hash.c \
        providers/implementations/rands/drbg_hmac.c \
@@ -393,18 +393,18 @@ GENERATE[providers/implementations/digests/sha3_prov.inc]=\
     providers/implementations/digests/sha3_prov.inc.in
 GENERATE[providers/implementations/include/prov/blake2_params.inc]=\
     providers/implementations/include/prov/blake2_params.inc.in
-GENERATE[providers/implementations/macs/cmac_prov.c]=\
-    providers/implementations/macs/cmac_prov.c.in
-GENERATE[providers/implementations/macs/gmac_prov.c]=\
-    providers/implementations/macs/gmac_prov.c.in
-GENERATE[providers/implementations/macs/hmac_prov.c]=\
-    providers/implementations/macs/hmac_prov.c.in
-GENERATE[providers/implementations/macs/kmac_prov.c]=\
-    providers/implementations/macs/kmac_prov.c.in
-GENERATE[providers/implementations/macs/poly1305_prov.c]=\
-    providers/implementations/macs/poly1305_prov.c.in
-GENERATE[providers/implementations/macs/siphash_prov.c]=\
-    providers/implementations/macs/siphash_prov.c.in
+GENERATE[providers/implementations/macs/cmac_prov.inc]=\
+    providers/implementations/macs/cmac_prov.inc.in
+GENERATE[providers/implementations/macs/gmac_prov.inc]=\
+    providers/implementations/macs/gmac_prov.inc.in
+GENERATE[providers/implementations/macs/hmac_prov.inc]=\
+    providers/implementations/macs/hmac_prov.inc.in
+GENERATE[providers/implementations/macs/kmac_prov.inc]=\
+    providers/implementations/macs/kmac_prov.inc.in
+GENERATE[providers/implementations/macs/poly1305_prov.inc]=\
+    providers/implementations/macs/poly1305_prov.inc.in
+GENERATE[providers/implementations/macs/siphash_prov.inc]=\
+    providers/implementations/macs/siphash_prov.inc.in
 GENERATE[providers/implementations/rands/drbg_ctr.c]=\
     providers/implementations/rands/drbg_ctr.c.in
 GENERATE[providers/implementations/rands/drbg_hash.c]=\
similarity index 90%
rename from providers/implementations/macs/cmac_prov.c.in
rename to providers/implementations/macs/cmac_prov.c
index 0d3b3d5d6dd40e725cc02e26081ad6e59e2adf6d..90b81acc046bc567ee2841e65db98f5f7e2db632 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);
--}
 
 /*
  * CMAC low level APIs are deprecated for public use, but still ok for internal
@@ -31,6 +28,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "prov/provider_util.h"
 #include "prov/providercommon.h"
 #include "crypto/cmac.h"
+#include "providers/implementations/macs/cmac_prov.inc"
 
 /*
  * Forward declaration of everything implemented here.  This is not strictly
@@ -203,12 +201,6 @@ static int cmac_final(void *vmacctx, unsigned char *out, size_t *outl,
     return CMAC_Final(macctx->ctx, out, outl);
 }
 
-{- produce_param_decoder('cmac_get_ctx_params',
-                         (['OSSL_MAC_PARAM_SIZE',                    'size',   'size_t'],
-                          ['OSSL_MAC_PARAM_BLOCK_SIZE',              'bsize',  'size_t'],
-                          ['OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR', 'ind',    'int', 'fips'],
-                         )); -}
-
 static const OSSL_PARAM *cmac_gettable_ctx_params(ossl_unused void *ctx,
                                                   ossl_unused void *provctx)
 {
@@ -235,14 +227,6 @@ static int cmac_get_ctx_params(void *vmacctx, OSSL_PARAM params[])
     return 1;
 }
 
-{- produce_param_decoder('cmac_set_ctx_params',
-                         (['OSSL_MAC_PARAM_CIPHER',                'cipher', 'utf8_string'],
-                          ['OSSL_ALG_PARAM_ENGINE',                'engine', 'utf8_string', 'hidden'],
-                          ['OSSL_MAC_PARAM_PROPERTIES',            'propq',  'utf8_string'],
-                          ['OSSL_MAC_PARAM_KEY',                   'key',    'octet_string'],
-                          ['OSSL_CIPHER_PARAM_FIPS_ENCRYPT_CHECK', 'ind_ec', 'int', 'fips'],
-                         )); -}
-
 static const OSSL_PARAM *cmac_settable_ctx_params(ossl_unused void *ctx,
                                                   ossl_unused void *provctx)
 {
diff --git a/providers/implementations/macs/cmac_prov.inc.in b/providers/implementations/macs/cmac_prov.inc.in
new file mode 100644 (file)
index 0000000..36e2117
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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('cmac_get_ctx_params',
+                         (['OSSL_MAC_PARAM_SIZE',                    'size',   'size_t'],
+                          ['OSSL_MAC_PARAM_BLOCK_SIZE',              'bsize',  'size_t'],
+                          ['OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR', 'ind',    'int', 'fips'],
+                         )); -}
+
+{- produce_param_decoder('cmac_set_ctx_params',
+                         (['OSSL_MAC_PARAM_CIPHER',                'cipher', 'utf8_string'],
+                          ['OSSL_ALG_PARAM_ENGINE',                'engine', 'utf8_string', 'hidden'],
+                          ['OSSL_MAC_PARAM_PROPERTIES',            'propq',  'utf8_string'],
+                          ['OSSL_MAC_PARAM_KEY',                   'key',    'octet_string'],
+                          ['OSSL_CIPHER_PARAM_FIPS_ENCRYPT_CHECK', 'ind_ec', 'int', 'fips'],
+                         )); -}
similarity index 91%
rename from providers/implementations/macs/gmac_prov.c.in
rename to providers/implementations/macs/gmac_prov.c
index 0b60ac773922b31b344f971f2669dd483cd4260d..2c58922a90d8a89b4a2218d71dfff1c44d602998 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 <stdlib.h>
 #include <string.h>
@@ -24,6 +21,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "prov/provider_ctx.h"
 #include "prov/provider_util.h"
 #include "prov/providercommon.h"
+#include "providers/implementations/macs/gmac_prov.inc"
 
 /*
  * Forward declaration of everything implemented here.  This is not strictly
@@ -170,10 +168,6 @@ static int gmac_final(void *vmacctx, unsigned char *out, size_t *outl,
     return 1;
 }
 
-{- produce_param_decoder('gmac_get_params',
-                         (['OSSL_MAC_PARAM_SIZE',    'size', 'size_t'],
-                        )); -}
-
 static const OSSL_PARAM *gmac_gettable_params(void *provctx)
 {
     return gmac_get_params_list;
@@ -192,14 +186,6 @@ static int gmac_get_params(OSSL_PARAM params[])
     return 1;
 }
 
-{- produce_param_decoder('gmac_set_ctx_params',
-                         (['OSSL_MAC_PARAM_CIPHER',     'cipher', 'utf8_string'],
-                          ['OSSL_ALG_PARAM_ENGINE',     'engine', 'utf8_string', 'hidden'],
-                          ['OSSL_MAC_PARAM_PROPERTIES', 'propq',  'utf8_string'],
-                          ['OSSL_MAC_PARAM_KEY',        'key',    'octet_string'],
-                          ['OSSL_MAC_PARAM_IV',         'iv',     'octet_string'],
-                         )); -}
-
 static const OSSL_PARAM *gmac_settable_ctx_params(ossl_unused void *ctx,
                                                   ossl_unused void *provctx)
 {
diff --git a/providers/implementations/macs/gmac_prov.inc.in b/providers/implementations/macs/gmac_prov.inc.in
new file mode 100644 (file)
index 0000000..edf049f
--- /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('gmac_get_params',
+                         (['OSSL_MAC_PARAM_SIZE',    'size', 'size_t'],
+                        )); -}
+
+{- produce_param_decoder('gmac_set_ctx_params',
+                         (['OSSL_MAC_PARAM_CIPHER',     'cipher', 'utf8_string'],
+                          ['OSSL_ALG_PARAM_ENGINE',     'engine', 'utf8_string', 'hidden'],
+                          ['OSSL_MAC_PARAM_PROPERTIES', 'propq',  'utf8_string'],
+                          ['OSSL_MAC_PARAM_KEY',        'key',    'octet_string'],
+                          ['OSSL_MAC_PARAM_IV',         'iv',     'octet_string'],
+                         )); -}
similarity index 92%
rename from providers/implementations/macs/hmac_prov.c.in
rename to providers/implementations/macs/hmac_prov.c
index e6ca3484038cde8bf83ff8d597386f518b406177..ff934128c11fbc43181e263cd5c5421d15957a8c 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);
--}
 
 /*
  * HMAC low level APIs are deprecated for public use, but still ok for internal
@@ -34,6 +31,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "prov/provider_util.h"
 #include "prov/providercommon.h"
 #include "prov/securitycheck.h"
+#include "providers/implementations/macs/hmac_prov.inc"
 
 /*
  * Forward declaration of everything implemented here.  This is not strictly
@@ -271,12 +269,6 @@ static int hmac_final(void *vmacctx, unsigned char *out, size_t *outl,
     return 1;
 }
 
-{- produce_param_decoder('hmac_get_ctx_params',
-                         (['OSSL_MAC_PARAM_SIZE',                    'size',   'size_t'],
-                          ['OSSL_MAC_PARAM_BLOCK_SIZE',              'bsize',  'size_t'],
-                          ['OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR', 'ind',    'int', 'fips'],
-                         )); -}
-
 static const OSSL_PARAM *hmac_gettable_ctx_params(ossl_unused void *ctx,
                                                   ossl_unused void *provctx)
 {
@@ -310,15 +302,6 @@ static int hmac_get_ctx_params(void *vmacctx, OSSL_PARAM params[])
     return 1;
 }
 
-{- produce_param_decoder('hmac_set_ctx_params',
-                         (['OSSL_MAC_PARAM_DIGEST',         'digest',  'utf8_string'],
-                          ['OSSL_ALG_PARAM_ENGINE',         'engine',  'utf8_string', 'hidden'],
-                          ['OSSL_MAC_PARAM_PROPERTIES',     'propq',   'utf8_string'],
-                          ['OSSL_MAC_PARAM_KEY',            'key',     'octet_string'],
-                          ['OSSL_MAC_PARAM_TLS_DATA_SIZE',  'tlssize', 'size_t'],
-                          ['OSSL_MAC_PARAM_FIPS_KEY_CHECK', 'ind_k',   'int', 'fips'],
-                         )); -}
-
 static const OSSL_PARAM *hmac_settable_ctx_params(ossl_unused void *ctx,
                                                   ossl_unused void *provctx)
 {
diff --git a/providers/implementations/macs/hmac_prov.inc.in b/providers/implementations/macs/hmac_prov.inc.in
new file mode 100644 (file)
index 0000000..fd1dda6
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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('hmac_get_ctx_params',
+                         (['OSSL_MAC_PARAM_SIZE',                    'size',   'size_t'],
+                          ['OSSL_MAC_PARAM_BLOCK_SIZE',              'bsize',  'size_t'],
+                          ['OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR', 'ind',    'int', 'fips'],
+                         )); -}
+
+{- produce_param_decoder('hmac_set_ctx_params',
+                         (['OSSL_MAC_PARAM_DIGEST',         'digest',  'utf8_string'],
+                          ['OSSL_ALG_PARAM_ENGINE',         'engine',  'utf8_string', 'hidden'],
+                          ['OSSL_MAC_PARAM_PROPERTIES',     'propq',   'utf8_string'],
+                          ['OSSL_MAC_PARAM_KEY',            'key',     'octet_string'],
+                          ['OSSL_MAC_PARAM_TLS_DATA_SIZE',  'tlssize', 'size_t'],
+                          ['OSSL_MAC_PARAM_FIPS_KEY_CHECK', 'ind_k',   'int', 'fips'],
+                         )); -}
similarity index 94%
rename from providers/implementations/macs/kmac_prov.c.in
rename to providers/implementations/macs/kmac_prov.c
index 630851cc8e19242dd7388e386d6ce0c3e61c7afe..dc8addc39c2dcde982106fba04d6af5d4876e818 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);
--}
 
 /*
  * See SP800-185 "Appendix A - KMAC, .... in Terms of Keccak[c]"
@@ -64,6 +61,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "prov/provider_util.h"
 #include "prov/providercommon.h"
 #include "internal/cryptlib.h" /* ossl_assert */
+#include "providers/implementations/macs/kmac_prov.inc"
 
 /*
  * Forward declaration of everything implemented here.  This is not strictly
@@ -191,12 +189,6 @@ static struct kmac_data_st *kmac_new(void *provctx)
 
 #define kmac_new_list
 
-{- produce_param_decoder('kmac_new',
-                         (['OSSL_MAC_PARAM_DIGEST',     'digest', 'utf8_string'],
-                          ['OSSL_MAC_PARAM_PROPERTIES', 'propq',  'utf8_string'],
-                          ['OSSL_ALG_PARAM_ENGINE',     'engine', 'utf8_string', 'hidden'],
-                         )); -}
-
 static void *kmac_fetch_new(void *provctx, const OSSL_PARAM *params)
 {
     struct kmac_data_st *kctx = kmac_new(provctx);
@@ -403,12 +395,6 @@ static int kmac_final(void *vmacctx, unsigned char *out, size_t *outl,
     return ok;
 }
 
-{- produce_param_decoder('kmac_get_ctx_params',
-                         (['OSSL_MAC_PARAM_SIZE',                    'size',   'size_t'],
-                          ['OSSL_MAC_PARAM_BLOCK_SIZE',              'bsize',  'size_t'],
-                          ['OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR', 'ind',    'int', 'fips'],
-                         )); -}
-
 static const OSSL_PARAM *kmac_gettable_ctx_params(ossl_unused void *ctx,
                                                   ossl_unused void *provctx)
 {
@@ -439,15 +425,6 @@ static int kmac_get_ctx_params(void *vmacctx, OSSL_PARAM params[])
     return 1;
 }
 
-{- produce_param_decoder('kmac_set_ctx_params',
-                         (['OSSL_MAC_PARAM_XOF',               'xof',     'int'],
-                          ['OSSL_MAC_PARAM_SIZE',              'size',    'size_t'],
-                          ['OSSL_MAC_PARAM_KEY',               'key',     'octet_string'],
-                          ['OSSL_MAC_PARAM_CUSTOM',            'custom',  'octet_string'],
-                          ['OSSL_MAC_PARAM_FIPS_KEY_CHECK',    'ind_k',   'int', 'fips'],
-                          ['OSSL_MAC_PARAM_FIPS_NO_SHORT_MAC', 'ind_sht', 'int', 'fips'],
-                         )); -}
-
 static const OSSL_PARAM *kmac_settable_ctx_params(ossl_unused void *ctx,
                                                   ossl_unused void *provctx)
 {
diff --git a/providers/implementations/macs/kmac_prov.inc.in b/providers/implementations/macs/kmac_prov.inc.in
new file mode 100644 (file)
index 0000000..1089ef8
--- /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('kmac_new',
+                         (['OSSL_MAC_PARAM_DIGEST',     'digest', 'utf8_string'],
+                          ['OSSL_MAC_PARAM_PROPERTIES', 'propq',  'utf8_string'],
+                          ['OSSL_ALG_PARAM_ENGINE',     'engine', 'utf8_string', 'hidden'],
+                         )); -}
+
+{- produce_param_decoder('kmac_get_ctx_params',
+                         (['OSSL_MAC_PARAM_SIZE',                    'size',   'size_t'],
+                          ['OSSL_MAC_PARAM_BLOCK_SIZE',              'bsize',  'size_t'],
+                          ['OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR', 'ind',    'int', 'fips'],
+                         )); -}
+
+{- produce_param_decoder('kmac_set_ctx_params',
+                         (['OSSL_MAC_PARAM_XOF',               'xof',     'int'],
+                          ['OSSL_MAC_PARAM_SIZE',              'size',    'size_t'],
+                          ['OSSL_MAC_PARAM_KEY',               'key',     'octet_string'],
+                          ['OSSL_MAC_PARAM_CUSTOM',            'custom',  'octet_string'],
+                          ['OSSL_MAC_PARAM_FIPS_KEY_CHECK',    'ind_k',   'int', 'fips'],
+                          ['OSSL_MAC_PARAM_FIPS_NO_SHORT_MAC', 'ind_sht', 'int', 'fips'],
+                         )); -}
similarity index 93%
rename from providers/implementations/macs/poly1305_prov.c.in
rename to providers/implementations/macs/poly1305_prov.c
index fe833c5966269e8a2377bd781859d09a3244c9f2..d7155a3262b11b9b2ec0f435092d85261f926ffa 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 <string.h>
 
@@ -24,6 +21,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 
 #include "prov/implementations.h"
 #include "prov/providercommon.h"
+#include "providers/implementations/macs/poly1305_prov.inc"
 
 /*
  * Forward declaration of everything implemented here.  This is not strictly
@@ -137,10 +135,6 @@ static int poly1305_final(void *vmacctx, unsigned char *out, size_t *outl,
     return 1;
 }
 
-{- produce_param_decoder('poly1305_get_params',
-                         (['OSSL_MAC_PARAM_SIZE',        'size', 'size_t'],
-                         )); -}
-
 static const OSSL_PARAM *poly1305_gettable_params(void *provctx)
 {
     return poly1305_get_params_list;
@@ -159,10 +153,6 @@ static int poly1305_get_params(OSSL_PARAM params[])
     return 1;
 }
 
-{- produce_param_decoder('poly1305_set_ctx_params',
-                         (['OSSL_MAC_PARAM_KEY',     'key',  'octet_string'],
-                        )); -}
-
 static const OSSL_PARAM *poly1305_settable_ctx_params(ossl_unused void *ctx,
                                                       ossl_unused void *provctx)
 {
diff --git a/providers/implementations/macs/poly1305_prov.inc.in b/providers/implementations/macs/poly1305_prov.inc.in
new file mode 100644 (file)
index 0000000..95c990a
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * 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('poly1305_get_params',
+                         (['OSSL_MAC_PARAM_SIZE',        'size', 'size_t'],
+                         )); -}
+
+{- produce_param_decoder('poly1305_set_ctx_params',
+                         (['OSSL_MAC_PARAM_KEY',     'key',  'octet_string'],
+                        )); -}
similarity index 89%
rename from providers/implementations/macs/siphash_prov.c.in
rename to providers/implementations/macs/siphash_prov.c
index 5d8433e16d290d6c390dd29fdab16bea27ab199b..42351bc2e613b3642767675fc06c353bab30e19c 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 <string.h>
 #include <openssl/core_dispatch.h>
@@ -23,6 +20,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 
 #include "prov/implementations.h"
 #include "prov/providercommon.h"
+#include "providers/implementations/macs/siphash_prov.inc"
 
 /*
  * Forward declaration of everything implemented here.  This is not strictly
@@ -152,12 +150,6 @@ static int siphash_final(void *vmacctx, unsigned char *out, size_t *outl,
     return SipHash_Final(&ctx->siphash, out, hlen);
 }
 
-{- produce_param_decoder('siphash_get_ctx_params',
-                         (['OSSL_MAC_PARAM_SIZE',        'size', 'size_t'],
-                          ['OSSL_MAC_PARAM_C_ROUNDS',    'c',    'uint'],
-                          ['OSSL_MAC_PARAM_D_ROUNDS',    'd',    'uint'],
-                         )); -}
-
 static const OSSL_PARAM *siphash_gettable_ctx_params(ossl_unused void *ctx,
                                                      ossl_unused void *provctx)
 {
@@ -181,13 +173,6 @@ static int siphash_get_ctx_params(void *vmacctx, OSSL_PARAM params[])
     return 1;
 }
 
-{- produce_param_decoder('siphash_set_params',
-                         (['OSSL_MAC_PARAM_SIZE',        'size', 'size_t'],
-                          ['OSSL_MAC_PARAM_KEY',         'key',  'octet_string'],
-                          ['OSSL_MAC_PARAM_C_ROUNDS',    'c',    'uint'],
-                          ['OSSL_MAC_PARAM_D_ROUNDS',    'd',    'uint'],
-                         )); -}
-
 static const OSSL_PARAM *siphash_settable_ctx_params(ossl_unused void *ctx,
                                                      void *provctx)
 {
diff --git a/providers/implementations/macs/siphash_prov.inc.in b/providers/implementations/macs/siphash_prov.inc.in
new file mode 100644 (file)
index 0000000..31869d1
--- /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('siphash_get_ctx_params',
+                         (['OSSL_MAC_PARAM_SIZE',        'size', 'size_t'],
+                          ['OSSL_MAC_PARAM_C_ROUNDS',    'c',    'uint'],
+                          ['OSSL_MAC_PARAM_D_ROUNDS',    'd',    'uint'],
+                         )); -}
+
+{- produce_param_decoder('siphash_set_params',
+                         (['OSSL_MAC_PARAM_SIZE',        'size', 'size_t'],
+                          ['OSSL_MAC_PARAM_KEY',         'key',  'octet_string'],
+                          ['OSSL_MAC_PARAM_C_ROUNDS',    'c',    'uint'],
+                          ['OSSL_MAC_PARAM_D_ROUNDS',    'd',    'uint'],
+                         )); -}