modules: mbedtls: Add a mbedtls_ms_time implementation

MbedTLS 3.5.0 requires a implementation of mbedtls_ms_time giving a
time in ms for TLS 1.3
Therefor adding an alternative implementation using zephyrs
k_uptime_get

Signed-off-by: Markus Swarowsky <markus.swarowsky@nordicsemi.no>
This commit is contained in:
Markus Swarowsky 2023-12-11 17:27:32 +01:00 committed by Carles Cufí
parent fbee1c61ed
commit dc7613865d
6 changed files with 13 additions and 0 deletions

View file

@ -59,6 +59,7 @@
/* System support */
#define MBEDTLS_HAVE_ASM
#define MBEDTLS_HAVE_TIME
#define MBEDTLS_PLATFORM_MS_TIME_ALT
/* mbed TLS feature support */
#define MBEDTLS_CIPHER_MODE_CBC

View file

@ -62,6 +62,7 @@
/* System support */
#define MBEDTLS_HAVE_ASM
#define MBEDTLS_HAVE_TIME
#define MBEDTLS_PLATFORM_MS_TIME_ALT
/* mbed TLS feature support */
#define MBEDTLS_CIPHER_MODE_CBC

View file

@ -66,6 +66,7 @@
/* System support */
#define MBEDTLS_HAVE_ASM
#define MBEDTLS_HAVE_TIME
#define MBEDTLS_PLATFORM_MS_TIME_ALT
/* mbed TLS feature support */
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED

View file

@ -37,6 +37,7 @@
#if defined(CONFIG_MBEDTLS_HAVE_TIME_DATE)
#define MBEDTLS_HAVE_TIME
#define MBEDTLS_HAVE_TIME_DATE
#define MBEDTLS_PLATFORM_MS_TIME_ALT
#endif
#if defined(CONFIG_MBEDTLS_TEST)

View file

@ -15,6 +15,8 @@
#include <zephyr/drivers/entropy.h>
#include <zephyr/random/random.h>
#include <mbedtls/entropy.h>
#include <mbedtls/platform_time.h>
#include <mbedtls/debug.h>
@ -107,3 +109,9 @@ int mbedtls_init(void)
{
return _mbedtls_init();
}
/* TLS 1.3 ticket lifetime needs a timing interface */
mbedtls_ms_time_t mbedtls_ms_time(void)
{
return (mbedtls_ms_time_t)k_uptime_get();
}

View file

@ -3,3 +3,4 @@
#define MBEDTLS_HAVE_TIME
#define MBEDTLS_HAVE_TIME_DATE
#define MBEDTLS_PLATFORM_TIME_ALT
#define MBEDTLS_PLATFORM_MS_TIME_ALT