Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions modules/mbedtls/Kconfig.tls-generic
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ config MBEDTLS_ECDH_C
config MBEDTLS_ECDSA_C
bool "Elliptic curve DSA library"
depends on MBEDTLS_ECP_C
select MBEDTLS_ASN1_PARSE_C

config MBEDTLS_ECJPAKE_C
bool "Elliptic curve J-PAKE library"
Expand Down Expand Up @@ -402,6 +403,31 @@ endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND)
config MBEDTLS_GENPRIME_ENABLED
bool "prime-number generation code."

config MBEDTLS_ASN1_PARSE_C
bool "Support for ASN1 parser functions"

config MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
bool "Remove usage of standard libc functions"
help
This prevents Mbed TLS from linking against the following standard functions
from libc: `snprintf`, `vsnprintf`, `printf`, `fprintf`, `calloc`, `free`, `setbuf`, `exit`
and `time`. By default Mbed TLS will use stub functions for all these functions.
These stubs are just meant to return successfully, but they don't implement
the required functionality.
Users can individually override each of these stubs by calling
`mbedtls_platform_set_xxx()` to set the their implementation of `xxx()` function
at runtime.

if MBEDTLS_PLATFORM_NO_STD_FUNCTIONS

config MBEDTLS_PLATFORM_SNPRINTF_ALT
bool "Allow setting custom snprintf at run-time"
help
Allow setting a custom `snprintf()` function with `mbedtls_platform_set_snprintf()`.
Include `mbedtls/platform.h` for the prototype of this function.

endif # MBEDTLS_PLATFORM_NO_STD_FUNCTIONS

config MBEDTLS_PEM_CERTIFICATE_FORMAT
bool "Support for PEM certificate format"
help
Expand Down
10 changes: 9 additions & 1 deletion modules/mbedtls/configs/config-tls-generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
#define MBEDTLS_PLATFORM_ZEROIZE_ALT
#endif

#if defined(CONFIG_MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
#endif /* defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS) */

#if defined(CONFIG_MBEDTLS_PLATFORM_SNPRINTF_ALT)
#define MBEDTLS_PLATFORM_SNPRINTF_ALT
#endif /* defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) */

#if defined(CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR)
#define MBEDTLS_ENTROPY_HARDWARE_ALT
#else
Expand Down Expand Up @@ -431,7 +439,7 @@
#define MBEDTLS_PK_C
#endif

#if defined(MBEDTLS_ECDSA_C) || defined(MBEDTLS_X509_USE_C)
#if defined(CONFIG_MBEDTLS_ASN1_PARSE_C) || defined(MBEDTLS_X509_USE_C)
#define MBEDTLS_ASN1_PARSE_C
#endif

Expand Down