Skip to content

Commit

Permalink
mbedtls: ensure not to link against standard alloc/free
Browse files Browse the repository at this point in the history
Ensure that Mbed TLS will use its internal functions for heap
memory management (allocation & free) instead of relying on
standard libc functions.
This helps solving link issues in some builds.

Signed-off-by: Valerio Setti <[email protected]>
  • Loading branch information
valeriosetti committed Nov 5, 2024
1 parent e320a43 commit 9dc4b33
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/mbedtls/configs/config-tls-generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
#define MBEDTLS_PLATFORM_EXIT_ALT
#define MBEDTLS_NO_PLATFORM_ENTROPY

#if defined(CONFIG_MBEDTLS_ENABLE_HEAP)
/* Ensure that we're not using standard [m|c]alloc/free functions.
* mbedtls_memory_buffer_alloc_init() will set a local buffer to be used as
* heap and Mbed TLS will use internal function over it.
*/
#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
#endif

#if defined(CONFIG_MBEDTLS_ZEROIZE_ALT)
#define MBEDTLS_PLATFORM_ZEROIZE_ALT
#endif
Expand Down

0 comments on commit 9dc4b33

Please sign in to comment.