From c60e99ff629c384aa7b9ac4f7badcf3cfdf953c1 Mon Sep 17 00:00:00 2001 From: Raymond Mao Date: Thu, 3 Oct 2024 14:50:20 -0700 Subject: mbedtls: Enable smaller implementation for SHA256/512 Smaller implementation for SHA256 and SHA512 helps to reduce the ROM footprint though it has a certain impact on performance. As a trade-off, enable it as a default config when MbedTLS is enabled can reduce the target size significantly with acceptable performance loss. Signed-off-by: Raymond Mao Reviewed-by: Ilias Apalodimas --- lib/mbedtls/mbedtls_def_config.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/mbedtls/mbedtls_def_config.h') diff --git a/lib/mbedtls/mbedtls_def_config.h b/lib/mbedtls/mbedtls_def_config.h index 6fba053bd7c..1af911c2003 100644 --- a/lib/mbedtls/mbedtls_def_config.h +++ b/lib/mbedtls/mbedtls_def_config.h @@ -35,6 +35,9 @@ #if defined CONFIG_MBEDTLS_LIB_CRYPTO_ALT #define MBEDTLS_SHA256_ALT #endif +#if CONFIG_IS_ENABLED(SHA256_SMALLER) +#define MBEDTLS_SHA256_SMALLER +#endif #endif #if CONFIG_IS_ENABLED(SHA384) @@ -48,6 +51,9 @@ #if defined CONFIG_MBEDTLS_LIB_CRYPTO_ALT #define MBEDTLS_SHA512_ALT #endif +#if CONFIG_IS_ENABLED(SHA512_SMALLER) +#define MBEDTLS_SHA512_SMALLER +#endif #endif #if defined CONFIG_MBEDTLS_LIB_X509 -- cgit v1.2.3