s_mp_reverse is only used by mp_to_radix

This commit is contained in:
Daniel Mendler 2019-10-23 20:07:33 +02:00
parent eb70378bfb
commit f8b2f5d6fe
No known key found for this signature in database
GPG Key ID: D88ADB2A2693CA43
3 changed files with 17 additions and 23 deletions

View File

@ -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

View File

@ -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

View File

@ -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);