Skip to content

Commit 71d5117

Browse files
committed
Entropy: fix proportion health test
Update the count of entries.
1 parent 74de689 commit 71d5117

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)