Commit 885e5e19b40f621c61cf75b0b20aae19482cc424

Daniel Mendler 2019-05-13T11:14:57

move mp_rand_digit to bn_deprecated.c

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;