From 2629b8b1fb32f8e8bd6d293921708c46a2513c2e Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Wed, 15 Sep 2021 22:42:41 -0500 Subject: [PATCH] wolfcrypt/src/wc_port.c LINUXKM time(): use ktime_get_coarse_real_ts64 instead of ktime_get_real_seconds, to avoid GPL-only function, and fix the calculation in the kernel 3.x codepath. --- wolfcrypt/src/wc_port.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c index 9536140a1..6c5066856 100644 --- a/wolfcrypt/src/wc_port.c +++ b/wolfcrypt/src/wc_port.c @@ -2438,9 +2438,11 @@ time_t time(time_t * timer) #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0) struct timespec ts; getnstimeofday(&ts); - ret = ts.tv_sec * 1000000000LL + ts.tv_nsec; + ret = ts.tv_sec; #else - ret = ktime_get_real_seconds(); + struct timespec64 ts; + ktime_get_coarse_real_ts64(&ts); + ret = ts.tv_sec; #endif if (timer) *timer = ret;