rp2/mbedtls: Enable certificate validity time validation.
This commit is contained in:
parent
10f85fee18
commit
b560b9fe71
|
@ -93,6 +93,8 @@
|
|||
#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE
|
||||
#define MBEDTLS_X509_CRT_PARSE_C
|
||||
#define MBEDTLS_X509_USE_C
|
||||
#define MBEDTLS_HAVE_TIME
|
||||
#define MBEDTLS_HAVE_TIME_DATE
|
||||
|
||||
// Memory allocation hooks
|
||||
#include <stdlib.h>
|
||||
|
@ -103,6 +105,10 @@ void m_tracked_free(void *ptr);
|
|||
#define MBEDTLS_PLATFORM_STD_FREE m_tracked_free
|
||||
#define MBEDTLS_PLATFORM_SNPRINTF_MACRO snprintf
|
||||
|
||||
// Time hook
|
||||
time_t rp2_rtctime_seconds(time_t *timer);
|
||||
#define MBEDTLS_PLATFORM_TIME_MACRO rp2_rtctime_seconds
|
||||
|
||||
#include "mbedtls/check_config.h"
|
||||
|
||||
#endif /* MICROPY_INCLUDED_MBEDTLS_CONFIG_H */
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
|
||||
#include "mbedtls_config.h"
|
||||
|
||||
#include "hardware/rtc.h"
|
||||
#include "shared/timeutils/timeutils.h"
|
||||
|
||||
extern uint8_t rosc_random_u8(size_t cycles);
|
||||
|
||||
int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t *olen) {
|
||||
|
@ -39,4 +42,10 @@ int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t
|
|||
return 0;
|
||||
}
|
||||
|
||||
time_t rp2_rtctime_seconds(time_t *timer) {
|
||||
datetime_t t;
|
||||
rtc_get_datetime(&t);
|
||||
return timeutils_seconds_since_epoch(t.year, t.month, t.day, t.hour, t.min, t.sec);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue