From 85e28b266ecf8ac2bf2ffb9e41ae3a2f2771b756 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 11 Dec 2025 15:32:18 +0100 Subject: [PATCH 1/2] AESCE: fix the build with Clang <<16 As indicated in a comment, with older Clang, we need to define `__ARM_FEATURE_CRYPTO` before we include `arm_neon.h`, which is done via `common.h`. 4c44990d65385fd0391ead9d88a2d9f6a7e93df1 accidentally broke this. Fix it, while taking care not to include another header before `common.h`. Signed-off-by: Gilles Peskine --- library/aesce.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/aesce.c b/library/aesce.c index bd9c483968..2f394feb41 100644 --- a/library/aesce.c +++ b/library/aesce.c @@ -5,10 +5,6 @@ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ -#include "common.h" - -#if defined(MBEDTLS_AESCE_C) - #if defined(__clang__) && (__clang_major__ >= 4) /* Ideally, we would simply use MBEDTLS_ARCH_IS_ARMV8_A in the following #if, @@ -42,6 +38,10 @@ #endif /* defined(__clang__) && (__clang_major__ >= 4) */ +#include "common.h" + +#if defined(MBEDTLS_AESCE_C) + #include #include "aesce.h" From ad6ceaa4e77d7f46d30a8044debf7c7934f9ffa9 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 11 Dec 2025 15:55:00 +0100 Subject: [PATCH 2/2] Indicate which Clang version stops requiring the workaround Signed-off-by: Gilles Peskine --- library/aesce.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/library/aesce.c b/library/aesce.c index 2f394feb41..517ccf4a1b 100644 --- a/library/aesce.c +++ b/library/aesce.c @@ -16,15 +16,16 @@ #endif #if defined(MBEDTLS_AESCE_ARCH_IS_ARMV8_A) && !defined(__ARM_FEATURE_CRYPTO) -/* TODO: Re-consider above after https://reviews.llvm.org/D131064 merged. - * - * The intrinsic declaration are guarded by predefined ACLE macros in clang: +/* The intrinsic declaration are guarded by predefined ACLE macros in clang: * these are normally only enabled by the -march option on the command line. * By defining the macros ourselves we gain access to those declarations without * requiring -march on the command line. * * `arm_neon.h` is included by common.h, so we put these defines - * at the top of this file, before any includes. + * at the top of this file, before any includes. This is necessary with + * Clang <=15.x. With Clang 16.0 and above, these macro definitions are + * no longer required, but they're harmless. See + * https://reviews.llvm.org/D131064 */ #define __ARM_FEATURE_CRYPTO 1 /* See: https://arm-software.github.io/acle/main/acle.html#cryptographic-extensions