Commit 929a94a5fe for openssl.org

commit 929a94a5fe9a32f7d3251719ae36bf831878f247
Author: Pauli <paul.dale@oracle.com>
Date:   Fri Aug 28 07:47:50 2026 +1000

    cts: remove unrequited .inc files

    There is nothing special about these after the CTS refactoring, so they can
    be merged inline.

    Reviewed-by: Simo Sorce <simo@redhat.com>
    Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
    Merge-date: Thu Sep  3 02:17:07 2026
    Merged-from: https://github.com/openssl/openssl/pull/32536

diff --git a/providers/implementations/ciphers/cipher_aes.c b/providers/implementations/ciphers/cipher_aes.c
index 0bb6b2fdf1..de6e197f5d 100644
--- a/providers/implementations/ciphers/cipher_aes.c
+++ b/providers/implementations/ciphers/cipher_aes.c
@@ -14,14 +14,17 @@
  */
 #include "internal/deprecated.h"

-/* Dispatch functions for AES cipher modes ecb, cbc, ofb, cfb, ctr */
+/* Dispatch functions for AES cipher modes ecb, cbc, cts, ofb, cfb, ctr */

+#include "cipher_cts.h"
 #include "cipher_aes.h"
 #include "prov/implementations.h"
 #include "prov/providercommon.h"

 static OSSL_FUNC_cipher_freectx_fn aes_freectx;
 static OSSL_FUNC_cipher_dupctx_fn aes_dupctx;
+static OSSL_FUNC_cipher_encrypt_init_fn aes_cbc_cts_einit;
+static OSSL_FUNC_cipher_decrypt_init_fn aes_cbc_cts_dinit;

 static void aes_freectx(void *vctx)
 {
@@ -50,6 +53,24 @@ static void *aes_dupctx(void *ctx)
     return ret;
 }

+static int aes_cbc_cts_einit(void *ctx, const unsigned char *key, size_t keylen,
+    const unsigned char *iv, size_t ivlen,
+    const OSSL_PARAM params[])
+{
+    if (!ossl_cipher_generic_einit(ctx, key, keylen, iv, ivlen, NULL))
+        return 0;
+    return ossl_cipher_cbc_cts_set_ctx_params(ctx, params);
+}
+
+static int aes_cbc_cts_dinit(void *ctx, const unsigned char *key, size_t keylen,
+    const unsigned char *iv, size_t ivlen,
+    const OSSL_PARAM params[])
+{
+    if (!ossl_cipher_generic_dinit(ctx, key, keylen, iv, ivlen, NULL))
+        return 0;
+    return ossl_cipher_cbc_cts_set_ctx_params(ctx, params);
+}
+
 /* ossl_aes256ecb_functions */
 IMPLEMENT_generic_cipher(aes, AES, ecb, ECB, 0, 256, 128, 0, block)
 /* ossl_aes192ecb_functions */
@@ -93,4 +114,9 @@ IMPLEMENT_generic_cipher(aes, AES, ctr, CTR, 0, 192, 8, 128, stream)
 /* ossl_aes128ctr_functions */
 IMPLEMENT_generic_cipher(aes, AES, ctr, CTR, 0, 128, 8, 128, stream)

