move mp_rand_digit to bn_deprecated.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
diff --git a/bn_deprecated.c b/bn_deprecated.c
index 5dc3da9..52c17dc 100644
--- a/bn_deprecated.c
+++ b/bn_deprecated.c
@@ -6,6 +6,14 @@
/* SPDX-License-Identifier: Unlicense */
#include <tommath_private.h>
+#ifdef BN_MP_RAND_DIGIT_C
+mp_err mp_rand_digit(mp_digit *r)
+{
+ mp_err ret = s_mp_rand_source(r, sizeof(mp_digit));
+ *r &= MP_MASK;
+ return ret;
+}
+#endif
#ifdef BN_FAST_MP_INVMOD_C
mp_err fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c)
{
diff --git a/bn_mp_rand.c b/bn_mp_rand.c
index aad48d9..9bb3f9e 100644
--- a/bn_mp_rand.c
+++ b/bn_mp_rand.c
@@ -10,14 +10,6 @@ void mp_rand_source(mp_err(*source)(void *out, size_t size))
s_mp_rand_source = (source == NULL) ? s_mp_rand_platform : source;
}
-/* makes a pseudo-random int of a given size */
-mp_err mp_rand_digit(mp_digit *r)
-{
- mp_err ret = s_mp_rand_source(r, sizeof(mp_digit));
- *r &= MP_MASK;
- return ret;
-}
-
mp_err mp_rand(mp_int *a, int digits)
{
int i;