From 4862b57415724b0b3a3812ce7d7752cc8530de13 Mon Sep 17 00:00:00 2001 From: David Garske Date: Thu, 13 Jul 2023 14:30:58 -0700 Subject: [PATCH] Simplify Windows `Entropy_TimeHiRes`, which just needs a precision timer to differentiate, not specific time. --- wolfcrypt/src/random.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c index 8e850cda9..a8f873f2d 100644 --- a/wolfcrypt/src/random.c +++ b/wolfcrypt/src/random.c @@ -988,22 +988,13 @@ static void Entropy_StopThread(void) /* Get the high resolution time counter. * - * @return 64-bit time that is the nanoseconds of current time. + * @return 64-bit timer */ static WC_INLINE word64 Entropy_TimeHiRes(void) { - static int init = 0; - static LARGE_INTEGER freq; - LARGE_INTEGER count; - - if (!init) { - QueryPerformanceFrequency(&freq); - init = 1; - } - + LARGE_INTEGER count; QueryPerformanceCounter(&count); - - return (word64)(count.QuadPart / (freq.QuadPart / 1000 / 1000)); + return (word64)(count.QuadPart); } #else