From b2814bd089077b7ec195449a5f7fef316b7b3065 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Fri, 16 Jun 2023 14:50:33 +0100 Subject: [PATCH] Only enable gcc -Os fix if we have AES hw support Signed-off-by: Dave Rodgman --- library/aes.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/aes.c b/library/aes.c index b446265b2..ce458b6f9 100644 --- a/library/aes.c +++ b/library/aes.c @@ -1148,9 +1148,11 @@ static inline void mbedtls_gf128mul_x_ble(unsigned char r[16], * AES-XTS buffer encryption/decryption * * Use of MBEDTLS_OPTIMIZE_FOR_PERFORMANCE here and for mbedtls_gf128mul_x_ble() - * is a 3x performance improvement for gcc -Os! + * is a 3x performance improvement for gcc -Os, if we have hardware AES support. */ +#if defined(MBEDTLS_AESCE_C) || defined(MBEDTLS_AESNI_C) MBEDTLS_OPTIMIZE_FOR_PERFORMANCE +#endif int mbedtls_aes_crypt_xts(mbedtls_aes_xts_context *ctx, int mode, size_t length,