Skip to content

Commit e1ac779

Browse files
committed
samd/mbedtls: Adapt for mbdetls v3.5.1.
Signed-off-by: robert-hh <robert@hammelrath.com>
1 parent 0096fa2 commit e1ac779

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ports/samd/mbedtls/mbedtls_config.h renamed to ports/samd/mbedtls/mbedtls_config_port.h

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include <time.h>
3131
extern time_t samd_rtctime_seconds(time_t *timer);
3232
#define MBEDTLS_PLATFORM_TIME_MACRO samd_rtctime_seconds
33+
#define MBEDTLS_PLATFORM_MS_TIME_ALT mbedtls_ms_time
34+
3335
// Set MicroPython-specific options.
3436
#define MICROPY_MBEDTLS_CONFIG_BARE_METAL (1)
3537

ports/samd/mbedtls/mbedtls_port.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@
2626

2727
#ifdef MICROPY_SSL_MBEDTLS
2828

29-
#include "mbedtls_config.h"
29+
#include "mbedtls_config_port.h"
3030
#include <stdint.h>
3131
uint32_t trng_random_u32(void);
3232
#if defined(MBEDTLS_HAVE_TIME) || defined(MBEDTLS_HAVE_TIME_DATE)
3333
#include <stdbool.h>
3434
#include "py/runtime.h"
3535
#include "shared/timeutils/timeutils.h"
36+
#include "mbedtls/platform_time.h"
3637
extern void rtc_gettime(timeutils_struct_time_t *tm);
3738
#endif
3839

@@ -53,6 +54,13 @@ time_t samd_rtctime_seconds(time_t *timer) {
5354
rtc_gettime(&tm);
5455
return timeutils_seconds_since_epoch(tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
5556
}
57+
58+
mbedtls_ms_time_t mbedtls_ms_time(void) {
59+
time_t *tv = NULL;
60+
mbedtls_ms_time_t current_ms;
61+
current_ms = samd_rtctime_seconds(tv) * 1000;
62+
return current_ms;
63+
}
5664
#endif
5765

5866
#if defined(MBEDTLS_HAVE_TIME_DATE)

0 commit comments

Comments
 (0)