]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
ciphers: Use include file for generated code
authorSimo Sorce <simo@redhat.com>
Thu, 16 Oct 2025 19:48:06 +0000 (15:48 -0400)
committerDmitry Belyavskiy <beldmit@gmail.com>
Mon, 20 Oct 2025 07:45:53 +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)

32 files changed:
.gitignore
build.info
providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c [moved from providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c.in with 85% similarity]
providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.inc.in [new file with mode: 0644]
providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.c [moved from providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.c.in with 93% similarity]
providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.inc.in [new file with mode: 0644]
providers/implementations/ciphers/cipher_aes_gcm_siv.c [moved from providers/implementations/ciphers/cipher_aes_gcm_siv.c.in with 94% similarity]
providers/implementations/ciphers/cipher_aes_gcm_siv.inc.in [new file with mode: 0644]
providers/implementations/ciphers/cipher_aes_ocb.c [moved from providers/implementations/ciphers/cipher_aes_ocb.c.in with 95% similarity]
providers/implementations/ciphers/cipher_aes_ocb.inc.in [new file with mode: 0644]
providers/implementations/ciphers/cipher_aes_siv.c [moved from providers/implementations/ciphers/cipher_aes_siv.c.in with 93% similarity]
providers/implementations/ciphers/cipher_aes_siv.inc.in [new file with mode: 0644]
providers/implementations/ciphers/cipher_aes_wrp.c [moved from providers/implementations/ciphers/cipher_aes_wrp.c.in with 98% similarity]
providers/implementations/ciphers/cipher_aes_wrp.inc.in [new file with mode: 0644]
providers/implementations/ciphers/cipher_aes_xts.c [moved from providers/implementations/ciphers/cipher_aes_xts.c.in with 98% similarity]
providers/implementations/ciphers/cipher_aes_xts.inc.in [new file with mode: 0644]
providers/implementations/ciphers/cipher_chacha20.c [moved from providers/implementations/ciphers/cipher_chacha20.c.in with 93% similarity]
providers/implementations/ciphers/cipher_chacha20.inc.in [new file with mode: 0644]
providers/implementations/ciphers/cipher_chacha20_poly1305.c [moved from providers/implementations/ciphers/cipher_chacha20_poly1305.c.in with 91% similarity]
providers/implementations/ciphers/cipher_chacha20_poly1305.inc.in [new file with mode: 0644]
providers/implementations/ciphers/cipher_null.c [moved from providers/implementations/ciphers/cipher_null.c.in with 91% similarity]
providers/implementations/ciphers/cipher_null.inc.in [new file with mode: 0644]
providers/implementations/ciphers/cipher_rc4_hmac_md5.c [moved from providers/implementations/ciphers/cipher_rc4_hmac_md5.c.in with 90% similarity]
providers/implementations/ciphers/cipher_rc4_hmac_md5.inc.in [new file with mode: 0644]
providers/implementations/ciphers/cipher_sm4_xts.c [moved from providers/implementations/ciphers/cipher_sm4_xts.c.in with 97% similarity]
providers/implementations/ciphers/cipher_sm4_xts.inc.in [new file with mode: 0644]
providers/implementations/ciphers/ciphercommon.c [moved from providers/implementations/ciphers/ciphercommon.c.in with 88% similarity]
providers/implementations/ciphers/ciphercommon.inc.in [new file with mode: 0644]
providers/implementations/ciphers/ciphercommon_ccm.c [moved from providers/implementations/ciphers/ciphercommon_ccm.c.in with 91% similarity]
providers/implementations/ciphers/ciphercommon_ccm.inc.in [new file with mode: 0644]
providers/implementations/ciphers/ciphercommon_gcm.c [moved from providers/implementations/ciphers/ciphercommon_gcm.c.in with 92% similarity]
providers/implementations/ciphers/ciphercommon_gcm.inc.in [new file with mode: 0644]

index 33cb09d9b2d9cf3f17786d196649a5f0945ed1a5..0932e7780f4569d63baccceffa850395eff779dc 100644 (file)
@@ -140,22 +140,22 @@ providers/implementations/skeymgmt/generic.inc
 providers/implementations/storemgmt/file_store_any2obj.inc
 providers/implementations/storemgmt/file_store.inc
 providers/implementations/storemgmt/winstore_store.inc
-providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c
-providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.c
-providers/implementations/ciphers/cipher_aes_gcm_siv.c
-providers/implementations/ciphers/cipher_aes_ocb.c
-providers/implementations/ciphers/cipher_aes_siv.c
-providers/implementations/ciphers/cipher_aes_wrp.c
-providers/implementations/ciphers/cipher_aes_xts.c
-providers/implementations/ciphers/ciphercommon.c
-providers/implementations/ciphers/ciphercommon_ccm.c
-providers/implementations/ciphers/ciphercommon_gcm.c
-providers/implementations/ciphers/cipher_chacha20.c
-providers/implementations/ciphers/cipher_chacha20_poly1305.c
-providers/implementations/ciphers/cipher_null.c
-providers/implementations/ciphers/cipher_rc4_hmac_md5.c
+providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.inc
+providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.inc
+providers/implementations/ciphers/cipher_aes_gcm_siv.inc
+providers/implementations/ciphers/cipher_aes_ocb.inc
+providers/implementations/ciphers/cipher_aes_siv.inc
+providers/implementations/ciphers/cipher_aes_wrp.inc
+providers/implementations/ciphers/cipher_aes_xts.inc
+providers/implementations/ciphers/ciphercommon.inc
+providers/implementations/ciphers/ciphercommon_ccm.inc
+providers/implementations/ciphers/ciphercommon_gcm.inc
+providers/implementations/ciphers/cipher_chacha20.inc
+providers/implementations/ciphers/cipher_chacha20_poly1305.inc
+providers/implementations/ciphers/cipher_null.inc
+providers/implementations/ciphers/cipher_rc4_hmac_md5.inc
 providers/implementations/ciphers/cipher_sm2_xts.c
-providers/implementations/ciphers/cipher_sm4_xts.c
+providers/implementations/ciphers/cipher_sm4_xts.inc
 providers/implementations/digests/blake2_prov.c
 providers/implementations/digests/digestcommon.c
 providers/implementations/digests/mdc2_prov.c
index 061598eedd162d7ecefa99637de27a895a0d08f4..c2748d0702060063da1fcc8f673eba9e162f0226 100644 (file)
@@ -99,21 +99,21 @@ DEPEND[]=include/openssl/asn1.h \
          providers/implementations/storemgmt/file_store_any2obj.inc \
          providers/implementations/storemgmt/file_store.inc \
          providers/implementations/storemgmt/winstore_store.inc \
-         providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c \
-         providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.c \
-         providers/implementations/ciphers/cipher_aes_gcm_siv.c \
-         providers/implementations/ciphers/cipher_aes_ocb.c \
-         providers/implementations/ciphers/cipher_aes_siv.c \
-         providers/implementations/ciphers/cipher_aes_wrp.c \
-         providers/implementations/ciphers/cipher_aes_xts.c \
-         providers/implementations/ciphers/ciphercommon.c \
-         providers/implementations/ciphers/ciphercommon_ccm.c \
-         providers/implementations/ciphers/ciphercommon_gcm.c \
-         providers/implementations/ciphers/cipher_chacha20.c \
-         providers/implementations/ciphers/cipher_chacha20_poly1305.c \
-         providers/implementations/ciphers/cipher_null.c \
-         providers/implementations/ciphers/cipher_rc4_hmac_md5.c \
-         providers/implementations/ciphers/cipher_sm4_xts.c \
+         providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.inc \
+         providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.inc \
+         providers/implementations/ciphers/cipher_aes_gcm_siv.inc \
+         providers/implementations/ciphers/cipher_aes_ocb.inc \
+         providers/implementations/ciphers/cipher_aes_siv.inc \
+         providers/implementations/ciphers/cipher_aes_wrp.inc \
+         providers/implementations/ciphers/cipher_aes_xts.inc \
+         providers/implementations/ciphers/ciphercommon.inc \
+         providers/implementations/ciphers/ciphercommon_ccm.inc \
+         providers/implementations/ciphers/ciphercommon_gcm.inc \
+         providers/implementations/ciphers/cipher_chacha20.inc \
+         providers/implementations/ciphers/cipher_chacha20_poly1305.inc \
+         providers/implementations/ciphers/cipher_null.inc \
+         providers/implementations/ciphers/cipher_rc4_hmac_md5.inc \
+         providers/implementations/ciphers/cipher_sm4_xts.inc \
          providers/implementations/digests/blake2_prov.c \
          providers/implementations/digests/digestcommon.c \
          providers/implementations/digests/mdc2_prov.c \
