kopia lustrzana https://github.com/micropython/micropython
samd/mbedtls: Adapt for mbdetls v3.5.1.
Signed-off-by: robert-hh <robert@hammelrath.com>pull/12464/head
rodzic
0096fa2378
commit
e1ac779fd3
|
@ -30,6 +30,8 @@
|
|||
#include <time.h>
|
||||
extern time_t samd_rtctime_seconds(time_t *timer);
|
||||
#define MBEDTLS_PLATFORM_TIME_MACRO samd_rtctime_seconds
|
||||
#define MBEDTLS_PLATFORM_MS_TIME_ALT mbedtls_ms_time
|
||||
|
||||
// Set MicroPython-specific options.
|
||||
#define MICROPY_MBEDTLS_CONFIG_BARE_METAL (1)
|
||||
|
|
@ -26,13 +26,14 @@
|
|||
|
||||
#ifdef MICROPY_SSL_MBEDTLS
|
||||
|
||||
#include "mbedtls_config.h"
|
||||
#include "mbedtls_config_port.h"
|
||||
#include <stdint.h>
|
||||
uint32_t trng_random_u32(void);
|
||||
#if defined(MBEDTLS_HAVE_TIME) || defined(MBEDTLS_HAVE_TIME_DATE)
|
||||
#include <stdbool.h>
|
||||
#include "py/runtime.h"
|
||||
#include "shared/timeutils/timeutils.h"
|
||||
#include "mbedtls/platform_time.h"
|
||||
extern void rtc_gettime(timeutils_struct_time_t *tm);
|
||||
#endif
|
||||
|
||||
|
@ -53,6 +54,13 @@ time_t samd_rtctime_seconds(time_t *timer) {
|
|||
rtc_gettime(&tm);
|
||||
return timeutils_seconds_since_epoch(tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
}
|
||||
|
||||
mbedtls_ms_time_t mbedtls_ms_time(void) {
|
||||
time_t *tv = NULL;
|
||||
mbedtls_ms_time_t current_ms;
|
||||
current_ms = samd_rtctime_seconds(tv) * 1000;
|
||||
return current_ms;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_HAVE_TIME_DATE)
|
||||
|
|
Ładowanie…
Reference in New Issue