From 16aab18ae94a2b46a3f65c366d5ed6aabc621d7b Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Thu, 19 Jun 2025 08:22:37 +1000 Subject: [PATCH] Entropy: fix proportion health test Update the count of entries. --- wolfcrypt/src/random.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c index 059e50c80..99de26e0a 100644 --- a/wolfcrypt/src/random.c +++ b/wolfcrypt/src/random.c @@ -1342,6 +1342,8 @@ static int Entropy_HealthTest_Proportion(byte noise) prop_last = (prop_last + 1) % PROP_WINDOW_SIZE; /* Added sample to queue - add count. */ prop_cnt[noise]++; + /* Update count of store values. */ + prop_total++; /* Check whether first value has too many repetitions in queue. */ if (prop_cnt[noise] >= PROP_CUTOFF) { @@ -1360,6 +1362,8 @@ static int Entropy_HealthTest_Proportion(byte noise) prop_first = (prop_first + 1) % PROP_WINDOW_SIZE; /* Removed first sample from queue - remove count. */ prop_cnt[val]--; + /* Update count of store values. */ + prop_total--; } }