Skip to content

Commit 7e2f06c

Browse files
valeriosettiFlavio Ceolin
authored and
Flavio Ceolin
committed
mbedtls: add Kconfig option for PSA_WANT_ALG_SHA_256
Create a new Kconfig named CONFIG_PSA_WANT_ALG_SHA_256 which allows to enable PSA_WANT_ALG_SHA_256. This allows to use PSA functions to compute SHA256 hashes. When PSA is provided by TFM this allows also to remove legacy mbedtls_sha256() support and therefore reduce footprint for the NS side. Signed-off-by: Valerio Setti <[email protected]>
1 parent f003087 commit 7e2f06c

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

modules/mbedtls/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ config MBEDTLS_PROMPTLESS
1313
mbed TLS menu prompt and instead handle the selection of MBEDTLS from
1414
dependent sub-configurations and thus prevent stuck symbol behavior.
1515

16+
rsource "Kconfig.psa"
1617

1718
menuconfig MBEDTLS
1819
bool "mbed TLS Support" if !MBEDTLS_PROMPTLESS

modules/mbedtls/Kconfig.psa

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2024 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config MBEDTLS_PSA_CRYPTO_CLIENT
5+
bool
6+
default y
7+
depends on BUILD_WITH_TFM || MBEDTLS_PSA_CRYPTO_C
8+
9+
if MBEDTLS_PSA_CRYPTO_CLIENT
10+
11+
config PSA_WANT_ALG_SHA_256
12+
bool "SHA-256 hash algorithm through PSA"
13+
14+
endif # MBEDTLS_PSA_CRYPTO_CLIENT

modules/mbedtls/configs/config-tls-generic.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,15 @@
496496
#endif
497497

498498
#if defined(CONFIG_BUILD_WITH_TFM)
499-
#define MBEDTLS_PSA_CRYPTO_CLIENT
500499
#undef MBEDTLS_PSA_CRYPTO_C
501500
#endif /* CONFIG_BUILD_WITH_TFM */
502501

502+
#if defined(CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT)
503+
#define MBEDTLS_PSA_CRYPTO_CLIENT
504+
#endif
505+
506+
#if defined(CONFIG_PSA_WANT_ALG_SHA_256)
507+
#define PSA_WANT_ALG_SHA_256 1
508+
#endif
509+
503510
#endif /* MBEDTLS_CONFIG_H */

0 commit comments

Comments
 (0)