@@ -217,21 +217,21 @@ DEPEND[providers/implementations/asymciphers/rsa_enc.inc \
        providers/implementations/storemgmt/file_store_any2obj.inc \
        providers/implementations/storemgmt/file_store.inc \
        providers/implementations/storemgmt/winstore_store.inc \
-       providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c \
-       providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.c \
-       providers/implementations/ciphers/cipher_aes_gcm_siv.c \
-       providers/implementations/ciphers/cipher_aes_ocb.c \
-       providers/implementations/ciphers/cipher_aes_siv.c \
-       providers/implementations/ciphers/cipher_aes_wrp.c \
-       providers/implementations/ciphers/cipher_aes_xts.c \
-       providers/implementations/ciphers/ciphercommon.c \
-       providers/implementations/ciphers/ciphercommon_ccm.c \
-       providers/implementations/ciphers/ciphercommon_gcm.c \
-       providers/implementations/ciphers/cipher_chacha20.c \
-       providers/implementations/ciphers/cipher_chacha20_poly1305.c \
-       providers/implementations/ciphers/cipher_null.c \
-       providers/implementations/ciphers/cipher_rc4_hmac_md5.c \
-       providers/implementations/ciphers/cipher_sm4_xts.c \
+       providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.inc \
+       providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.inc \
+       providers/implementations/ciphers/cipher_aes_gcm_siv.inc \
+       providers/implementations/ciphers/cipher_aes_ocb.inc \
+       providers/implementations/ciphers/cipher_aes_siv.inc \
+       providers/implementations/ciphers/cipher_aes_wrp.inc \
+       providers/implementations/ciphers/cipher_aes_xts.inc \
+       providers/implementations/ciphers/ciphercommon.inc \
+       providers/implementations/ciphers/ciphercommon_ccm.inc \
+       providers/implementations/ciphers/ciphercommon_gcm.inc \
+       providers/implementations/ciphers/cipher_chacha20.inc \
+       providers/implementations/ciphers/cipher_chacha20_poly1305.inc \
+       providers/implementations/ciphers/cipher_null.inc \
+       providers/implementations/ciphers/cipher_rc4_hmac_md5.inc \
+       providers/implementations/ciphers/cipher_sm4_xts.inc \
        providers/implementations/digests/blake2_prov.c \
        providers/implementations/digests/digestcommon.c \
        providers/implementations/digests/mdc2_prov.c \
@@ -353,36 +353,36 @@ GENERATE[providers/implementations/storemgmt/file_store.inc]=\
     providers/implementations/storemgmt/file_store.inc.in
 GENERATE[providers/implementations/storemgmt/winstore_store.inc]=\
     providers/implementations/storemgmt/winstore_store.inc.in
-GENERATE[providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c]=\
-    providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c.in
-GENERATE[providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.c]=\
-    providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.c.in
-GENERATE[providers/implementations/ciphers/cipher_aes_gcm_siv.c]=\
-    providers/implementations/ciphers/cipher_aes_gcm_siv.c.in
-GENERATE[providers/implementations/ciphers/cipher_aes_ocb.c]=\
-    providers/implementations/ciphers/cipher_aes_ocb.c.in
-GENERATE[providers/implementations/ciphers/cipher_aes_siv.c]=\
-    providers/implementations/ciphers/cipher_aes_siv.c.in
-GENERATE[providers/implementations/ciphers/cipher_aes_wrp.c]=\
-    providers/implementations/ciphers/cipher_aes_wrp.c.in
-GENERATE[providers/implementations/ciphers/cipher_aes_xts.c]=\
-    providers/implementations/ciphers/cipher_aes_xts.c.in
-GENERATE[providers/implementations/ciphers/ciphercommon.c]=\
-    providers/implementations/ciphers/ciphercommon.c.in
-GENERATE[providers/implementations/ciphers/ciphercommon_ccm.c]=\
-    providers/implementations/ciphers/ciphercommon_ccm.c.in
-GENERATE[providers/implementations/ciphers/ciphercommon_gcm.c]=\
-    providers/implementations/ciphers/ciphercommon_gcm.c.in
-GENERATE[providers/implementations/ciphers/cipher_chacha20.c]=\
-    providers/implementations/ciphers/cipher_chacha20.c.in
-GENERATE[providers/implementations/ciphers/cipher_chacha20_poly1305.c]=\
-    providers/implementations/ciphers/cipher_chacha20_poly1305.c.in
-GENERATE[providers/implementations/ciphers/cipher_null.c]=\
-    providers/implementations/ciphers/cipher_null.c.in
-GENERATE[providers/implementations/ciphers/cipher_rc4_hmac_md5.c]=\
-    providers/implementations/ciphers/cipher_rc4_hmac_md5.c.in
-GENERATE[providers/implementations/ciphers/cipher_sm4_xts.c]=\
-    providers/implementations/ciphers/cipher_sm4_xts.c.in
+GENERATE[providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.inc]=\
+    providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.inc.in
+GENERATE[providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.inc]=\
+    providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.inc.in
+GENERATE[providers/implementations/ciphers/cipher_aes_gcm_siv.inc]=\
+    providers/implementations/ciphers/cipher_aes_gcm_siv.inc.in
+GENERATE[providers/implementations/ciphers/cipher_aes_ocb.inc]=\
+    providers/implementations/ciphers/cipher_aes_ocb.inc.in
+GENERATE[providers/implementations/ciphers/cipher_aes_siv.inc]=\
+    providers/implementations/ciphers/cipher_aes_siv.inc.in
+GENERATE[providers/implementations/ciphers/cipher_aes_wrp.inc]=\
+    providers/implementations/ciphers/cipher_aes_wrp.inc.in
+GENERATE[providers/implementations/ciphers/cipher_aes_xts.inc]=\
+    providers/implementations/ciphers/cipher_aes_xts.inc.in
+GENERATE[providers/implementations/ciphers/ciphercommon.inc]=\
+    providers/implementations/ciphers/ciphercommon.inc.in
+GENERATE[providers/implementations/ciphers/ciphercommon_ccm.inc]=\
+    providers/implementations/ciphers/ciphercommon_ccm.inc.in
+GENERATE[providers/implementations/ciphers/ciphercommon_gcm.inc]=\
+    providers/implementations/ciphers/ciphercommon_gcm.inc.in
+GENERATE[providers/implementations/ciphers/cipher_chacha20.inc]=\
+    providers/implementations/ciphers/cipher_chacha20.inc.in
+GENERATE[providers/implementations/ciphers/cipher_chacha20_poly1305.inc]=\
+    providers/implementations/ciphers/cipher_chacha20_poly1305.inc.in
+GENERATE[providers/implementations/ciphers/cipher_null.inc]=\
+    providers/implementations/ciphers/cipher_null.inc.in
+GENERATE[providers/implementations/ciphers/cipher_rc4_hmac_md5.inc]=\
+    providers/implementations/ciphers/cipher_rc4_hmac_md5.inc.in
+GENERATE[providers/implementations/ciphers/cipher_sm4_xts.inc]=\
+    providers/implementations/ciphers/cipher_sm4_xts.inc.in
 GENERATE[providers/implementations/digests/blake2_prov.c]=\
     providers/implementations/digests/blake2_prov.c.in
 GENERATE[providers/implementations/digests/digestcommon.c]=\
similarity index 85%
rename from providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c.in
rename to providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c
index aba2a8a697ca5e13b5fbbbe0eb2eba6a11ffb6ac..38b2743712c5c6c63c24b62499cb9a42e502474e 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);
--}
 
 /*
  * AES low level APIs are deprecated for public use, but still ok for internal
@@ -33,6 +30,8 @@ const OSSL_DISPATCH ossl_##nm##kbits##sub##_functions[] = {                    \
 };
 #else
 
+# include "providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.inc"
+
 # define AES_CBC_HMAC_SHA_FLAGS (PROV_CIPHER_FLAG_AEAD                         \
                                  | PROV_CIPHER_FLAG_TLS1_MULTIBLOCK)
 
@@ -67,23 +66,6 @@ static int aes_dinit(void *ctx, const unsigned char *key, size_t keylen,
     return aes_set_ctx_params(ctx, params);
 }
 
-{- produce_param_decoder('aes_cbc_hmac_sha_set_ctx_params',
-                         (['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_SEND_FRAGMENT',
-                           'maxfrag',  'size_t',       "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
-                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD',
-                           'mb_aad',   'size_t',       "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
-                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE',
-                           'ileave',   'uint',         "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
-                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC',
-                           'enc',      'octet_string', "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
-                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_IN',
-                           'enc_in',   'octet_string', "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
-                          ['OSSL_CIPHER_PARAM_AEAD_MAC_KEY',  'key',    'octet_string'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD', 'tlsaad', 'octet_string'],
-                          ['OSSL_CIPHER_PARAM_KEYLEN',        'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_TLS_VERSION',   'tlsver', 'uint' ],
-                         )); -}
-
 const OSSL_PARAM *aes_settable_ctx_params(ossl_unused void *cctx,
                                           ossl_unused void *provctx)
 {
@@ -210,22 +192,6 @@ static int aes_set_ctx_params(void *vctx, const OSSL_PARAM params[])
     return ret;
 }
 
-{- produce_param_decoder('aes_cbc_hmac_sha_get_ctx_params',
-                         (['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_BUFSIZE',
-                           'max',     'size_t', "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
-                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE',
-                           'inter',   'uint',   "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
-                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD_PACKLEN',
-                           'packlen', 'uint',   "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
-                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_LEN',
-                           'enclen',  'size_t', "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
-                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD', 'pad',    'size_t'],
-                          ['OSSL_CIPHER_PARAM_KEYLEN',            'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IVLEN',             'ivlen',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_IV',                'iv',     'octet_string'],
-                          ['OSSL_CIPHER_PARAM_UPDATED_IV',        'upd_iv', 'octet_string'],
-                         )); -}
-
 static int aes_get_ctx_params(void *vctx, OSSL_PARAM params[])
 {
     PROV_AES_HMAC_SHA_CTX *ctx = (PROV_AES_HMAC_SHA_CTX *)vctx;
diff --git a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.inc.in b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.inc.in
new file mode 100644 (file)
index 0000000..5334896
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * 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('aes_cbc_hmac_sha_set_ctx_params',
+                         (['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_SEND_FRAGMENT',
+                           'maxfrag',  'size_t',       "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
+                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD',
+                           'mb_aad',   'size_t',       "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
+                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE',
+                           'ileave',   'uint',         "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
+                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC',
+                           'enc',      'octet_string', "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
+                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_IN',
+                           'enc_in',   'octet_string', "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
+                          ['OSSL_CIPHER_PARAM_AEAD_MAC_KEY',  'key',    'octet_string'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD', 'tlsaad', 'octet_string'],
+                          ['OSSL_CIPHER_PARAM_KEYLEN',        'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_TLS_VERSION',   'tlsver', 'uint' ],
+                         )); -}
+
+{- produce_param_decoder('aes_cbc_hmac_sha_get_ctx_params',
+                         (['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_BUFSIZE',
+                           'max',     'size_t', "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
+                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE',
+                           'inter',   'uint',   "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
+                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD_PACKLEN',
+                           'packlen', 'uint',   "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
+                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_LEN',
+                           'enclen',  'size_t', "#if !defined(OPENSSL_NO_MULTIBLOCK)"],
+                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD', 'pad',    'size_t'],
+                          ['OSSL_CIPHER_PARAM_KEYLEN',            'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IVLEN',             'ivlen',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_IV',                'iv',     'octet_string'],
+                          ['OSSL_CIPHER_PARAM_UPDATED_IV',        'upd_iv', 'octet_string'],
+                         )); -}
similarity index 93%
rename from providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.c.in
rename to providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.c
index 41299ba16a92136a63ebb94ca5aac9526813c4f3..f4e3a9e849fa189d5a39009823cc29726d267d72 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"
 
@@ -23,6 +20,9 @@ const OSSL_DISPATCH ossl_##nm##kbits##sub##_functions[] = {                    \
     OSSL_DISPATCH_END                                                          \
 };
 #else
+
+# include "providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.inc"
+
 static OSSL_FUNC_cipher_encrypt_init_fn aes_einit;
 static OSSL_FUNC_cipher_decrypt_init_fn aes_dinit;
 static OSSL_FUNC_cipher_gettable_ctx_params_fn aes_gettable_ctx_params;
@@ -32,12 +32,6 @@ static OSSL_FUNC_cipher_settable_ctx_params_fn aes_settable_ctx_params;
 # define aes_final ossl_cipher_generic_stream_final
 # define aes_cipher ossl_cipher_generic_cipher
 
-{- produce_param_decoder('aes_cbc_hmac_sha_etm_set_ctx_params',
-                         (['OSSL_CIPHER_PARAM_AEAD_MAC_KEY', 'key',    'octet_string'],
-                          ['OSSL_CIPHER_PARAM_KEYLEN',       'keylen', 'size_t'],
-                          ['OSSL_CIPHER_HMAC_PARAM_MAC',     'mac',    'octet_string'],
-                         )); -}
-
 static int aes_set_ctx_params(void *vctx, const OSSL_PARAM params[])
 {
     PROV_AES_HMAC_SHA_ETM_CTX *ctx = (PROV_AES_HMAC_SHA_ETM_CTX *)vctx;
@@ -106,14 +100,6 @@ static int aes_dinit(void *ctx, const unsigned char *key, size_t keylen,
     return aes_set_ctx_params(ctx, params);
 }
 
-{- produce_param_decoder('aes_cbc_hmac_sha_etm_get_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',     'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IVLEN',      'ivlen',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_IV',         'iv',     'octet_string'],
-                          ['OSSL_CIPHER_PARAM_UPDATED_IV', 'upd_iv', 'octet_string'],
-                          ['OSSL_CIPHER_HMAC_PARAM_MAC',   'mac',    'octet_string'],
-                         )); -}
-
 static int aes_get_ctx_params(void *vctx, OSSL_PARAM params[])
 {
     PROV_AES_HMAC_SHA_ETM_CTX *ctx = (PROV_AES_HMAC_SHA_ETM_CTX *)vctx;
diff --git a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.inc.in b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.inc.in
new file mode 100644 (file)
index 0000000..73ea528
--- /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('aes_cbc_hmac_sha_etm_set_ctx_params',
+                         (['OSSL_CIPHER_PARAM_AEAD_MAC_KEY', 'key',    'octet_string'],
+                          ['OSSL_CIPHER_PARAM_KEYLEN',       'keylen', 'size_t'],
+                          ['OSSL_CIPHER_HMAC_PARAM_MAC',     'mac',    'octet_string'],
+                         )); -}
+
+{- produce_param_decoder('aes_cbc_hmac_sha_etm_get_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',     'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IVLEN',      'ivlen',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_IV',         'iv',     'octet_string'],
+                          ['OSSL_CIPHER_PARAM_UPDATED_IV', 'upd_iv', 'octet_string'],
+                          ['OSSL_CIPHER_HMAC_PARAM_MAC',   'mac',    'octet_string'],
+                         )); -}
similarity index 94%
rename from providers/implementations/ciphers/cipher_aes_gcm_siv.c.in
rename to providers/implementations/ciphers/cipher_aes_gcm_siv.c
index 5c07965242f004b5d0dd2f7cf449ffe1f353d563..cffc08a376b9589ff0556cd907976c3c265875ef 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);
--}
 
 /* Dispatch functions for AES SIV mode */
 
