mbedtls: auto-select MBEDTLS_CIPHER_AES_ENABLED when built-in in PSA
Auto-select MBEDTLS_CIPHER_AES_ENABLED when AES support is requested
through PSA (i.e. CONFIG_PSA_WANT_KEY_TYPE_AES) and the PSA support is
provided through Mbed TLS itself (i.e. CONFIG_MBEDTLS_PSA_CRYPTO_C).
This mimic what happens in Mbed TLS at build time: if AES support
is required through PSA, but there's no one else providing it
(i.e. no TF-M in Zephyr) then provide this support through legacy
AES module.
This is useful in samples/tests so that the user can simply use the
PSA_WANT symbol to ask for AES support in PSA crypto and then tune
the AES features (ex: CONFIG_MBEDTLS_AES_ROM_TABLES) without the need
to also define CONFIG_MBEDTLS_CIPHER_AES_ENABLED.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
diff --git a/modules/mbedtls/Kconfig.tls-generic b/modules/mbedtls/Kconfig.tls-generic
index 3ea0a49..1082587 100644
--- a/modules/mbedtls/Kconfig.tls-generic
+++ b/modules/mbedtls/Kconfig.tls-generic
@@ -246,6 +246,7 @@
config MBEDTLS_CIPHER_AES_ENABLED
bool "AES block cipher"
+ default y if PSA_WANT_KEY_TYPE_AES && MBEDTLS_PSA_CRYPTO_C
if MBEDTLS_CIPHER_AES_ENABLED