Skip to content

Commit 55fb36e

Browse files
committed
[nrf fromlist] modules: mbedtls: Expose MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
The commit adds Kconfig options that allows users to select - MBEDTLS_PLATFORM_NO_STD_FUNCTIONS - MBEDTLS_PLATFORM_SNPRINTF_ALT allowing Mbed TLS to use alternative definitions of STD functions. Upstream PR #: 87135 Signed-off-by: Dominik Ermel <[email protected]>
1 parent 4ebf518 commit 55fb36e

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

modules/mbedtls/Kconfig.tls-generic

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,23 @@ config MBEDTLS_GENPRIME_ENABLED
406406
config MBEDTLS_ASN1_PARSE_C
407407
bool "Support for ASN1 parser functions"
408408

409+
config MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
410+
bool "Mbed TLS will not use standard C functions"
411+
help
412+
This replaces, within Mbed TLS, usage of functions like alloc, calloc,
413+
free, snprintf, or printf with Mbed TLS replaced aliases.
414+
This allows user to provide own implementations if platform lacks
415+
C standard functions.
416+
417+
if MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
418+
419+
config MBEDTLS_PLATFORM_SNPRINTF_ALT
420+
bool "Allow setting custom snprintf for Mbed TLS, at run-time"
421+
help
422+
Allow setting custom snprinf function with mbedtls_platform_set_snprintf.
423+
424+
endif # MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
425+
409426
config MBEDTLS_PEM_CERTIFICATE_FORMAT
410427
bool "Support for PEM certificate format"
411428
help

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@
2323
#define MBEDTLS_PLATFORM_ZEROIZE_ALT
2424
#endif
2525

26+
#if defined(CONFIG_MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
27+
#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
28+
#endif /* defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS) */
29+
30+
#if defined(CONFIG_MBEDTLS_PLATFORM_SNPRINTF_ALT)
31+
#define MBEDTLS_PLATFORM_SNPRINTF_ALT
32+
#endif /* defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) */
33+
2634
#if defined(CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR)
2735
#define MBEDTLS_ENTROPY_HARDWARE_ALT
2836
#else

0 commit comments

Comments
 (0)