@@ -24,6 +21,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "prov/ciphercommon_aead.h"
 #include "prov/provider_ctx.h"
 #include "cipher_aes_gcm_siv.h"
+#include "providers/implementations/ciphers/cipher_aes_gcm_siv.inc"
 
 static int ossl_aes_gcm_siv_set_ctx_params(void *vctx, const OSSL_PARAM params[]);
 
@@ -175,12 +173,6 @@ static int ossl_aes_gcm_siv_stream_final(void *vctx, unsigned char *out, size_t
     return !error;
 }
 
-{- produce_param_decoder('ossl_aes_gcm_siv_get_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',      'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAGLEN', 'taglen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAG',    'tag',    'octet_string'],
-                         )); -}
-
 static int ossl_aes_gcm_siv_get_ctx_params(void *vctx, OSSL_PARAM params[])
 {
     PROV_AES_GCM_SIV_CTX *ctx = (PROV_AES_GCM_SIV_CTX *)vctx;
@@ -217,12 +209,6 @@ static const OSSL_PARAM *ossl_aes_gcm_siv_gettable_ctx_params(ossl_unused void *
     return ossl_aes_gcm_siv_get_ctx_params_list;
 }
 
-{- produce_param_decoder('aes_gcm_siv_set_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',      'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_SPEED',       'speed',  'uint'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAG',    'tag',    'octet_string'],
-                         )); -}
-
 static int ossl_aes_gcm_siv_set_ctx_params(void *vctx, const OSSL_PARAM params[])
 {
     PROV_AES_GCM_SIV_CTX *ctx = (PROV_AES_GCM_SIV_CTX *)vctx;
diff --git a/providers/implementations/ciphers/cipher_aes_gcm_siv.inc.in b/providers/implementations/ciphers/cipher_aes_gcm_siv.inc.in
new file mode 100644 (file)
index 0000000..891d3b9
--- /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('ossl_aes_gcm_siv_get_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',      'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAGLEN', 'taglen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAG',    'tag',    'octet_string'],
+                         )); -}
+
+{- produce_param_decoder('aes_gcm_siv_set_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',      'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_SPEED',       'speed',  'uint'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAG',    'tag',    'octet_string'],
+                         )); -}
similarity index 95%
rename from providers/implementations/ciphers/cipher_aes_ocb.c.in
rename to providers/implementations/ciphers/cipher_aes_ocb.c
index 153c0d8fe8ce602e92ba62671c4d0d9a80a007c2..fd225c279054cd8c44ef36682fa69c781759b376 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);
--}
 
 /*
  * AES low level APIs are deprecated for public use, but still ok for internal
@@ -22,6 +19,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "prov/providercommon.h"
 #include "prov/ciphercommon_aead.h"
 #include "prov/implementations.h"
+#include "providers/implementations/ciphers/cipher_aes_ocb.inc"
 
 #define AES_OCB_FLAGS AEAD_FLAGS
 
@@ -353,12 +351,6 @@ static void *aes_ocb_dupctx(void *vctx)
     return ret;
 }
 
-{- produce_param_decoder('aes_ocb_set_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',     'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_IVLEN', 'ivlen',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAG',   'tag',    'octet_string'],
-                         )); -}
-
 static const OSSL_PARAM *cipher_ocb_settable_ctx_params(ossl_unused void *cctx,
                                                         ossl_unused void *p_ctx)
 {
@@ -428,15 +420,6 @@ static int aes_ocb_set_ctx_params(void *vctx, const OSSL_PARAM params[])
     return 1;
 }
 
-{- produce_param_decoder('aes_ocb_get_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',      'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IVLEN',       'ivlen',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAGLEN', 'taglen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IV',          'iv',     'octet_string'],
-                          ['OSSL_CIPHER_PARAM_UPDATED_IV',  'upd_iv', 'octet_string'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAG',    'tag',    'octet_string'],
-                         )); -}
-
 static const OSSL_PARAM *cipher_ocb_gettable_ctx_params(ossl_unused void *cctx,
                                                         ossl_unused void *p_ctx)
 {
diff --git a/providers/implementations/ciphers/cipher_aes_ocb.inc.in b/providers/implementations/ciphers/cipher_aes_ocb.inc.in
new file mode 100644 (file)
index 0000000..48c4689
--- /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('aes_ocb_set_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',     'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_IVLEN', 'ivlen',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAG',   'tag',    'octet_string'],
+                         )); -}
+
+{- produce_param_decoder('aes_ocb_get_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',      'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IVLEN',       'ivlen',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAGLEN', 'taglen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IV',          'iv',     'octet_string'],
+                          ['OSSL_CIPHER_PARAM_UPDATED_IV',  'upd_iv', 'octet_string'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAG',    'tag',    'octet_string'],
+                         )); -}
similarity index 93%
rename from providers/implementations/ciphers/cipher_aes_siv.c.in
rename to providers/implementations/ciphers/cipher_aes_siv.c
index 4ab9a248b066f720abfbb37108c76a0bf20d4f50..5166ef74161698941cd5c3be6c032aac19300368 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);
--}
 
 /* Dispatch functions for AES SIV mode */
 
