2018-05-02 19:43:17 +00:00
|
|
|
#include "tommath_private.h"
|
2004-10-29 22:07:18 +00:00
|
|
|
#ifdef BN_REVERSE_C
|
2019-04-07 13:29:11 +00:00
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
|
|
|
/* SPDX-License-Identifier: Unlicense */
|
2003-02-28 16:08:34 +00:00
|
|
|
|
|
|
|
/* reverse an array, used for radix code */
|
2017-08-30 17:07:12 +00:00
|
|
|
void bn_reverse(unsigned char *s, int len)
|
2003-02-28 16:08:34 +00:00
|
|
|
{
|
2017-08-30 17:15:27 +00:00
|
|
|
int ix, iy;
|
|
|
|
unsigned char t;
|
2003-02-28 16:08:34 +00:00
|
|
|
|
2017-08-30 17:15:27 +00:00
|
|
|
ix = 0;
|
|
|
|
iy = len - 1;
|
|
|
|
while (ix < iy) {
|
|
|
|
t = s[ix];
|
|
|
|
s[ix] = s[iy];
|
|
|
|
s[iy] = t;
|
|
|
|
++ix;
|
|
|
|
--iy;
|
|
|
|
}
|
2003-02-28 16:08:34 +00:00
|
|
|
}
|
2004-10-29 22:07:18 +00:00
|
|
|
#endif
|