Build failure of aesce.c with ancient Clang #604

Open
opened 2025-12-11 09:06:57 -06:00 by gilles-peskine-arm · 0 comments
gilles-peskine-arm commented 2025-12-11 09:06:57 -06:00 (Migrated from github.com)

In crypto_config.h (and in mbedtls_config.h in Mbed TLS 3.6), we promise that MBEDTLS_AESCE_C works with Clang ≥4.0, with no reservations regarding CFLAGS. However this is not the case as of Mbed TLS 3.6.0, Mbed TLS 3.6.5, TF-PSA-Crypto 1.0.0 or https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/603: the build fails with Clang 4.0, 5.0 or 6.0.

Steps to reproduce:

$ clang-6.0 -target aarch64-linux-gnu --sysroot /usr/aarch64-linux-gnu -I include -I core -I drivers/builtin/include -c drivers/builtin/src/aesce.c
'+aes' is not a recognized feature for this target (ignoring feature)
'+aes' is not a recognized feature for this target (ignoring feature)
fatal error: error in backend: Cannot select: intrinsic
      %llvm.aarch64.crypto.aesimc
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 6.0.1-14 (tags/RELEASE_601/final)
Target: aarch64--linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/aesce-7035ca.c
clang: note: diagnostic msg: /tmp/aesce-7035ca.sh
clang: note: diagnostic msg: 

********************

Easy way to set up an environment: an Ubuntu 20.04 chroot with apt-get install gcc-7-aarch64-linux-gnu clang-4.0 clang-5.0 clang-6.0.

This may be a documentation bug or a regression since we added AESCE support. I haven't checked the history.

In [`crypto_config.h`](https://github.com/Mbed-TLS/TF-PSA-Crypto/blob/tf-psa-crypto-1.0.0/include/psa/crypto_config.h#L1462) (and in `mbedtls_config.h` in Mbed TLS 3.6), we promise that `MBEDTLS_AESCE_C` works with Clang ≥4.0, with no reservations regarding `CFLAGS`. However this is not the case as of Mbed TLS 3.6.0, Mbed TLS 3.6.5, TF-PSA-Crypto 1.0.0 or https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/603: the build fails with Clang 4.0, 5.0 or 6.0. Steps to reproduce: ``` $ clang-6.0 -target aarch64-linux-gnu --sysroot /usr/aarch64-linux-gnu -I include -I core -I drivers/builtin/include -c drivers/builtin/src/aesce.c '+aes' is not a recognized feature for this target (ignoring feature) '+aes' is not a recognized feature for this target (ignoring feature) fatal error: error in backend: Cannot select: intrinsic %llvm.aarch64.crypto.aesimc clang: error: clang frontend command failed with exit code 70 (use -v to see invocation) clang version 6.0.1-14 (tags/RELEASE_601/final) Target: aarch64--linux-gnu Thread model: posix InstalledDir: /usr/bin clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script. clang: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang: note: diagnostic msg: /tmp/aesce-7035ca.c clang: note: diagnostic msg: /tmp/aesce-7035ca.sh clang: note: diagnostic msg: ******************** ``` Easy way to set up an environment: an Ubuntu 20.04 chroot with `apt-get install gcc-7-aarch64-linux-gnu clang-4.0 clang-5.0 clang-6.0`. This may be a documentation bug or a regression since we added AESCE support. I haven't checked the history.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-Mbed-TLS/TF-PSA-Crypto#604
No description provided.