@@ -24,6 +21,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "prov/providercommon.h"
 #include "prov/ciphercommon_aead.h"
 #include "prov/provider_ctx.h"
+#include "providers/implementations/ciphers/cipher_aes_siv.inc"
 
 #define siv_stream_update siv_cipher
 #define SIV_FLAGS AEAD_FLAGS
@@ -150,12 +148,6 @@ static int siv_stream_final(void *vctx, unsigned char *out, size_t *outl,
     return 1;
 }
 
-{- produce_param_decoder('aes_siv_get_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',      'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAGLEN', 'taglen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAG',    'tag',    'octet_string'],
-                         )); -}
-
 static int aes_siv_get_ctx_params(void *vctx, OSSL_PARAM params[])
 {
     PROV_AES_SIV_CTX *ctx = (PROV_AES_SIV_CTX *)vctx;
@@ -196,13 +188,6 @@ static const OSSL_PARAM *aes_siv_gettable_ctx_params(ossl_unused void *cctx,
     return aes_siv_get_ctx_params_list;
 }
 
-
-{- produce_param_decoder('aes_siv_set_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',   'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_SPEED',    'speed',  'uint'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAG', 'tag',    'octet_string'],
-                         )); -}
-
 static int aes_siv_set_ctx_params(void *vctx, const OSSL_PARAM params[])
 {
     PROV_AES_SIV_CTX *ctx = (PROV_AES_SIV_CTX *)vctx;
diff --git a/providers/implementations/ciphers/cipher_aes_siv.inc.in b/providers/implementations/ciphers/cipher_aes_siv.inc.in
new file mode 100644 (file)
index 0000000..cdbfd5e
--- /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('aes_siv_get_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',      'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAGLEN', 'taglen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAG',    'tag',    'octet_string'],
+                         )); -}
+
+{- produce_param_decoder('aes_siv_set_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',   'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_SPEED',    'speed',  'uint'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAG', 'tag',    'octet_string'],
+                         )); -}
similarity index 98%
rename from providers/implementations/ciphers/cipher_aes_wrp.c.in
rename to providers/implementations/ciphers/cipher_aes_wrp.c
index fc7d2f5e31f3613d42a09237dfc83df2ec5c9bf6..00c80774a534c2e63960a35cba469d2a923664a1 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);
--}
 
 /*
  * This file uses the low level AES functions (which are deprecated for
@@ -20,6 +17,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "cipher_aes.h"
 #include "prov/providercommon.h"
 #include "prov/implementations.h"
+#include "providers/implementations/ciphers/cipher_aes_wrp.inc"
 
 /* AES wrap with padding has IV length of 4, without padding 8 */
 #define AES_WRAP_PAD_IVLEN   4
