Skip to content

Commit 6ca9249

Browse files
rlubosgalak
authored andcommitted
modules: mbedTLS: Add separate Kconfig entry for MBEDTLS_HAVE_TIME_DATE
Currently the MBEDTLS_HAVE_TIME_DATE mbedTLS option is enabled based on the CONFIG_POSIX_API option. This doesn't seem right, since the enabling the POSIX API does not guarantee that there is a valid time source in the system. This was the case for the qemu_x86 platform, where enabling POSIX_API caused TLS handshake failures due to certificate validation errors caused by no valid time avaialble in the system. Fix this by adding a specific KConfig entry for date/time configuration in mbedTLS. Applications that need to enforce date verification in mbedTLS should enable it explicitly instead of relying on the non-obvious implicit configuration. Fixes #35401 Signed-off-by: Robert Lubos <[email protected]>
1 parent 5e0ca9b commit 6ca9249

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

modules/mbedtls/Kconfig.tls-generic

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,4 +354,11 @@ config MBEDTLS_PK_WRITE_C
354354
help
355355
Enable generic public key write functions.
356356

357+
config MBEDTLS_HAVE_TIME_DATE
358+
bool "Enable date/time validation in mbed TLS"
359+
help
360+
System has time.h, time(), and an implementation for gmtime_r().
361+
There also need to be a valid time source in the system, as mbedTLS
362+
expects a valid date/time for certificate validation."
363+
357364
endmenu

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
#define MBEDTLS_HAVE_ASM
2424
#endif
2525

26-
/* If we build with POSIX API, automatically use time(), etc. */
27-
#if defined(CONFIG_POSIX_API)
26+
#if defined(CONFIG_MBEDTLS_HAVE_TIME_DATE)
2827
#define MBEDTLS_HAVE_TIME
2928
#define MBEDTLS_HAVE_TIME_DATE
3029
#endif

0 commit comments

Comments
 (0)