]> granicus.if.org Git - esp-idf/commitdiff
components/mbedtls: add time and time data configuration at menuconfig
authorLiu Han <tianzhongxing@espressif.com>
Thu, 1 Dec 2016 08:25:44 +0000 (16:25 +0800)
committerWu Jian Gang <wujiangang@espressif.com>
Thu, 8 Dec 2016 05:33:47 +0000 (13:33 +0800)
components/mbedtls/Kconfig
components/mbedtls/port/include/mbedtls/esp_config.h
components/mbedtls/port/net.c

index 1e347582f04db190f8293b31e7646ff7097165b8..5a719ff33a732d78485bccaee016a83a57e8630f 100644 (file)
@@ -81,4 +81,24 @@ config MBEDTLS_HARDWARE_SHA
        be calculated fully in hardware and the rest will be calculated
        (at least partially calculated) in software.
 
+config MBEDTLS_HAVE_TIME
+   bool "Enable mbedtls time"
+   depends on !ESP32_TIME_SYSCALL_USE_NONE
+   default y
+   help
+       System has time.h and time().
+       The time does not need to be correct, only time differences are used,
+
+config MBEDTLS_HAVE_TIME_DATE
+   bool "Enable mbedtls time data"
+   depends on MBEDTLS_HAVE_TIME
+   default n
+   help
+       System has time.h and time(), gmtime() and the clock is correct.
+       The time needs to be correct (not necesarily very accurate, but at least
+       the date should be correct). This is used to verify the validity period of
+       X.509 certificates.
+
+       It is suggested that you should get the real time by "SNTP".
+
 endmenu
index cd9f87e698efd3bedf33e3aa382637f8007f63b8..fd6c023fa3a143bcb811e9d29375bfe9618a98cb 100644 (file)
@@ -74,7 +74,9 @@
  *
  * Comment if your system does not support time functions
  */
-//#define MBEDTLS_HAVE_TIME
+#ifdef CONFIG_MBEDTLS_HAVE_TIME
+#define MBEDTLS_HAVE_TIME
+#endif
 
 /**
  * \def MBEDTLS_HAVE_TIME_DATE
@@ -86,7 +88,9 @@
  *
  * Comment if your system does not have a correct clock.
  */
-//#define MBEDTLS_HAVE_TIME_DATE
+#ifdef CONFIG_MBEDTLS_HAVE_TIME_DATE
+#define MBEDTLS_HAVE_TIME_DATE
+#endif
 
 /**
  * \def MBEDTLS_PLATFORM_MEMORY
index 45aa4b2deb62880006637e4ca428f77558a80f5d..bb0884ac87e710170c574ac3dc85cfceca059e73 100644 (file)
 
 #if !defined(MBEDTLS_NET_C)
 
+#if defined(MBEDTLS_PLATFORM_C)
+#include "mbedtls/platform.h"
+#else
+#include <stdlib.h>
+#define mbedtls_calloc    calloc
+#define mbedtls_free      free
+#define mbedtls_time      time
+#define mbedtls_time_t    time_t
+#endif
+
 #include "mbedtls/net.h"
 
 #include <string.h>