Rename MBEDTLS_OPTIMIZE_ALWAYS
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
diff --git a/library/aes.c b/library/aes.c
index 977b3de..b446265 100644
--- a/library/aes.c
+++ b/library/aes.c
@@ -1128,7 +1128,7 @@
* 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 @@
/*
* 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,
diff --git a/library/aesce.c b/library/aesce.c
index 600326a..ecfadcd 100644
--- a/library/aesce.c
+++ b/library/aesce.c
@@ -109,7 +109,7 @@
/* 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 @@
/* 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 @@
/*
* 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],
diff --git a/library/ccm.c b/library/ccm.c
index 1e644dc..81bdfe7 100644
--- a/library/ccm.c
+++ b/library/ccm.c
@@ -326,7 +326,7 @@
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,
diff --git a/library/common.h b/library/common.h
index c477e1d..497886f 100644
--- a/library/common.h
+++ b/library/common.h
@@ -240,11 +240,14 @@
#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 */
diff --git a/library/gcm.c b/library/gcm.c
index 02f8cbf..6d7ef21 100644
--- a/library/gcm.c
+++ b/library/gcm.c
@@ -417,7 +417,7 @@
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,