From: Simo Sorce Date: Thu, 16 Oct 2025 19:48:08 +0000 (-0400) Subject: macs: Use include file for generated code X-Git-Tag: 4.0-PRE-CLANG-FORMAT-WEBKIT~309 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15885057f1c0b58b5ff5bd2b71fa8ac49304145f;p=thirdparty%2Fopenssl.git macs: Use include file for generated code Signed-off-by: Simo Sorce Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz Reviewed-by: Dmitry Belyavskiy (Merged from https://github.com/openssl/openssl/pull/28838) --- diff --git a/.gitignore b/.gitignore index 86ce3c69f81..a04cc765eb9 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/build.info b/build.info index c22fb273ecc..f69cddd936b 100644 --- a/build.info +++ b/build.info @@ -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]=\ diff --git a/providers/implementations/macs/cmac_prov.c.in b/providers/implementations/macs/cmac_prov.c similarity index 90% rename from providers/implementations/macs/cmac_prov.c.in rename to providers/implementations/macs/cmac_prov.c index 0d3b3d5d6dd..90b81acc046 100644 --- a/providers/implementations/macs/cmac_prov.c.in +++ b/providers/implementations/macs/cmac_prov.c @@ -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 index 00000000000..36e2117c36b --- /dev/null +++ b/providers/implementations/macs/cmac_prov.inc.in @@ -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'], + )); -} diff --git a/providers/implementations/macs/gmac_prov.c.in b/providers/implementations/macs/gmac_prov.c similarity index 91% rename from providers/implementations/macs/gmac_prov.c.in rename to providers/implementations/macs/gmac_prov.c index 0b60ac77392..2c58922a90d 100644 --- a/providers/implementations/macs/gmac_prov.c.in +++ b/providers/implementations/macs/gmac_prov.c @@ -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 #include @@ -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 index 00000000000..edf049f29ce --- /dev/null +++ b/providers/implementations/macs/gmac_prov.inc.in @@ -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'], + )); -} diff --git a/providers/implementations/macs/hmac_prov.c.in b/providers/implementations/macs/hmac_prov.c similarity index 92% rename from providers/implementations/macs/hmac_prov.c.in rename to providers/implementations/macs/hmac_prov.c index e6ca3484038..ff934128c11 100644 --- a/providers/implementations/macs/hmac_prov.c.in +++ b/providers/implementations/macs/hmac_prov.c @@ -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 index 00000000000..fd1dda6f42b --- /dev/null +++ b/providers/implementations/macs/hmac_prov.inc.in @@ -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'], + )); -} diff --git a/providers/implementations/macs/kmac_prov.c.in b/providers/implementations/macs/kmac_prov.c similarity index 94% rename from providers/implementations/macs/kmac_prov.c.in rename to providers/implementations/macs/kmac_prov.c index 630851cc8e1..dc8addc39c2 100644 --- a/providers/implementations/macs/kmac_prov.c.in +++ b/providers/implementations/macs/kmac_prov.c @@ -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 index 00000000000..1089ef8b68e --- /dev/null +++ b/providers/implementations/macs/kmac_prov.inc.in @@ -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'], + )); -} diff --git a/providers/implementations/macs/poly1305_prov.c.in b/providers/implementations/macs/poly1305_prov.c similarity index 93% rename from providers/implementations/macs/poly1305_prov.c.in rename to providers/implementations/macs/poly1305_prov.c index fe833c59662..d7155a3262b 100644 --- a/providers/implementations/macs/poly1305_prov.c.in +++ b/providers/implementations/macs/poly1305_prov.c @@ -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 @@ -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 index 00000000000..95c990a2883 --- /dev/null +++ b/providers/implementations/macs/poly1305_prov.inc.in @@ -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'], + )); -} diff --git a/providers/implementations/macs/siphash_prov.c.in b/providers/implementations/macs/siphash_prov.c similarity index 89% rename from providers/implementations/macs/siphash_prov.c.in rename to providers/implementations/macs/siphash_prov.c index 5d8433e16d2..42351bc2e61 100644 --- a/providers/implementations/macs/siphash_prov.c.in +++ b/providers/implementations/macs/siphash_prov.c @@ -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 #include @@ -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 index 00000000000..31869d16763 --- /dev/null +++ b/providers/implementations/macs/siphash_prov.inc.in @@ -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'], + )); -}