Skip to content

Commit

Permalink
Added checks for PRNG generated values
Browse files Browse the repository at this point in the history
  • Loading branch information
czurnieden committed May 30, 2023
1 parent 0df542c commit ecfbf6f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions demo/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1573,9 +1573,13 @@ static int test_mp_log(void)

/* Random a, base */
for (i = 1; i < 256; i++) {
DO(mp_rand(&a, i));
do {
DO(mp_rand(&a, i));
} while (mp_cmp_d(&a,2u) == MP_LT);
for (j = 1; j < ((i/2)+1); j++) {
DO(mp_rand(&base, j));
do {
DO(mp_rand(&base, j));
} while (mp_cmp_d(&base,2u) == MP_LT);
DO(mp_log(&a, &base, &lb));
DO(mp_expt_n(&base, lb, &bn));
/* "bn" must be smaller than or equal to "a" at this point. */
Expand Down

0 comments on commit ecfbf6f

Please sign in to comment.