-#include "cipher_aes_cts.inc"
+/* ossl_aes256cbc_cts_functions */
+IMPLEMENT_cts_cipher(aes, AES, cbc, CBC, PROV_CIPHER_FLAG_CTS, 256, 128, 128, block)
+/* ossl_aes192cbc_cts_functions */
+IMPLEMENT_cts_cipher(aes, AES, cbc, CBC, PROV_CIPHER_FLAG_CTS, 192, 128, 128, block)
+/* ossl_aes128cbc_cts_functions */
+IMPLEMENT_cts_cipher(aes, AES, cbc, CBC, PROV_CIPHER_FLAG_CTS, 128, 128, 128, block)
diff --git a/providers/implementations/ciphers/cipher_aes_cts.inc b/providers/implementations/ciphers/cipher_aes_cts.inc
deleted file mode 100644
index 2fff8e917d..0000000000
--- a/providers/implementations/ciphers/cipher_aes_cts.inc
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2020-2021 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
- */
-
-/* Dispatch functions for AES CBC CTS ciphers */
-
-#include "cipher_cts.h"
-
-#define CTS_FLAGS PROV_CIPHER_FLAG_CTS
-
-static OSSL_FUNC_cipher_encrypt_init_fn aes_cbc_cts_einit;
-static OSSL_FUNC_cipher_decrypt_init_fn aes_cbc_cts_dinit;
-
-static int aes_cbc_cts_einit(void *ctx, const unsigned char *key, size_t keylen,
-                             const unsigned char *iv, size_t ivlen,
-                             const OSSL_PARAM params[])
-{
-    if (!ossl_cipher_generic_einit(ctx, key, keylen, iv, ivlen, NULL))
-        return 0;
-    return ossl_cipher_cbc_cts_set_ctx_params(ctx, params);
-}
-
-static int aes_cbc_cts_dinit(void *ctx, const unsigned char *key, size_t keylen,
-                             const unsigned char *iv, size_t ivlen,
-                             const OSSL_PARAM params[])
-{
-    if (!ossl_cipher_generic_dinit(ctx, key, keylen, iv, ivlen, NULL))
-        return 0;
-    return ossl_cipher_cbc_cts_set_ctx_params(ctx, params);
-}
-
-/* ossl_aes256cbc_cts_functions */
-IMPLEMENT_cts_cipher(aes, AES, cbc, CBC, CTS_FLAGS, 256, 128, 128, block)
-/* ossl_aes192cbc_cts_functions */
-IMPLEMENT_cts_cipher(aes, AES, cbc, CBC, CTS_FLAGS, 192, 128, 128, block)
-/* ossl_aes128cbc_cts_functions */
-IMPLEMENT_cts_cipher(aes, AES, cbc, CBC, CTS_FLAGS, 128, 128, 128, block)
diff --git a/providers/implementations/ciphers/cipher_camellia.c b/providers/implementations/ciphers/cipher_camellia.c
index 0d4bab73c8..2b304626a1 100644
--- a/providers/implementations/ciphers/cipher_camellia.c
+++ b/providers/implementations/ciphers/cipher_camellia.c
@@ -13,14 +13,17 @@
  */
 #include "internal/deprecated.h"

-/* Dispatch functions for CAMELLIA cipher modes ecb, cbc, ofb, cfb, ctr */
+/* Dispatch functions for CAMELLIA cipher modes ecb, cbc, cts, ofb, cfb, ctr */

+#include "cipher_cts.h"
 #include "cipher_camellia.h"
 #include "prov/implementations.h"
 #include "prov/providercommon.h"

 static OSSL_FUNC_cipher_freectx_fn camellia_freectx;
 static OSSL_FUNC_cipher_dupctx_fn camellia_dupctx;
+static OSSL_FUNC_cipher_encrypt_init_fn camellia_cbc_cts_einit;
+static OSSL_FUNC_cipher_decrypt_init_fn camellia_cbc_cts_dinit;

 static void camellia_freectx(void *vctx)
 {
@@ -46,6 +49,24 @@ static void *camellia_dupctx(void *ctx)
     return ret;
 }

+static int camellia_cbc_cts_einit(void *ctx, const unsigned char *key, size_t keylen,
+    const unsigned char *iv, size_t ivlen,
+    const OSSL_PARAM params[])
+{
+    if (!ossl_cipher_generic_einit(ctx, key, keylen, iv, ivlen, NULL))
+        return 0;
+    return ossl_cipher_cbc_cts_set_ctx_params(ctx, params);
+}
+
+static int camellia_cbc_cts_dinit(void *ctx, const unsigned char *key, size_t keylen,
+    const unsigned char *iv, size_t ivlen,
+    const OSSL_PARAM params[])
+{
+    if (!ossl_cipher_generic_dinit(ctx, key, keylen, iv, ivlen, NULL))
+        return 0;
+    return ossl_cipher_cbc_cts_set_ctx_params(ctx, params);
+}
+
 /* ossl_camellia256ecb_functions */
 IMPLEMENT_generic_cipher(camellia, CAMELLIA, ecb, ECB, 0, 256, 128, 0, block)
 /* ossl_camellia192ecb_functions */
