s_mp_reverse is only used by mp_to_radix
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
diff --git a/mp_to_radix.c b/mp_to_radix.c
index 95def74..b0564a1 100644
--- a/mp_to_radix.c
+++ b/mp_to_radix.c
@@ -3,6 +3,23 @@
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
+/* reverse an array, used for radix code */
+static void s_mp_reverse(unsigned char *s, size_t len)
+{
+ size_t ix, iy;
+ unsigned char t;
+
+ ix = 0u;
+ iy = len - 1u;
+ while (ix < iy) {
+ t = s[ix];
+ s[ix] = s[iy];
+ s[iy] = t;
+ ++ix;
+ --iy;
+ }
+}
+
/* stores a bignum as a ASCII string in a given radix (2..64)
*
* Stores upto "size - 1" chars and always a NULL byte, puts the number of characters
diff --git a/s_mp_reverse.c b/s_mp_reverse.c
deleted file mode 100644
index d288dc5..0000000
--- a/s_mp_reverse.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "tommath_private.h"
-#ifdef S_MP_REVERSE_C
-/* LibTomMath, multiple-precision integer library -- Tom St Denis */
-/* SPDX-License-Identifier: Unlicense */
-
-/* reverse an array, used for radix code */
-void s_mp_reverse(unsigned char *s, size_t len)
-{
- size_t ix, iy;
- unsigned char t;
-
- ix = 0u;
- iy = len - 1u;
- while (ix < iy) {
- t = s[ix];
- s[ix] = s[iy];
- s[iy] = t;
- ++ix;
- --iy;
- }
-}
-#endif
diff --git a/tommath_private.h b/tommath_private.h
index 1916f87..e26025f 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -209,7 +209,6 @@ MP_PRIVATE mp_err s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P
MP_PRIVATE mp_err s_mp_rand_platform(void *p, size_t n) MP_WUR;
typedef int mp_prime_callback(unsigned char *dst, int len, void *dat);
MP_PRIVATE mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, mp_prime_callback cb, void *dat);
-MP_PRIVATE void s_mp_reverse(unsigned char *s, size_t len);
MP_PRIVATE mp_err s_mp_prime_is_divisible(const mp_int *a, mp_bool *result);
MP_PRIVATE mp_digit s_mp_log_d(mp_digit base, mp_digit n);
MP_PRIVATE mp_err s_mp_log(const mp_int *a, uint32_t base, uint32_t *c);