From ecfbf6f913e146b5c83b523cbcfb4a7ada4e4d7f Mon Sep 17 00:00:00 2001 From: czurnieden Date: Tue, 30 May 2023 02:59:27 +0200 Subject: [PATCH] Added checks for PRNG generated values --- demo/test.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/demo/test.c b/demo/test.c index 939fcc0e..ebf46198 100644 --- a/demo/test.c +++ b/demo/test.c @@ -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. */