Commit 64bc3acda2 for openssl.org

commit 64bc3acda26e4d4c030a7f0363b26ac26a9fd7ce
Author: Bob Beck <beck@openssl.org>
Date:   Thu Aug 28 12:59:59 2025 -0600

    Disable clang format around .c includes

    we assume these to be order sensitive and not self contained, so
    as per our new style we disable clang format around them.

    we should consider renaming to .inc, or doing away with some
    of these and just putting the code inline, but that's for
    later consideration.

    Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
    Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
    Reviewed-by: Tomas Mraz <tomas@openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/29241)

diff --git a/crypto/LPdir_win32.c b/crypto/LPdir_win32.c
index b29e096ff3..33b8261774 100644
--- a/crypto/LPdir_win32.c
+++ b/crypto/LPdir_win32.c
@@ -38,4 +38,6 @@

 #define LP_SYS_WIN32
 #define LP_MULTIBYTE_AVAILABLE
+/* clang-format off */
 #include "LPdir_win.c"
+/* clang-format on */
diff --git a/crypto/LPdir_wince.c b/crypto/LPdir_wince.c
index ebf8962827..e4c883dcef 100644
--- a/crypto/LPdir_wince.c
+++ b/crypto/LPdir_wince.c
@@ -41,4 +41,6 @@
  * We might want to define LP_MULTIBYTE_AVAILABLE here.  It's currently under
  * investigation what the exact conditions would be
  */
+/* clang-format off */
 #include "LPdir_win.c"
+/* clang-format on */
diff --git a/crypto/bn/asm/x86_64-gcc.c b/crypto/bn/asm/x86_64-gcc.c
index 18d0b13608..7049a4f382 100644
--- a/crypto/bn/asm/x86_64-gcc.c
+++ b/crypto/bn/asm/x86_64-gcc.c
@@ -9,7 +9,9 @@

 #include "../bn_local.h"
 #if !(defined(__GNUC__) && __GNUC__>=2)
+/* clang-format off */
 # include "../bn_asm.c"         /* kind of dirty hack for Sun Studio */
+/* clang-format on */
 #else
 /*-
  * x86_64 BIGNUM accelerator version 0.1, December 2002.
diff --git a/crypto/des/cbc_enc.c b/crypto/des/cbc_enc.c
index aa8ac1a5c3..d13cbe19d2 100644
--- a/crypto/des/cbc_enc.c
+++ b/crypto/des/cbc_enc.c
@@ -15,4 +15,6 @@

 #define CBC_ENC_C__DONT_UPDATE_IV

+/* clang-format off */
 #include "ncbc_enc.c"           /* des_cbc_encrypt */
+/* clang-format on */
diff --git a/crypto/des/des_enc.c b/crypto/des/des_enc.c
index 0041f21b8d..37a424cd4e 100644
--- a/crypto/des/des_enc.c
+++ b/crypto/des/des_enc.c
@@ -195,7 +195,9 @@ void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1,
 #ifndef DES_DEFAULT_OPTIONS

 # undef CBC_ENC_C__DONT_UPDATE_IV
+/* clang-format off */
 # include "ncbc_enc.c"          /* DES_ncbc_encrypt */
+/* clang-format on */

 void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output,
                           long length, DES_key_schedule *ks1,
diff --git a/crypto/o_dir.c b/crypto/o_dir.c
index d7f5d64d06..36d33fbed4 100644
--- a/crypto/o_dir.c
+++ b/crypto/o_dir.c
@@ -22,6 +22,7 @@

 #include "internal/o_dir.h"

+/* clang-format off */
 #define LPDIR_H
 #if defined OPENSSL_SYS_UNIX || defined DJGPP \
     || (defined __VMS_VER && __VMS_VER >= 70000000)
@@ -35,3 +36,4 @@
 #else
 # include "LPdir_nyi.c"
 #endif
+/* clang-format on */
diff --git a/engines/e_afalg.c b/engines/e_afalg.c
index 22df8d50e1..83c5c8f094 100644
--- a/engines/e_afalg.c
+++ b/engines/e_afalg.c
@@ -48,8 +48,10 @@ void engine_load_afalg_int(void)
 # include <sys/syscall.h>
 # include <errno.h>

+/* clang-format off */
 # include "e_afalg.h"
 # include "e_afalg_err.c"
+/* clang-format on */

 # ifndef SOL_ALG
 #  define SOL_ALG 279
diff --git a/engines/e_capi.c b/engines/e_capi.c
index 73a81f7d16..5d5546b98f 100644
--- a/engines/e_capi.c
+++ b/engines/e_capi.c
@@ -99,8 +99,10 @@
 # include <openssl/pem.h>
 # include <openssl/x509v3.h>