@@ -49,7 +47,6 @@ typedef struct prov_aes_wrap_ctx_st {
 
 } PROV_AES_WRAP_CTX;
 
-
 static void *aes_wrap_newctx(size_t kbits, size_t blkbits,
                              size_t ivbits, unsigned int mode, uint64_t flags)
 {
@@ -263,10 +260,6 @@ static int aes_wrap_cipher(void *vctx,
     return 1;
 }
 
-{- produce_param_decoder('aes_wrap_set_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN', 'keylen', 'size_t'],
-                         )); -}
-
 static const OSSL_PARAM *aes_wrap_settable_ctx_params(ossl_unused void *cctx,
                                                       ossl_unused void *provctx)
 {
diff --git a/providers/implementations/ciphers/cipher_aes_wrp.inc.in b/providers/implementations/ciphers/cipher_aes_wrp.inc.in
new file mode 100644 (file)
index 0000000..3d2aa15
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * 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('aes_wrap_set_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN', 'keylen', 'size_t'],
+                         )); -}
similarity index 98%
rename from providers/implementations/ciphers/cipher_aes_xts.c.in
rename to providers/implementations/ciphers/cipher_aes_xts.c
index b408aa33ebdb610c2fa42e10d32fb1f968f861db..d2845660381694c83ab0c0d364cf0487502f0acd 100644 (file)
@@ -7,9 +7,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);
--}
 
 /*
  * AES low level APIs are deprecated for public use, but still ok for internal
@@ -22,6 +19,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "cipher_aes_xts.h"
 #include "prov/implementations.h"
 #include "prov/providercommon.h"
+#include "providers/implementations/ciphers/cipher_aes_xts.inc"
 
 #define AES_XTS_FLAGS PROV_CIPHER_FLAG_CUSTOM_IV
 #define AES_XTS_IV_BITS 128
@@ -244,10 +242,6 @@ static int aes_xts_stream_final(void *vctx, unsigned char *out, size_t *outl,
     return 1;
 }
 
-{- produce_param_decoder('aes_xts_set_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN', 'keylen', 'size_t'],
-                         )); -}
-
 static const OSSL_PARAM *aes_xts_settable_ctx_params(ossl_unused void *cctx,
                                                      ossl_unused void *provctx)
 {
diff --git a/providers/implementations/ciphers/cipher_aes_xts.inc.in b/providers/implementations/ciphers/cipher_aes_xts.inc.in
new file mode 100644 (file)
index 0000000..24eb61e
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * 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('aes_xts_set_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN', 'keylen', 'size_t'],
+                         )); -}
similarity index 93%
rename from providers/implementations/ciphers/cipher_chacha20.c.in
rename to providers/implementations/ciphers/cipher_chacha20.c
index 0e9a2d1109aa31ffaa76edd0687bc9d91ecd7397..0dd6f95cbafb64a43571b09dfa83091e8debdc69 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);
--}
 
 /* Dispatch functions for chacha20 cipher */
 
@@ -17,6 +14,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "cipher_chacha20.h"
 #include "prov/implementations.h"
 #include "prov/providercommon.h"
+#include "providers/implementations/ciphers/cipher_chacha20.inc"
 
 #define CHACHA20_KEYLEN (CHACHA_KEY_SIZE)
 #define CHACHA20_BLKLEN (1)
@@ -103,12 +101,6 @@ static int chacha20_get_params(OSSL_PARAM params[])
                                           CHACHA20_IVLEN * 8);
 }
 
-{- produce_param_decoder('chacha20_get_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',     'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IVLEN',      'ivlen',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_UPDATED_IV', 'upd_iv', 'octet_string'],
-                         )); -}
-
 static int chacha20_get_ctx_params(void *vctx, OSSL_PARAM params[])
 {
     PROV_CHACHA20_CTX *ctx = (PROV_CHACHA20_CTX *)vctx;
@@ -147,11 +139,6 @@ const OSSL_PARAM *chacha20_gettable_ctx_params(ossl_unused void *cctx,
     return chacha20_get_ctx_params_list;
 }
 
-{- produce_param_decoder('chacha20_set_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN', 'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IVLEN',  'ivlen',  'size_t'],
-                         )); -}
-
 static int chacha20_set_ctx_params(void *vctx, const OSSL_PARAM params[])
 {
     PROV_CHACHA20_CTX *ctx = (PROV_CHACHA20_CTX *)vctx;
@@ -249,4 +236,3 @@ const OSSL_DISPATCH ossl_chacha20_functions[] = {
         (void (*)(void))chacha20_settable_ctx_params },
     OSSL_DISPATCH_END
 };
-
diff --git a/providers/implementations/ciphers/cipher_chacha20.inc.in b/providers/implementations/ciphers/cipher_chacha20.inc.in
new file mode 100644 (file)
index 0000000..aa64e6a
--- /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('chacha20_get_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',     'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IVLEN',      'ivlen',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_UPDATED_IV', 'upd_iv', 'octet_string'],
+                         )); -}
+
+{- produce_param_decoder('chacha20_set_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN', 'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IVLEN',  'ivlen',  'size_t'],
+                         )); -}
similarity index 91%
rename from providers/implementations/ciphers/cipher_chacha20_poly1305.c.in
rename to providers/implementations/ciphers/cipher_chacha20_poly1305.c
index 4ef3ed5e060b7f743256cde47610ef8c94ce532e..a6f88386de4b6ba822b4466199393a1843f5e840 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);
--}
 
 /* Dispatch functions for chacha20_poly1305 cipher */
 
@@ -17,6 +14,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "cipher_chacha20_poly1305.h"
 #include "prov/implementations.h"
 #include "prov/providercommon.h"
+#include "providers/implementations/ciphers/cipher_chacha20_poly1305.inc"
 
 #define CHACHA20_POLY1305_KEYLEN CHACHA_KEY_SIZE
 #define CHACHA20_POLY1305_BLKLEN 1
@@ -100,14 +98,6 @@ static int chacha20_poly1305_get_params(OSSL_PARAM params[])
                                           CHACHA20_POLY1305_IVLEN * 8);
 }
 
-{- produce_param_decoder('chacha20_poly1305_get_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',            'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IVLEN',             'ivlen',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAGLEN',       'taglen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAG',          'tag',    'octet_string'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD', 'pad',    'size_t'],
-                         )); -}
-
 static int chacha20_poly1305_get_ctx_params(void *vctx, OSSL_PARAM params[])
 {
     PROV_CHACHA20_POLY1305_CTX *ctx = (PROV_CHACHA20_POLY1305_CTX *)vctx;
@@ -164,14 +154,6 @@ static const OSSL_PARAM *chacha20_poly1305_gettable_ctx_params
     return chacha20_poly1305_get_ctx_params_list;
 }
 
-{- produce_param_decoder('chacha20_poly1305_set_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',             'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IVLEN',              'ivlen',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAG',           'tag',    'octet_string'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD',      'aad',    'octet_string'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_IV_FIXED', 'fixed',  'octet_string'],
-                         )); -}
-
 static const OSSL_PARAM *chacha20_poly1305_settable_ctx_params(
         ossl_unused void *cctx, ossl_unused void *provctx
     )
