use MBEDTLS_OPTIMIZE_ALWAYS in AES-XTS

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman 2023-06-15 18:46:23 +01:00
parent a0b166e11e
commit 6cfd9b54ae

View file

@ -1128,7 +1128,8 @@ typedef unsigned char mbedtls_be128[16];
* for machine endianness and hence works correctly on both big and little * for machine endianness and hence works correctly on both big and little
* endian machines. * 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]) const unsigned char x[16])
{ {
uint64_t a, b, ra, rb; 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 * 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 mbedtls_aes_crypt_xts(mbedtls_aes_xts_context *ctx,
int mode, int mode,
size_t length, size_t length,