+/* clang-format off */
 # include "e_capi_err.h"
 # include "e_capi_err.c"
+/* clang-format on */

 static const char *engine_capi_id = "capi";
 static const char *engine_capi_name = "CryptoAPI ENGINE";
diff --git a/engines/e_dasync.c b/engines/e_dasync.c
index 5f809e8321..47eca87a6b 100644
--- a/engines/e_dasync.c
+++ b/engines/e_dasync.c
@@ -46,7 +46,9 @@
 # define ASYNC_WIN
 #endif

+/* clang-format off */
 #include "e_dasync_err.c"
+/* clang-format on */

 /* Engine Id and Name */
 static const char *engine_dasync_id = "dasync";
diff --git a/engines/e_loader_attic.c b/engines/e_loader_attic.c
index 223929463a..e7597c54ef 100644
--- a/engines/e_loader_attic.c
+++ b/engines/e_loader_attic.c
@@ -40,7 +40,9 @@
 #include "crypto/ctype.h"        /* For ossl_isdigit */
 #include "crypto/pem.h"          /* For PVK and "blob" PEM headers */

+/* clang-format off */
 #include "e_loader_attic_err.c"
+/* clang-format on */

 DEFINE_STACK_OF(OSSL_STORE_INFO)

diff --git a/engines/e_ossltest.c b/engines/e_ossltest.c
index e31d82d0a5..dd5bef57dc 100644
--- a/engines/e_ossltest.c
+++ b/engines/e_ossltest.c
@@ -41,7 +41,9 @@
 #include <openssl/pem.h>
 #include <crypto/evp.h>

+/* clang-format off */
 #include "e_ossltest_err.c"
+/* clang-format on */

 /* Engine Id and Name */
 static const char *engine_ossltest_id = "ossltest";
diff --git a/engines/e_padlock.c b/engines/e_padlock.c
index 5e7fc4df30..bdad24b5b2 100644
--- a/engines/e_padlock.c
+++ b/engines/e_padlock.c
@@ -156,7 +156,9 @@ static int padlock_aes_set_decrypt_key(const unsigned char *userKey,
 #   define AES_ASM
 #   define AES_set_encrypt_key padlock_aes_set_encrypt_key
 #   define AES_set_decrypt_key padlock_aes_set_decrypt_key
+/* clang-format off */
 #   include "../crypto/aes/aes_core.c"
+/* clang-format on */
 #  endif

 /*
diff --git a/providers/implementations/macs/blake2b_mac.c b/providers/implementations/macs/blake2b_mac.c
index b445cbd578..7ba2b71b37 100644
--- a/providers/implementations/macs/blake2b_mac.c
+++ b/providers/implementations/macs/blake2b_mac.c
@@ -29,5 +29,7 @@
 /* OSSL_DISPATCH symbol */
 #define BLAKE2_FUNCTIONS ossl_blake2bmac_functions

+/* clang-format off */
 #include "blake2_mac_impl.c"
+/* clang-format on */

diff --git a/providers/implementations/macs/blake2s_mac.c b/providers/implementations/macs/blake2s_mac.c
index 6b3fa28bd3..0d89267aa6 100644
--- a/providers/implementations/macs/blake2s_mac.c
+++ b/providers/implementations/macs/blake2s_mac.c
@@ -29,4 +29,6 @@
 /* OSSL_DISPATCH symbol */
 #define BLAKE2_FUNCTIONS ossl_blake2smac_functions

+/* clang-format off */
 #include "blake2_mac_impl.c"
+/* clang-format on */
diff --git a/test/mem_alloc_custom_fns_test.c b/test/mem_alloc_custom_fns_test.c
index 2b0a7a2bda..832801b893 100644
--- a/test/mem_alloc_custom_fns_test.c
+++ b/test/mem_alloc_custom_fns_test.c
@@ -1,2 +1,4 @@
 #define USE_CUSTOM_ALLOC_FNS 1
+/* clang-format off */
 #include "mem_alloc_test.c"
+/* clang-format on */
diff --git a/test/radix/quic_radix.c b/test/radix/quic_radix.c
index 3400eda3fd..ada8773b50 100644
--- a/test/radix/quic_radix.c
+++ b/test/radix/quic_radix.c
@@ -6,8 +6,10 @@
  * in the file LICENSE in the source distribution or at
  * https://www.openssl.org/source/license.html
  */
+/* clang-format off */
 #include "terp.c"
 #include "quic_bindings.c"
 #include "quic_ops.c"
 #include "quic_tests.c"
 #include "main.c"
+/* clang-format on */