Skip to content

Commit a96983e

Browse files
authored
Merge pull request #6612 from dgarske/entropy_memuse_win32
Add support for MemUse Entropy on Windows.
2 parents 40d0a14 + 4862b57 commit a96983e

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

wolfcrypt/src/random.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,20 @@ static void Entropy_StopThread(void)
983983
}
984984
}
985985
/* end if defined(HAVE_PTHREAD) */
986+
987+
#elif defined(_WIN32) /* USE_WINDOWS_API */
988+
989+
/* Get the high resolution time counter.
990+
*
991+
* @return 64-bit timer
992+
*/
993+
static WC_INLINE word64 Entropy_TimeHiRes(void)
994+
{
995+
LARGE_INTEGER count;
996+
QueryPerformanceCounter(&count);
997+
return (word64)(count.QuadPart);
998+
}
999+
9861000
#else
9871001

9881002
#error "No high precision time available for MemUse Entropy."
@@ -1283,7 +1297,7 @@ static int Entropy_HealthTest_Proportion(byte noise)
12831297
}
12841298
else {
12851299
/* Get first value in queue - value to test. */
1286-
byte val = prop_samples[prop_first];
1300+
byte val = (byte)prop_samples[prop_first];
12871301
/* Store new sample in queue. */
12881302
prop_samples[prop_last] = noise;
12891303
/* Update first index now that we have removed in from the queue. */

0 commit comments

Comments
 (0)