mbedtls: add MBEDTLS_AES_FEWER_TABLES control

Add a kconfig symbol to control the mbedtls option
`MBEDTLS_AES_FEWER_TABLES`. 6KiB is a not insignificant ROM/RAM savings,
and the extra arthmetic is quite reasonable.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
Jordan Yates 2023-07-23 18:19:49 +10:00 committed by Carles Cufí
commit a2395e8d5b
2 changed files with 13 additions and 0 deletions

View file

@ -250,6 +250,15 @@ config MBEDTLS_AES_ROM_TABLES
bool "Use precomputed AES tables stored in ROM."
default y
config MBEDTLS_AES_FEWER_TABLES
depends on MBEDTLS_CIPHER_AES_ENABLED
bool "Reduce the size of precomputed AES tables by ~6kB"
help
Reduce the size of the AES tables at a tradeoff of more
arithmetic operations at runtime. Specifically 4 table
lookups are converted to 1 table lookup, 3 additions
and 6 bit shifts.
config MBEDTLS_CIPHER_CAMELLIA_ENABLED
bool "Camellia block cipher"

View file

@ -142,6 +142,10 @@
#define MBEDTLS_AES_ROM_TABLES
#endif
#if defined(CONFIG_MBEDTLS_AES_FEWER_TABLES)
#define MBEDTLS_AES_FEWER_TABLES
#endif
#if defined(CONFIG_MBEDTLS_CIPHER_CAMELLIA_ENABLED)
#define MBEDTLS_CAMELLIA_C
#endif