Skip to content

Commit 11920e3

Browse files
valeriosettiFlavio Ceolin
authored andcommitted
mbedtls: reduce heap usage when building PSA crypto
By default PSA crypto library copies all the buffers that are passed in into the heap before further processing them. This is required when the PSA crypto library is on the secure side and it accepts buffers from a non-secure code. However this case in Zephyr is already handled by TF-M, so when the PSA crypto library is built (CONFIG_MBEDTLS_PSA_CRYPTO_C) then it will be on the non-secure side. Therefore this malloc copy is useless and it consumes heap memory. Setting MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS at Mbed TLS build time helps in removing this mechanism and it saves heap memory. Signed-off-by: Valerio Setti <[email protected]>
1 parent 85bc3e6 commit 11920e3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@
473473

474474
#if defined(CONFIG_MBEDTLS_PSA_CRYPTO_C)
475475
#define MBEDTLS_PSA_CRYPTO_C
476+
#define MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS
476477

477478
#if defined(CONFIG_ARCH_POSIX) && !defined(CONFIG_PICOLIBC)
478479
#define MBEDTLS_PSA_KEY_SLOT_COUNT 64

0 commit comments

Comments
 (0)