summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_rand.c
diff options
context:
space:
mode:
Diffstat (limited to 'libtommath/bn_mp_rand.c')
-rw-r--r--libtommath/bn_mp_rand.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libtommath/bn_mp_rand.c b/libtommath/bn_mp_rand.c
index af017f2..17aa5a2 100644
--- a/libtommath/bn_mp_rand.c
+++ b/libtommath/bn_mp_rand.c
@@ -9,8 +9,7 @@
* Michael Fromberger but has been written from scratch with
* additional optimizations in place.
*
- * The library is free for all purposes without any express
- * guarantee it works.
+ * SPDX-License-Identifier: Unlicense
*/
/* First the OS-specific special cases
@@ -173,7 +172,7 @@ static int s_rand_digit(mp_digit *p)
}
/* makes a pseudo-random int of a given size */
-static int s_gen_random(mp_digit *r)
+int mp_rand_digit(mp_digit *r)
{
int ret = s_rand_digit(r);
*r &= MP_MASK;
@@ -192,7 +191,7 @@ int mp_rand(mp_int *a, int digits)
/* first place a random non-zero digit */
do {
- if (s_gen_random(&d) != MP_OKAY) {
+ if (mp_rand_digit(&d) != MP_OKAY) {
return MP_VAL;
}
} while (d == 0u);
@@ -206,7 +205,7 @@ int mp_rand(mp_int *a, int digits)
return res;
}
- if (s_gen_random(&d) != MP_OKAY) {
+ if (mp_rand_digit(&d) != MP_OKAY) {
return MP_VAL;
}
if ((res = mp_add_d(a, d, a)) != MP_OKAY) {