Skip to content

Commit 4d7ffd3

Browse files
committed
Added checks for PRNG generated values
1 parent 0df542c commit 4d7ffd3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

demo/test.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,8 +1574,14 @@ static int test_mp_log(void)
15741574
/* Random a, base */
15751575
for (i = 1; i < 256; i++) {
15761576
DO(mp_rand(&a, i));
1577+
if (mp_cmp_d(&a,2u) == MP_LT) {
1578+
continue;
1579+
}
15771580
for (j = 1; j < ((i/2)+1); j++) {
15781581
DO(mp_rand(&base, j));
1582+
if (mp_cmp_d(&base,2u) == MP_LT) {
1583+
continue;
1584+
}
15791585
DO(mp_log(&a, &base, &lb));
15801586
DO(mp_expt_n(&base, lb, &bn));
15811587
/* "bn" must be smaller than or equal to "a" at this point. */

0 commit comments

Comments
 (0)