From 6cfd9b54ae0d06451c1a46a10e57fa099878bb03 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 15 Jun 2023 18:46:23 +0100 Subject: [PATCH] use MBEDTLS_OPTIMIZE_ALWAYS in AES-XTS Signed-off-by: Dave Rodgman --- library/aes.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/aes.c b/library/aes.c index d2687bcf3d..6ec4d78086 100644 --- a/library/aes.c +++ b/library/aes.c @@ -1128,7 +1128,8 @@ typedef unsigned char mbedtls_be128[16]; * for machine endianness and hence works correctly on both big and little * endian machines. */ -static void mbedtls_gf128mul_x_ble(unsigned char r[16], +MBEDTLS_OPTIMIZE_ALWAYS +static inline void mbedtls_gf128mul_x_ble(unsigned char r[16], const unsigned char x[16]) { uint64_t a, b, ra, rb; @@ -1145,7 +1146,11 @@ static void mbedtls_gf128mul_x_ble(unsigned char r[16], /* * AES-XTS buffer encryption/decryption + * + * Use of MBEDTLS_OPTIMIZE_ALWAYS here and for mbedtls_gf128mul_x_ble() + * is a 3x performance improvement for gcc -Os! */ +MBEDTLS_OPTIMIZE_ALWAYS int mbedtls_aes_crypt_xts(mbedtls_aes_xts_context *ctx, int mode, size_t length,