Skip to content

Commit 9f0b3f5

Browse files
authored
Merge pull request #552 from czurnieden/sanitize_log_tests
Added checks for PRNG generated values
2 parents 0df542c + ecfbf6f commit 9f0b3f5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

demo/test.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,9 +1573,13 @@ static int test_mp_log(void)
15731573

15741574
/* Random a, base */
15751575
for (i = 1; i < 256; i++) {
1576-
DO(mp_rand(&a, i));
1576+
do {
1577+
DO(mp_rand(&a, i));
1578+
} while (mp_cmp_d(&a,2u) == MP_LT);
15771579
for (j = 1; j < ((i/2)+1); j++) {
1578-
DO(mp_rand(&base, j));
1580+
do {
1581+
DO(mp_rand(&base, j));
1582+
} while (mp_cmp_d(&base,2u) == MP_LT);
15791583
DO(mp_log(&a, &base, &lb));
15801584
DO(mp_expt_n(&base, lb, &bn));
15811585
/* "bn" must be smaller than or equal to "a" at this point. */

0 commit comments

Comments
 (0)