change the clock source to MONOTONIC

We need a non-settable source to avoid security issues.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu 2023-03-15 18:58:51 +08:00
parent e7ea823d43
commit 205a741307

View File

@ -181,7 +181,7 @@ mbedtls_ms_time_t mbedtls_ms_time(void)
struct timespec tv; struct timespec tv;
mbedtls_ms_time_t current_ms; mbedtls_ms_time_t current_ms;
ret = clock_gettime(CLOCK_REALTIME, &tv); ret = clock_gettime(CLOCK_MONOTONIC, &tv);
if (ret) { if (ret) {
return time(NULL) * 1000; return time(NULL) * 1000;
} }