@@ -191,7 +173,6 @@ static int chacha20_poly1305_set_ctx_params(void *vctx,
     if (!chacha20_poly1305_set_ctx_params_decoder(params, &p))
         return 0;
 
-
     if (p.keylen != NULL) {
         if (!OSSL_PARAM_get_size_t(p.keylen, &len)) {
             ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
@@ -374,4 +355,3 @@ const OSSL_DISPATCH ossl_chacha20_ossl_poly1305_functions[] = {
         (void (*)(void))chacha20_poly1305_settable_ctx_params },
     OSSL_DISPATCH_END
 };
-
diff --git a/providers/implementations/ciphers/cipher_chacha20_poly1305.inc.in b/providers/implementations/ciphers/cipher_chacha20_poly1305.inc.in
new file mode 100644 (file)
index 0000000..2a42ca8
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * 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('chacha20_poly1305_get_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',            'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IVLEN',             'ivlen',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAGLEN',       'taglen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAG',          'tag',    'octet_string'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD', 'pad',    'size_t'],
+                         )); -}
+
+{- produce_param_decoder('chacha20_poly1305_set_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',             'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IVLEN',              'ivlen',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAG',           'tag',    'octet_string'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD',      'aad',    'octet_string'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_IV_FIXED', 'fixed',  'octet_string'],
+                         )); -}
similarity index 91%
rename from providers/implementations/ciphers/cipher_null.c.in
rename to providers/implementations/ciphers/cipher_null.c
index 3a64dfe646be7f9c2e031e19ecf271670318914f..b9d75a506396dd22573a1d9c5a04a698be385159 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/crypto.h>
@@ -17,6 +14,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "prov/implementations.h"
 #include "prov/ciphercommon.h"
 #include "prov/providercommon.h"
+#include "providers/implementations/ciphers/cipher_null.inc"
 
 typedef struct prov_cipher_null_ctx_st {
     int enc;
@@ -108,12 +106,6 @@ static int null_get_params(OSSL_PARAM params[])
     return ossl_cipher_generic_get_params(params, 0, 0, 0, 8, 0);
 }
 
-{- produce_param_decoder('null_get_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',  'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IVLEN',   'ivlen',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_TLS_MAC', 'mac',    'octet_ptr'],
-                         )); -}
-
 static OSSL_FUNC_cipher_gettable_ctx_params_fn null_gettable_ctx_params;
 static const OSSL_PARAM *null_gettable_ctx_params(ossl_unused void *cctx,
                                                   ossl_unused void *provctx)
@@ -148,10 +140,6 @@ static int null_get_ctx_params(void *vctx, OSSL_PARAM params[])
     return 1;
 }
 
-{- produce_param_decoder('null_set_ctx_params',
-                         (['OSSL_CIPHER_PARAM_TLS_MAC_SIZE', 'macsize', 'size_t'],
-                         )); -}
-
 static OSSL_FUNC_cipher_settable_ctx_params_fn null_settable_ctx_params;
 static const OSSL_PARAM *null_settable_ctx_params(ossl_unused void *cctx,
                                                   ossl_unused void *provctx)
@@ -159,7 +147,6 @@ static const OSSL_PARAM *null_settable_ctx_params(ossl_unused void *cctx,
     return null_set_ctx_params_list;
 }
 
-
 static OSSL_FUNC_cipher_set_ctx_params_fn null_set_ctx_params;
 static int null_set_ctx_params(void *vctx, const OSSL_PARAM params[])
 {
diff --git a/providers/implementations/ciphers/cipher_null.inc.in b/providers/implementations/ciphers/cipher_null.inc.in
new file mode 100644 (file)
index 0000000..73ee633
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * 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('null_get_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',  'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IVLEN',   'ivlen',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_TLS_MAC', 'mac',    'octet_ptr'],
+                         )); -}
+
+{- produce_param_decoder('null_set_ctx_params',
+                         (['OSSL_CIPHER_PARAM_TLS_MAC_SIZE', 'macsize', 'size_t'],
+                         )); -}
similarity index 90%
rename from providers/implementations/ciphers/cipher_rc4_hmac_md5.c.in
rename to providers/implementations/ciphers/cipher_rc4_hmac_md5.c
index 1685aba70247248bc107bce6c601bd910e91cebe..a96d3527860c964703db9bc64982da05245a9cee 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);
--}
 
 /* Dispatch functions for RC4_HMAC_MD5 cipher */
 
@@ -22,6 +19,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "cipher_rc4_hmac_md5.h"
 #include "prov/implementations.h"
 #include "prov/providercommon.h"
+#include "providers/implementations/ciphers/cipher_rc4_hmac_md5.inc"
 
 #define RC4_HMAC_MD5_FLAGS (PROV_CIPHER_FLAG_VARIABLE_LENGTH                   \
                             | PROV_CIPHER_FLAG_AEAD)
@@ -102,12 +100,6 @@ static int rc4_hmac_md5_dinit(void *ctx, const unsigned char *key,
     return rc4_hmac_md5_set_ctx_params(ctx, params);
 }
 
-{- produce_param_decoder('rc4_hmac_md5_get_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',            'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IVLEN',             'ivlen',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD', 'pad',    'size_t'],
-                         )); -}
-
 static const OSSL_PARAM *rc4_hmac_md5_gettable_ctx_params(ossl_unused void *cctx,
                                                           ossl_unused void *provctx)
 {
@@ -139,14 +131,6 @@ static int rc4_hmac_md5_get_ctx_params(void *vctx, OSSL_PARAM params[])
     return 1;
 }
 
-{- produce_param_decoder('rc4_hmac_md5_set_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',        'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IVLEN',         'ivlen',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD', 'aad',    'octet_string'],
-                          ['OSSL_CIPHER_PARAM_AEAD_MAC_KEY',  'mackey', 'octet_string'],
-                          ['OSSL_CIPHER_PARAM_TLS_VERSION',   'tlsver', 'uint'],
-                         )); -}
-
 static const OSSL_PARAM *rc4_hmac_md5_settable_ctx_params(ossl_unused void *cctx,
                                                           ossl_unused void *provctx)
 {
diff --git a/providers/implementations/ciphers/cipher_rc4_hmac_md5.inc.in b/providers/implementations/ciphers/cipher_rc4_hmac_md5.inc.in
new file mode 100644 (file)
index 0000000..0eef707
--- /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('rc4_hmac_md5_get_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',            'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IVLEN',             'ivlen',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD', 'pad',    'size_t'],
+                         )); -}
+
+{- produce_param_decoder('rc4_hmac_md5_set_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',        'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IVLEN',         'ivlen',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD', 'aad',    'octet_string'],
+                          ['OSSL_CIPHER_PARAM_AEAD_MAC_KEY',  'mackey', 'octet_string'],
+                          ['OSSL_CIPHER_PARAM_TLS_VERSION',   'tlsver', 'uint'],
+                         )); -}
similarity index 97%
rename from providers/implementations/ciphers/cipher_sm4_xts.c.in
rename to providers/implementations/ciphers/cipher_sm4_xts.c
index 427e553a4d3a7e0a3e6c4ab96191d6f89384284a..36462623df3ea8979715cf6c9999b9062ef2d263 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);
--}
 
 /* Dispatch functions for SM4 XTS mode */
 
@@ -16,6 +13,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "cipher_sm4_xts.h"
 #include "prov/implementations.h"
 #include "prov/providercommon.h"
+#include "providers/implementations/ciphers/cipher_sm4_xts.inc"
 
 #define SM4_XTS_FLAGS PROV_CIPHER_FLAG_CUSTOM_IV
 #define SM4_XTS_IV_BITS 128
@@ -191,10 +189,6 @@ static int sm4_xts_stream_final(void *vctx, unsigned char *out, size_t *outl,
     return 1;
 }
 
