Rename MBEDTLS_OPTIMIZE_ALWAYS

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman 2023-06-16 09:41:21 +01:00
parent 48fd2ab5d5
commit 9bb7e6f4ce
5 changed files with 14 additions and 11 deletions

View File

@ -1128,7 +1128,7 @@ typedef unsigned char mbedtls_be128[16];
* for machine endianness and hence works correctly on both big and little
* endian machines.
*/
MBEDTLS_OPTIMIZE_ALWAYS
MBEDTLS_OPTIMIZE_FOR_PERFORMANCE
static inline void mbedtls_gf128mul_x_ble(unsigned char r[16],
const unsigned char x[16])
{
@ -1147,10 +1147,10 @@ static inline 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()
* Use of MBEDTLS_OPTIMIZE_FOR_PERFORMANCE here and for mbedtls_gf128mul_x_ble()
* is a 3x performance improvement for gcc -Os!
*/
MBEDTLS_OPTIMIZE_ALWAYS
MBEDTLS_OPTIMIZE_FOR_PERFORMANCE
int mbedtls_aes_crypt_xts(mbedtls_aes_xts_context *ctx,
int mode,
size_t length,

View File

@ -109,7 +109,7 @@ int mbedtls_aesce_has_support(void)
/* Two rounds of AESCE encryption */
#define AESCE_ENCRYPT_ROUND_X2 AESCE_ENCRYPT_ROUND; AESCE_ENCRYPT_ROUND
MBEDTLS_OPTIMIZE_ALWAYS
MBEDTLS_OPTIMIZE_FOR_PERFORMANCE
static uint8x16_t aesce_encrypt_block(uint8x16_t block,
unsigned char *keys,
int rounds)
@ -173,7 +173,7 @@ rounds_10:
/* Two rounds of AESCE decryption */
#define AESCE_DECRYPT_ROUND_X2 AESCE_DECRYPT_ROUND; AESCE_DECRYPT_ROUND
MBEDTLS_OPTIMIZE_ALWAYS
MBEDTLS_OPTIMIZE_FOR_PERFORMANCE
static uint8x16_t aesce_decrypt_block(uint8x16_t block,
unsigned char *keys,
int rounds)
@ -210,7 +210,7 @@ rounds_10:
/*
* AES-ECB block en(de)cryption
*/
MBEDTLS_OPTIMIZE_ALWAYS
MBEDTLS_OPTIMIZE_FOR_PERFORMANCE
int mbedtls_aesce_crypt_ecb(mbedtls_aes_context *ctx,
int mode,
const unsigned char input[16],

View File

@ -326,7 +326,7 @@ int mbedtls_ccm_update_ad(mbedtls_ccm_context *ctx,
return 0;
}
MBEDTLS_OPTIMIZE_ALWAYS
MBEDTLS_OPTIMIZE_FOR_PERFORMANCE
int mbedtls_ccm_update(mbedtls_ccm_context *ctx,
const unsigned char *input, size_t input_len,
unsigned char *output, size_t output_size,

View File

@ -240,11 +240,14 @@ static inline void mbedtls_xor_no_simd(unsigned char *r,
#define MBEDTLS_COMPILER_IS_GCC
#endif
/* If -Os is specified, override with -O2 for a given function */
/* For gcc -Os, override with -O2 for a given function.
*
* This will not affect behaviour for other optimisation settings, e.g. -O0.
*/
#if defined(MBEDTLS_COMPILER_IS_GCC) && defined(__OPTIMIZE_SIZE__)
#define MBEDTLS_OPTIMIZE_ALWAYS __attribute__((optimize("-O2")))
#define MBEDTLS_OPTIMIZE_FOR_PERFORMANCE __attribute__((optimize("-O2")))
#else
#define MBEDTLS_OPTIMIZE_ALWAYS
#define MBEDTLS_OPTIMIZE_FOR_PERFORMANCE
#endif
#endif /* MBEDTLS_LIBRARY_COMMON_H */

View File

@ -417,7 +417,7 @@ static int gcm_mask(mbedtls_gcm_context *ctx,
return 0;
}
MBEDTLS_OPTIMIZE_ALWAYS
MBEDTLS_OPTIMIZE_FOR_PERFORMANCE
int mbedtls_gcm_update(mbedtls_gcm_context *ctx,
const unsigned char *input, size_t input_length,
unsigned char *output, size_t output_size,