This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit e83f2ad9c438e777ead27b6d2bc18551be168102
Author: makejian <[email protected]>
AuthorDate: Tue Nov 10 17:56:37 2026 +0800

    crypto/mbedtls: expose MBEDTLS_PLATFORM_TIME_ALT via Kconfig
    
    Add a MBEDTLS_PLATFORM_TIME_ALT option (default n, depends on
    MBEDTLS_PLATFORM_C) and map it to the mbedtls_config.h macro, so an
    application can install its own time function at runtime (used for
    X.509 validity checks and TLS timestamps) without editing the vendored
    configuration header.
    
    Signed-off-by: makejian <[email protected]>
---
 crypto/mbedtls/Kconfig                          | 10 ++++++++++
 crypto/mbedtls/include/mbedtls/mbedtls_config.h |  7 +++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/crypto/mbedtls/Kconfig b/crypto/mbedtls/Kconfig
index 860bbd547..27d9cf7b9 100644
--- a/crypto/mbedtls/Kconfig
+++ b/crypto/mbedtls/Kconfig
@@ -594,6 +594,16 @@ config MBEDTLS_PLATFORM_C
        bool "Enable the platform abstraction layer."
        default !MBEDTLS_MINIMAL
 
+config MBEDTLS_PLATFORM_TIME_ALT
+       bool "Enable runtime replacement of the platform time function."
+       depends on MBEDTLS_PLATFORM_C
+       default n
+       ---help---
+               Provide mbedtls_platform_set_time() so the application can
+               install its own time function pointer at runtime (used for
+               X.509 validity checks and TLS timestamps). Requires
+               MBEDTLS_HAVE_TIME.
+
 config MBEDTLS_POLY1305_C
        bool "Enable the Poly1305 MAC algorithm."
        default !MBEDTLS_MINIMAL
diff --git a/crypto/mbedtls/include/mbedtls/mbedtls_config.h 
b/crypto/mbedtls/include/mbedtls/mbedtls_config.h
index c278cbf85..d57fde1a8 100644
--- a/crypto/mbedtls/include/mbedtls/mbedtls_config.h
+++ b/crypto/mbedtls/include/mbedtls/mbedtls_config.h
@@ -298,8 +298,11 @@
 
 /* #define MBEDTLS_PLATFORM_SETBUF_ALT
  * #define MBEDTLS_PLATFORM_EXIT_ALT
- * #define MBEDTLS_PLATFORM_TIME_ALT
- * #define MBEDTLS_PLATFORM_FPRINTF_ALT
+ */
+#ifdef CONFIG_MBEDTLS_PLATFORM_TIME_ALT
+#define MBEDTLS_PLATFORM_TIME_ALT
+#endif
+/* #define MBEDTLS_PLATFORM_FPRINTF_ALT
  * #define MBEDTLS_PLATFORM_PRINTF_ALT
  * #define MBEDTLS_PLATFORM_SNPRINTF_ALT
  * #define MBEDTLS_PLATFORM_VSNPRINTF_ALT

Reply via email to