From 1c65ab53073dcca1c2bf7228845aecf371198599 Mon Sep 17 00:00:00 2001 From: Laukik Hase Date: Thu, 10 Mar 2022 12:59:56 +0530 Subject: [PATCH] mbedtls: Add config for `MBEDTLS_PLATFORM_TIME_ALT` --- components/mbedtls/Kconfig | 9 +++++++++ .../mbedtls/port/include/mbedtls/esp_config.h | 20 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/components/mbedtls/Kconfig b/components/mbedtls/Kconfig index f3d144d33a..d52e63329a 100644 --- a/components/mbedtls/Kconfig +++ b/components/mbedtls/Kconfig @@ -465,6 +465,15 @@ menu "mbedTLS" the rest of the firmware doesn't call any standard timekeeeping functions. + config MBEDTLS_PLATFORM_TIME_ALT + bool "Enable mbedtls time support: platform-specific" + depends on MBEDTLS_HAVE_TIME + default n + help + Enabling this config will provide users with a function + "mbedtls_platform_set_time()" that allows to set an alternative + time function pointer. + config MBEDTLS_HAVE_TIME_DATE bool "Enable mbedtls certificate expiry check" depends on MBEDTLS_HAVE_TIME diff --git a/components/mbedtls/port/include/mbedtls/esp_config.h b/components/mbedtls/port/include/mbedtls/esp_config.h index 8fcf82be4e..47db5830e1 100644 --- a/components/mbedtls/port/include/mbedtls/esp_config.h +++ b/components/mbedtls/port/include/mbedtls/esp_config.h @@ -67,6 +67,26 @@ #undef MBEDTLS_HAVE_TIME_DATE #endif + +/** + * \def MBEDTLS_PLATFORM_TIME_ALT + * + * mbed TLS will provide a function "mbedtls_platform_set_time()" + * that allows you to set an alternative time function pointer. + * + * All these define require MBEDTLS_PLATFORM_C to be defined! + * + * \warning MBEDTLS_PLATFORM_TIME_ALT cannot be defined at the same time as + * MBEDTLS_PLATFORM_TIME_MACRO! + * + * Requires: MBEDTLS_PLATFORM_TIME_ALT requires MBEDTLS_HAVE_TIME + */ +#ifdef CONFIG_MBEDTLS_PLATFORM_TIME_ALT +#define MBEDTLS_PLATFORM_TIME_ALT +#else +#undef MBEDTLS_PLATFORM_TIME_ALT +#endif + /** * \def MBEDTLS_PLATFORM_MEMORY *