@@ -89,4 +110,9 @@ IMPLEMENT_generic_cipher(camellia, CAMELLIA, ctr, CTR, 0, 192, 8, 128, stream)
 /* ossl_camellia128ctr_functions */
 IMPLEMENT_generic_cipher(camellia, CAMELLIA, ctr, CTR, 0, 128, 8, 128, stream)

-#include "cipher_camellia_cts.inc"
+/* ossl_camellia256cbc_cts_functions */
+IMPLEMENT_cts_cipher(camellia, CAMELLIA, cbc, CBC, PROV_CIPHER_FLAG_CTS, 256, 128, 128, block)
+/* ossl_camellia192cbc_cts_functions */
+IMPLEMENT_cts_cipher(camellia, CAMELLIA, cbc, CBC, PROV_CIPHER_FLAG_CTS, 192, 128, 128, block)
+/* ossl_camellia128cbc_cts_functions */
+IMPLEMENT_cts_cipher(camellia, CAMELLIA, cbc, CBC, PROV_CIPHER_FLAG_CTS, 128, 128, 128, block)
diff --git a/providers/implementations/ciphers/cipher_camellia_cts.inc b/providers/implementations/ciphers/cipher_camellia_cts.inc
deleted file mode 100644
index 9e29827e02..0000000000
--- a/providers/implementations/ciphers/cipher_camellia_cts.inc
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2021 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
- */
-
-/* Dispatch functions for CAMELLIA CBC CTS ciphers */
-
-#include "cipher_cts.h"
-
-#define CTS_FLAGS PROV_CIPHER_FLAG_CTS
-
-static OSSL_FUNC_cipher_encrypt_init_fn camellia_cbc_cts_einit;
-static OSSL_FUNC_cipher_decrypt_init_fn camellia_cbc_cts_dinit;
-
-static int camellia_cbc_cts_einit(void *ctx, const unsigned char *key, size_t keylen,
-                             const unsigned char *iv, size_t ivlen,
-                             const OSSL_PARAM params[])
-{
-    if (!ossl_cipher_generic_einit(ctx, key, keylen, iv, ivlen, NULL))
-        return 0;
-    return ossl_cipher_cbc_cts_set_ctx_params(ctx, params);
-}
-
-static int camellia_cbc_cts_dinit(void *ctx, const unsigned char *key, size_t keylen,
-                             const unsigned char *iv, size_t ivlen,
-                             const OSSL_PARAM params[])
-{
-    if (!ossl_cipher_generic_dinit(ctx, key, keylen, iv, ivlen, NULL))
-        return 0;
-    return ossl_cipher_cbc_cts_set_ctx_params(ctx, params);
-}
-
-/* ossl_camellia256cbc_cts_functions */
-IMPLEMENT_cts_cipher(camellia, CAMELLIA, cbc, CBC, CTS_FLAGS, 256, 128, 128, block)
-/* ossl_camellia192cbc_cts_functions */
-IMPLEMENT_cts_cipher(camellia, CAMELLIA, cbc, CBC, CTS_FLAGS, 192, 128, 128, block)
-/* ossl_camellia128cbc_cts_functions */
-IMPLEMENT_cts_cipher(camellia, CAMELLIA, cbc, CBC, CTS_FLAGS, 128, 128, 128, block)
diff --git a/providers/implementations/ciphers/cipher_cts.c b/providers/implementations/ciphers/cipher_cts.c
index e292d37fc6..d62922d0a5 100644
--- a/providers/implementations/ciphers/cipher_cts.c
+++ b/providers/implementations/ciphers/cipher_cts.c
@@ -11,7 +11,7 @@
  * Helper functions for 128 bit CBC CTS ciphers (Currently AES and Camellia).
  *
  * The function dispatch tables are embedded into cipher_aes.c
- * and cipher_camellia.c using cipher_aes_cts.inc and cipher_camellia_cts.inc
+ * and cipher_camellia.c
  */

 /*