summaryrefslogtreecommitdiff
path: root/dbrandom.c
diff options
context:
space:
mode:
Diffstat (limited to 'dbrandom.c')
-rw-r--r--dbrandom.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/dbrandom.c b/dbrandom.c
index e2f55c2..cf280f4 100644
--- a/dbrandom.c
+++ b/dbrandom.c
@@ -306,7 +306,7 @@ void gen_random_mpint(mp_int *max, mp_int *rand) {
/* keep regenerating until we get one satisfying
* 0 < rand < max */
- } while (mp_cmp(rand, max) != MP_LT);
+ } while (!(mp_cmp(rand, max) == MP_LT && mp_cmp_d(rand, 0) == MP_GT));
m_burn(randbuf, len);
m_free(randbuf);
}