-{- produce_param_decoder('sm4_xts_set_ctx_params',
-                         (['OSSL_CIPHER_PARAM_XTS_STANDARD', 'std', 'utf8_string'],
-                         )); -}
-
 static const OSSL_PARAM *sm4_xts_settable_ctx_params(ossl_unused void *cctx,
                                                      ossl_unused void *provctx)
 {
diff --git a/providers/implementations/ciphers/cipher_sm4_xts.inc.in b/providers/implementations/ciphers/cipher_sm4_xts.inc.in
new file mode 100644 (file)
index 0000000..b9759dd
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * 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('sm4_xts_set_ctx_params',
+                         (['OSSL_CIPHER_PARAM_XTS_STANDARD', 'std', 'utf8_string'],
+                         )); -}
similarity index 88%
rename from providers/implementations/ciphers/ciphercommon.c.in
rename to providers/implementations/ciphers/ciphercommon.c
index b0d88f89d8e7a4d910ad80c34466eb04f59d3da3..f17abf849a81e688abfa56b44691286fbb3d21d3 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);
--}
 
 /*
  * Generic dispatch table functions for ciphers.
@@ -25,21 +22,15 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "internal/e_os.h"
 #include "crypto/types.h"
 
+#define cipher_generic_get_ctx_params_st    ossl_cipher_get_ctx_param_list_st
+#define cipher_generic_set_ctx_params_st    ossl_cipher_set_ctx_param_list_st
+#define cipher_var_keylen_set_ctx_params_st ossl_cipher_set_ctx_param_list_st
+
+#include "providers/implementations/ciphers/ciphercommon.inc"
+
 /*-
  * Generic cipher functions for OSSL_PARAM gettables and settables
  */
-{- produce_param_decoder('ossl_cipher_generic_get_params',
-                         (['OSSL_CIPHER_PARAM_MODE',             'mode',   'uint'],
-                          ['OSSL_CIPHER_PARAM_KEYLEN',           'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IVLEN',            'ivlen',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_BLOCK_SIZE',       'bsize',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD',             'aead',   'int' ],
-                          ['OSSL_CIPHER_PARAM_CUSTOM_IV',        'custiv', 'int' ],
-                          ['OSSL_CIPHER_PARAM_CTS',              'cts',    'int' ],
-                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK',  'mb',     'int' ],
-                          ['OSSL_CIPHER_PARAM_HAS_RAND_KEY',     'rand',   'int' ],
-                          ['OSSL_CIPHER_PARAM_ENCRYPT_THEN_MAC', 'etm',    'int' ],
-                         )); -}
 
 const OSSL_PARAM *ossl_cipher_generic_gettable_params(ossl_unused void *provctx)
 {
@@ -104,34 +95,12 @@ int ossl_cipher_generic_get_params(OSSL_PARAM params[], unsigned int md,
     return 1;
 }
 
-#define cipher_generic_get_ctx_params_st    ossl_cipher_get_ctx_param_list_st
-
-{- produce_param_decoder('cipher_generic_get_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',     'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IVLEN',      'ivlen',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_PADDING',    'pad',    'uint'],
-                          ['OSSL_CIPHER_PARAM_NUM',        'num',    'uint' ],
-                          ['OSSL_CIPHER_PARAM_IV',         'iv',     'octet_string' ],
-                          ['OSSL_CIPHER_PARAM_UPDATED_IV', 'updiv',  'octet_string' ],
-                          ['OSSL_CIPHER_PARAM_TLS_MAC',    'tlsmac', 'octet_string' ],
-                         )); -}
-
 const OSSL_PARAM *ossl_cipher_generic_gettable_ctx_params
         (ossl_unused void *cctx, ossl_unused void *provctx)
 {
     return cipher_generic_get_ctx_params_list;
 }
 
-#define cipher_generic_set_ctx_params_st    ossl_cipher_set_ctx_param_list_st
-
-{- produce_param_decoder('cipher_generic_set_ctx_params',
-                         (['OSSL_CIPHER_PARAM_PADDING',      'pad',         'uint'],
-                          ['OSSL_CIPHER_PARAM_NUM',          'num',         'uint'],
-                          ['OSSL_CIPHER_PARAM_USE_BITS',     'bits',        'uint'],
-                          ['OSSL_CIPHER_PARAM_TLS_VERSION',  'tlsvers',     'uint'],
-                          ['OSSL_CIPHER_PARAM_TLS_MAC_SIZE', 'tlsmacsize',  'size_t'],
-                         )); -}
-
 const OSSL_PARAM *ossl_cipher_generic_settable_ctx_params
         (ossl_unused void *cctx, ossl_unused void *provctx)
 {
@@ -141,16 +110,6 @@ const OSSL_PARAM *ossl_cipher_generic_settable_ctx_params
 /*
  * Variable key length cipher functions for OSSL_PARAM settables
  */
-#define cipher_var_keylen_set_ctx_params_st ossl_cipher_set_ctx_param_list_st
-
-{- produce_param_decoder('cipher_var_keylen_set_ctx_params',
-                         (['OSSL_CIPHER_PARAM_PADDING',      'pad',         'uint'],
-                          ['OSSL_CIPHER_PARAM_NUM',          'num',         'uint'],
-                          ['OSSL_CIPHER_PARAM_USE_BITS',     'bits',        'uint'],
-                          ['OSSL_CIPHER_PARAM_TLS_VERSION',  'tlsvers',     'uint'],
-                          ['OSSL_CIPHER_PARAM_TLS_MAC_SIZE', 'tlsmacsize',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_KEYLEN',       'keylen',      'size_t'],
-                         )); -}
 
 const OSSL_PARAM *ossl_cipher_var_keylen_settable_ctx_params
         (ossl_unused void *cctx, ossl_unused void *provctx)
@@ -337,7 +296,6 @@ int ossl_cipher_generic_block_update(void *vctx, unsigned char *out,
             return 0;
         }
 
-
         /* Shouldn't normally fail */
         if (!ctx->hw->cipher(ctx, out, in, inl)) {
             ERR_raise(ERR_LIB_PROV, PROV_R_CIPHER_OPERATION_FAILED);
diff --git a/providers/implementations/ciphers/ciphercommon.inc.in b/providers/implementations/ciphers/ciphercommon.inc.in
new file mode 100644 (file)
index 0000000..997453d
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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('ossl_cipher_generic_get_params',
+                         (['OSSL_CIPHER_PARAM_MODE',             'mode',   'uint'],
+                          ['OSSL_CIPHER_PARAM_KEYLEN',           'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IVLEN',            'ivlen',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_BLOCK_SIZE',       'bsize',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD',             'aead',   'int' ],
+                          ['OSSL_CIPHER_PARAM_CUSTOM_IV',        'custiv', 'int' ],
+                          ['OSSL_CIPHER_PARAM_CTS',              'cts',    'int' ],
+                          ['OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK',  'mb',     'int' ],
+                          ['OSSL_CIPHER_PARAM_HAS_RAND_KEY',     'rand',   'int' ],
+                          ['OSSL_CIPHER_PARAM_ENCRYPT_THEN_MAC', 'etm',    'int' ],
+                         )); -}
+
+{- produce_param_decoder('cipher_generic_get_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',     'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IVLEN',      'ivlen',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_PADDING',    'pad',    'uint'],
+                          ['OSSL_CIPHER_PARAM_NUM',        'num',    'uint' ],
+                          ['OSSL_CIPHER_PARAM_IV',         'iv',     'octet_string' ],
+                          ['OSSL_CIPHER_PARAM_UPDATED_IV', 'updiv',  'octet_string' ],
+                          ['OSSL_CIPHER_PARAM_TLS_MAC',    'tlsmac', 'octet_string' ],
+                         )); -}
+
+{- produce_param_decoder('cipher_generic_set_ctx_params',
+                         (['OSSL_CIPHER_PARAM_PADDING',      'pad',         'uint'],
+                          ['OSSL_CIPHER_PARAM_NUM',          'num',         'uint'],
+                          ['OSSL_CIPHER_PARAM_USE_BITS',     'bits',        'uint'],
+                          ['OSSL_CIPHER_PARAM_TLS_VERSION',  'tlsvers',     'uint'],
+                          ['OSSL_CIPHER_PARAM_TLS_MAC_SIZE', 'tlsmacsize',  'size_t'],
+                         )); -}
+
+{- produce_param_decoder('cipher_var_keylen_set_ctx_params',
+                         (['OSSL_CIPHER_PARAM_PADDING',      'pad',         'uint'],
+                          ['OSSL_CIPHER_PARAM_NUM',          'num',         'uint'],
+                          ['OSSL_CIPHER_PARAM_USE_BITS',     'bits',        'uint'],
+                          ['OSSL_CIPHER_PARAM_TLS_VERSION',  'tlsvers',     'uint'],
+                          ['OSSL_CIPHER_PARAM_TLS_MAC_SIZE', 'tlsmacsize',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_KEYLEN',       'keylen',      'size_t'],
+                         )); -}
similarity index 91%
rename from providers/implementations/ciphers/ciphercommon_ccm.c.in
rename to providers/implementations/ciphers/ciphercommon_ccm.c
index 922312773c503a45260336b3ea6ca98e4530c2e3..8089f5306ff4506900a6db0f255e6e1c969e2528 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);
--}
 
 /* Dispatch functions for ccm mode */
 
