Skip to content

Commit 17f3da1

Browse files
authored
Merge pull request #8899 from SparkiDev/entropy_cont_tests_fix_2
Entropy: fix proportion health test
2 parents 7610b4e + 16aab18 commit 17f3da1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

wolfcrypt/src/random.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,6 +1342,8 @@ static int Entropy_HealthTest_Proportion(byte noise)
13421342
prop_last = (prop_last + 1) % PROP_WINDOW_SIZE;
13431343
/* Added sample to queue - add count. */
13441344
prop_cnt[noise]++;
1345+
/* Update count of store values. */
1346+
prop_total++;
13451347

13461348
/* Check whether first value has too many repetitions in queue. */
13471349
if (prop_cnt[noise] >= PROP_CUTOFF) {
@@ -1360,6 +1362,8 @@ static int Entropy_HealthTest_Proportion(byte noise)
13601362
prop_first = (prop_first + 1) % PROP_WINDOW_SIZE;
13611363
/* Removed first sample from queue - remove count. */
13621364
prop_cnt[val]--;
1365+
/* Update count of store values. */
1366+
prop_total--;
13631367
}
13641368
}
13651369

0 commit comments

Comments
 (0)