@@ -17,6 +14,7 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "prov/ciphercommon_ccm.h"
 #include "prov/providercommon.h"
 
+#include "providers/implementations/ciphers/ciphercommon_ccm.inc"
 
 static int ccm_cipher_internal(PROV_CCM_CTX *ctx, unsigned char *out,
                                size_t *padlen, const unsigned char *in,
@@ -69,13 +67,6 @@ static size_t ccm_get_ivlen(PROV_CCM_CTX *ctx)
     return 15 - ctx->l;
 }
 
-{- produce_param_decoder('ossl_cipher_ccm_set_ctx_params',
-                         (['OSSL_CIPHER_PARAM_AEAD_IVLEN',           'ivlen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAG',             'tag',   'octet_string'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD',        'aad',   'octet_string'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_IV_FIXED',   'fixed', 'octet_string'],
-                         )); -}
-
 const OSSL_PARAM *ossl_ccm_settable_ctx_params(
         ossl_unused void *cctx, ossl_unused void *provctx
     )
@@ -155,16 +146,6 @@ int ossl_ccm_set_ctx_params(void *vctx, const OSSL_PARAM params[])
     return 1;
 }
 
-{- produce_param_decoder('ossl_cipher_ccm_get_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',               'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IVLEN',                'ivlen',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAGLEN',          'taglen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IV',                   'iv',     'octet_string'],
-                          ['OSSL_CIPHER_PARAM_UPDATED_IV',           'updiv',  'octet_string'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAG',             'tag',    'octet_string'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD',    'pad',    'size_t'],
-                         )); -}
-
 const OSSL_PARAM *ossl_ccm_gettable_ctx_params(
         ossl_unused void *cctx, ossl_unused void *provctx
     )
diff --git a/providers/implementations/ciphers/ciphercommon_ccm.inc.in b/providers/implementations/ciphers/ciphercommon_ccm.inc.in
new file mode 100644 (file)
index 0000000..5be0a4c
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * 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('ossl_cipher_ccm_set_ctx_params',
+                         (['OSSL_CIPHER_PARAM_AEAD_IVLEN',           'ivlen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAG',             'tag',   'octet_string'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD',        'aad',   'octet_string'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_IV_FIXED',   'fixed', 'octet_string'],
+                         )); -}
+
+{- produce_param_decoder('ossl_cipher_ccm_get_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',               'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IVLEN',                'ivlen',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAGLEN',          'taglen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IV',                   'iv',     'octet_string'],
+                          ['OSSL_CIPHER_PARAM_UPDATED_IV',           'updiv',  'octet_string'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAG',             'tag',    'octet_string'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD',    'pad',    'size_t'],
+                         )); -}
similarity index 92%
rename from providers/implementations/ciphers/ciphercommon_gcm.c.in
rename to providers/implementations/ciphers/ciphercommon_gcm.c
index 08417687ebab271996048ea72ccbbb412427d167..5bad232bfdf83d20fade14d0e8ce080abb51fe52 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);
--}
 
 /* Dispatch functions for gcm mode */
 
@@ -19,6 +16,8 @@ use OpenSSL::paramnames qw(produce_param_decoder);
 #include "prov/providercommon.h"
 #include "prov/provider_ctx.h"
 
+#include "providers/implementations/ciphers/ciphercommon_gcm.inc"
+
 static int gcm_tls_init(PROV_GCM_CTX *dat, unsigned char *aad, size_t aad_len);
 static int gcm_tls_iv_set_fixed(PROV_GCM_CTX *ctx, unsigned char *iv,
                                 size_t len);
@@ -143,18 +142,6 @@ static int setivinv(PROV_GCM_CTX *ctx, unsigned char *in, size_t inl)
     return 1;
 }
 
-{- produce_param_decoder('ossl_cipher_gcm_get_ctx_params',
-                         (['OSSL_CIPHER_PARAM_KEYLEN',               'keylen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IVLEN',                'ivlen',  'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAGLEN',          'taglen', 'size_t'],
-                          ['OSSL_CIPHER_PARAM_IV',                   'iv',     'octet_string'],
-                          ['OSSL_CIPHER_PARAM_UPDATED_IV',           'updiv',  'octet_string'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TAG',             'tag',    'octet_string'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD',    'pad',    'size_t'],
-                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_GET_IV_GEN', 'ivgen',  'octet_string'],
-                          ['OSSL_CIPHER_PARAM_AEAD_IV_GENERATED',    'gen',    'uint'],
-                         )); -}
-
 const OSSL_PARAM *ossl_gcm_gettable_ctx_params(
         ossl_unused void *cctx, ossl_unused void *provctx
     )
@@ -249,15 +236,6 @@ int ossl_gcm_get_ctx_params(void *vctx, OSSL_PARAM params[])
     return 1;
 }
 
-{- produce_param_decoder
-        ('ossl_cipher_gcm_set_ctx_params',
-         (['OSSL_CIPHER_PARAM_AEAD_IVLEN',           'ivlen', 'size_t'],
-          ['OSSL_CIPHER_PARAM_AEAD_TAG',             'tag',   'octet_string'],
-          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD',        'aad',   'octet_string'],
-          ['OSSL_CIPHER_PARAM_AEAD_TLS1_IV_FIXED',   'fixed', 'octet_string'],
-          ['OSSL_CIPHER_PARAM_AEAD_TLS1_SET_IV_INV', 'inviv', 'octet_string'],
-         )); -}
-
 const OSSL_PARAM *ossl_gcm_settable_ctx_params(
         ossl_unused void *cctx, ossl_unused void *provctx
     )
diff --git a/providers/implementations/ciphers/ciphercommon_gcm.inc.in b/providers/implementations/ciphers/ciphercommon_gcm.inc.in
new file mode 100644 (file)
index 0000000..abee568
--- /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('ossl_cipher_gcm_get_ctx_params',
+                         (['OSSL_CIPHER_PARAM_KEYLEN',               'keylen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IVLEN',                'ivlen',  'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAGLEN',          'taglen', 'size_t'],
+                          ['OSSL_CIPHER_PARAM_IV',                   'iv',     'octet_string'],
+                          ['OSSL_CIPHER_PARAM_UPDATED_IV',           'updiv',  'octet_string'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TAG',             'tag',    'octet_string'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD',    'pad',    'size_t'],
+                          ['OSSL_CIPHER_PARAM_AEAD_TLS1_GET_IV_GEN', 'ivgen',  'octet_string'],
+                          ['OSSL_CIPHER_PARAM_AEAD_IV_GENERATED',    'gen',    'uint'],
+                         )); -}
+
+{- produce_param_decoder
+        ('ossl_cipher_gcm_set_ctx_params',
+         (['OSSL_CIPHER_PARAM_AEAD_IVLEN',           'ivlen', 'size_t'],
+          ['OSSL_CIPHER_PARAM_AEAD_TAG',             'tag',   'octet_string'],
+          ['OSSL_CIPHER_PARAM_AEAD_TLS1_AAD',        'aad',   'octet_string'],
+          ['OSSL_CIPHER_PARAM_AEAD_TLS1_IV_FIXED',   'fixed', 'octet_string'],
+          ['OSSL_CIPHER_PARAM_AEAD_TLS1_SET_IV_INV', 'inviv', 'octet_string'],
+         )); -}