apply rename
This commit is contained in:
parent
7469e852f1
commit
fbfcb66184
87
bn_deprecated.c
Normal file
87
bn_deprecated.c
Normal file
@ -0,0 +1,87 @@
|
||||
#include "tommath_private.h"
|
||||
#ifdef BN_DEPRECATED_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
#include <tommath_private.h>
|
||||
#ifdef BN_FAST_MP_INVMOD_C
|
||||
int fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
{
|
||||
return s_mp_invmod_fast(a, b, c);
|
||||
}
|
||||
#endif
|
||||
#ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C
|
||||
int fast_mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho)
|
||||
{
|
||||
return s_mp_montgomery_reduce_fast(x, n, rho);
|
||||
}
|
||||
#endif
|
||||
#ifdef BN_FAST_S_MP_MUL_DIGS_C
|
||||
int fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
|
||||
{
|
||||
return s_mp_mul_digs_fast(a, b, c, digs);
|
||||
}
|
||||
#endif
|
||||
#ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C
|
||||
int fast_s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
|
||||
{
|
||||
return s_mp_mul_high_digs_fast(a, b, c, digs);
|
||||
}
|
||||
#endif
|
||||
#ifdef BN_FAST_S_MP_SQR_C
|
||||
int fast_s_mp_sqr(const mp_int *a, mp_int *b)
|
||||
{
|
||||
return s_mp_sqr_fast(a, b);
|
||||
}
|
||||
#endif
|
||||
#ifdef BN_MP_BALANCE_MUL_C
|
||||
int mp_balance_mul(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
{
|
||||
return s_mp_balance_mul(a, b, c);
|
||||
}
|
||||
#endif
|
||||
#ifdef BN_MP_EXPTMOD_FAST_C
|
||||
int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode)
|
||||
{
|
||||
return s_mp_exptmod_fast(G, X, P, Y, redmode);
|
||||
}
|
||||
#endif
|
||||
#ifdef BN_MP_INVMOD_SLOW_C
|
||||
int mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
{
|
||||
return s_mp_invmod_slow(a, b, c);
|
||||
}
|
||||
#endif
|
||||
#ifdef BN_MP_KARATSUBA_MUL_C
|
||||
int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
{
|
||||
return s_mp_karatsuba_mul(a, b, c);
|
||||
}
|
||||
#endif
|
||||
#ifdef BN_MP_KARATSUBA_SQR_C
|
||||
int mp_karatsuba_sqr(const mp_int *a, mp_int *b)
|
||||
{
|
||||
return s_mp_karatsuba_sqr(a, b);
|
||||
}
|
||||
#endif
|
||||
#ifdef BN_MP_TOOM_MUL_C
|
||||
int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
{
|
||||
return s_mp_toom_mul(a, b, c);
|
||||
}
|
||||
#endif
|
||||
#ifdef BN_MP_TOOM_SQR_C
|
||||
int mp_toom_sqr(const mp_int *a, mp_int *b)
|
||||
{
|
||||
return s_mp_toom_sqr(a, b);
|
||||
}
|
||||
#endif
|
||||
#ifdef BN_REVERSE_C
|
||||
void bn_reverse(unsigned char *s, int len)
|
||||
{
|
||||
s_mp_reverse(s, len);
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -75,9 +75,9 @@ int mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y)
|
||||
#endif
|
||||
|
||||
/* if the modulus is odd or dr != 0 use the montgomery method */
|
||||
#ifdef BN_MP_EXPTMOD_FAST_C
|
||||
#ifdef BN_S_MP_EXPTMOD_FAST_C
|
||||
if (MP_IS_ODD(P) || (dr != 0)) {
|
||||
return mp_exptmod_fast(G, X, P, Y, dr);
|
||||
return s_mp_exptmod_fast(G, X, P, Y, dr);
|
||||
} else {
|
||||
#endif
|
||||
#ifdef BN_S_MP_EXPTMOD_C
|
||||
@ -87,7 +87,7 @@ int mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y)
|
||||
/* no exptmod for evens */
|
||||
return MP_VAL;
|
||||
#endif
|
||||
#ifdef BN_MP_EXPTMOD_FAST_C
|
||||
#ifdef BN_S_MP_EXPTMOD_FAST_C
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -11,15 +11,15 @@ int mp_invmod(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
return MP_VAL;
|
||||
}
|
||||
|
||||
#ifdef BN_FAST_MP_INVMOD_C
|
||||
#ifdef BN_S_MP_INVMOD_FAST_C
|
||||
/* if the modulus is odd we can use a faster routine instead */
|
||||
if (MP_IS_ODD(b)) {
|
||||
return fast_mp_invmod(a, b, c);
|
||||
return s_mp_invmod_fast(a, b, c);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BN_MP_INVMOD_SLOW_C
|
||||
return mp_invmod_slow(a, b, c);
|
||||
#ifdef BN_S_MP_INVMOD_SLOW_C
|
||||
return s_mp_invmod_slow(a, b, c);
|
||||
#else
|
||||
return MP_VAL;
|
||||
#endif
|
||||
|
@ -20,7 +20,7 @@ int mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho)
|
||||
(x->used <= (int)MP_WARRAY) &&
|
||||
(n->used <
|
||||
(int)(1u << ((CHAR_BIT * sizeof(mp_word)) - (2u * (size_t)DIGIT_BIT))))) {
|
||||
return fast_mp_montgomery_reduce(x, n, rho);
|
||||
return s_mp_montgomery_reduce_fast(x, n, rho);
|
||||
}
|
||||
|
||||
/* grow the input as required */
|
||||
|
18
bn_mp_mul.c
18
bn_mp_mul.c
@ -7,11 +7,11 @@
|
||||
int mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
{
|
||||
int res, neg;
|
||||
#ifdef BN_MP_BALANCE_MUL_C
|
||||
#ifdef BN_S_MP_BALANCE_MUL_C
|
||||
int len_b, len_a;
|
||||
#endif
|
||||
neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG;
|
||||
#ifdef BN_MP_BALANCE_MUL_C
|
||||
#ifdef BN_S_MP_BALANCE_MUL_C
|
||||
len_a = a->used;
|
||||
len_b = b->used;
|
||||
|
||||
@ -37,22 +37,22 @@ int mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
goto GO_ON;
|
||||
}
|
||||
|
||||
res = mp_balance_mul(a,b,c);
|
||||
res = s_mp_balance_mul(a,b,c);
|
||||
goto END;
|
||||
|
||||
GO_ON:
|
||||
#endif
|
||||
|
||||
/* use Toom-Cook? */
|
||||
#ifdef BN_MP_TOOM_MUL_C
|
||||
#ifdef BN_S_MP_TOOM_MUL_C
|
||||
if (MP_MIN(a->used, b->used) >= TOOM_MUL_CUTOFF) {
|
||||
res = mp_toom_mul(a, b, c);
|
||||
res = s_mp_toom_mul(a, b, c);
|
||||
} else
|
||||
#endif
|
||||
#ifdef BN_MP_KARATSUBA_MUL_C
|
||||
#ifdef BN_S_MP_KARATSUBA_MUL_C
|
||||
/* use Karatsuba? */
|
||||
if (MP_MIN(a->used, b->used) >= KARATSUBA_MUL_CUTOFF) {
|
||||
res = mp_karatsuba_mul(a, b, c);
|
||||
res = s_mp_karatsuba_mul(a, b, c);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@ -64,11 +64,11 @@ GO_ON:
|
||||
*/
|
||||
int digs = a->used + b->used + 1;
|
||||
|
||||
#ifdef BN_FAST_S_MP_MUL_DIGS_C
|
||||
#ifdef BN_S_MP_MUL_DIGS_FAST_C
|
||||
if ((digs < (int)MP_WARRAY) &&
|
||||
(MP_MIN(a->used, b->used) <=
|
||||
(int)(1u << ((CHAR_BIT * sizeof(mp_word)) - (2u * (size_t)DIGIT_BIT))))) {
|
||||
res = fast_s_mp_mul_digs(a, b, c, digs);
|
||||
res = s_mp_mul_digs_fast(a, b, c, digs);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
@ -30,8 +30,8 @@ int mp_reduce(mp_int *x, const mp_int *m, const mp_int *mu)
|
||||
if ((res = s_mp_mul_high_digs(&q, mu, &q, um)) != MP_OKAY) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
#elif defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C)
|
||||
if ((res = fast_s_mp_mul_high_digs(&q, mu, &q, um)) != MP_OKAY) {
|
||||
#elif defined(BN_S_MP_MUL_HIGH_DIGS_FAST_C)
|
||||
if ((res = s_mp_mul_high_digs_fast(&q, mu, &q, um)) != MP_OKAY) {
|
||||
goto CLEANUP;
|
||||
}
|
||||
#else
|
||||
|
12
bn_mp_sqr.c
12
bn_mp_sqr.c
@ -8,25 +8,25 @@ int mp_sqr(const mp_int *a, mp_int *b)
|
||||
{
|
||||
int res;
|
||||
|
||||
#ifdef BN_MP_TOOM_SQR_C
|
||||
#ifdef BN_S_MP_TOOM_SQR_C
|
||||
/* use Toom-Cook? */
|
||||
if (a->used >= TOOM_SQR_CUTOFF) {
|
||||
res = mp_toom_sqr(a, b);
|
||||
res = s_mp_toom_sqr(a, b);
|
||||
/* Karatsuba? */
|
||||
} else
|
||||
#endif
|
||||
#ifdef BN_MP_KARATSUBA_SQR_C
|
||||
#ifdef BN_S_MP_KARATSUBA_SQR_C
|
||||
if (a->used >= KARATSUBA_SQR_CUTOFF) {
|
||||
res = mp_karatsuba_sqr(a, b);
|
||||
res = s_mp_karatsuba_sqr(a, b);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
#ifdef BN_FAST_S_MP_SQR_C
|
||||
#ifdef BN_S_MP_SQR_FAST_C
|
||||
/* can we use the fast comba multiplier? */
|
||||
if ((((a->used * 2) + 1) < (int)MP_WARRAY) &&
|
||||
(a->used <
|
||||
(int)(1u << (((CHAR_BIT * sizeof(mp_word)) - (2u * (size_t)DIGIT_BIT)) - 1u)))) {
|
||||
res = fast_s_mp_sqr(a, b);
|
||||
res = s_mp_sqr_fast(a, b);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ int mp_to_unsigned_bin(const mp_int *a, unsigned char *b)
|
||||
return res;
|
||||
}
|
||||
}
|
||||
bn_reverse(b, x);
|
||||
s_mp_reverse(b, x);
|
||||
mp_clear(&t);
|
||||
return MP_OKAY;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ int mp_toradix(const mp_int *a, char *str, int radix)
|
||||
/* reverse the digits of the string. In this case _s points
|
||||
* to the first digit [exluding the sign] of the number]
|
||||
*/
|
||||
bn_reverse((unsigned char *)_s, digs);
|
||||
s_mp_reverse((unsigned char *)_s, digs);
|
||||
|
||||
/* append a NULL so the string is properly terminated */
|
||||
*str = '\0';
|
||||
|
@ -60,7 +60,7 @@ int mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen)
|
||||
/* reverse the digits of the string. In this case _s points
|
||||
* to the first digit [exluding the sign] of the number
|
||||
*/
|
||||
bn_reverse((unsigned char *)_s, digs);
|
||||
s_mp_reverse((unsigned char *)_s, digs);
|
||||
|
||||
/* append a NULL so the string is properly terminated */
|
||||
*str = '\0';
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "tommath_private.h"
|
||||
#ifdef BN_MP_BALANCE_MUL_C
|
||||
#ifdef BN_S_MP_BALANCE_MUL_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
|
||||
/* single-digit multiplication with the smaller number as the single-digit */
|
||||
int mp_balance_mul(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
int s_mp_balance_mul(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
{
|
||||
int e, count, len_a, len_b, nblocks, i, j, bsize;
|
||||
mp_int a0, tmp, A, B, r;
|
@ -1,5 +1,5 @@
|
||||
#include "tommath_private.h"
|
||||
#ifdef BN_MP_EXPTMOD_FAST_C
|
||||
#ifdef BN_S_MP_EXPTMOD_FAST_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
# define TAB_SIZE 256
|
||||
#endif
|
||||
|
||||
int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode)
|
||||
int s_mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode)
|
||||
{
|
||||
mp_int M[TAB_SIZE], res;
|
||||
mp_digit buf, mp;
|
||||
@ -83,10 +83,10 @@ int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y
|
||||
#endif
|
||||
|
||||
/* automatically pick the comba one if available (saves quite a few calls/ifs) */
|
||||
#ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C
|
||||
#ifdef BN_S_MP_MONTGOMERY_REDUCE_FAST_C
|
||||
if ((((P->used * 2) + 1) < (int)MP_WARRAY) &&
|
||||
(P->used < (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) {
|
||||
redux = fast_mp_montgomery_reduce;
|
||||
redux = s_mp_montgomery_reduce_fast;
|
||||
} else
|
||||
#endif
|
||||
{
|
@ -1,5 +1,5 @@
|
||||
#include "tommath_private.h"
|
||||
#ifdef BN_FAST_MP_INVMOD_C
|
||||
#ifdef BN_S_MP_INVMOD_FAST_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
* Based on slow invmod except this is optimized for the case where b is
|
||||
* odd as per HAC Note 14.64 on pp. 610
|
||||
*/
|
||||
int fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
int s_mp_invmod_fast(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
{
|
||||
mp_int x, y, u, v, B, D;
|
||||
int res, neg;
|
@ -1,10 +1,10 @@
|
||||
#include "tommath_private.h"
|
||||
#ifdef BN_MP_INVMOD_SLOW_C
|
||||
#ifdef BN_S_MP_INVMOD_SLOW_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
|
||||
/* hac 14.61, pp608 */
|
||||
int mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
int s_mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
{
|
||||
mp_int x, y, u, v, A, B, C, D;
|
||||
int res;
|
@ -1,5 +1,5 @@
|
||||
#include "tommath_private.h"
|
||||
#ifdef BN_MP_KARATSUBA_MUL_C
|
||||
#ifdef BN_S_MP_KARATSUBA_MUL_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
* Generally though the overhead of this method doesn't pay off
|
||||
* until a certain size (N ~ 80) is reached.
|
||||
*/
|
||||
int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
int s_mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
{
|
||||
mp_int x0, x1, y0, y1, t1, x0y0, x1y1;
|
||||
int B, err;
|
@ -1,5 +1,5 @@
|
||||
#include "tommath_private.h"
|
||||
#ifdef BN_MP_KARATSUBA_SQR_C
|
||||
#ifdef BN_S_MP_KARATSUBA_SQR_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* is essentially the same algorithm but merely
|
||||
* tuned to perform recursive squarings.
|
||||
*/
|
||||
int mp_karatsuba_sqr(const mp_int *a, mp_int *b)
|
||||
int s_mp_karatsuba_sqr(const mp_int *a, mp_int *b)
|
||||
{
|
||||
mp_int x0, x1, t1, t2, x0x0, x1x1;
|
||||
int B, err;
|
@ -1,5 +1,5 @@
|
||||
#include "tommath_private.h"
|
||||
#ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C
|
||||
#ifdef BN_S_MP_MONTGOMERY_REDUCE_FAST_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
*
|
||||
* Based on Algorithm 14.32 on pp.601 of HAC.
|
||||
*/
|
||||
int fast_mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho)
|
||||
int s_mp_montgomery_reduce_fast(mp_int *x, const mp_int *n, mp_digit rho)
|
||||
{
|
||||
int ix, res, olduse;
|
||||
mp_word W[MP_WARRAY];
|
@ -19,7 +19,7 @@ int s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
|
||||
if ((digs < (int)MP_WARRAY) &&
|
||||
(MP_MIN(a->used, b->used) <
|
||||
(int)(1u << ((CHAR_BIT * sizeof(mp_word)) - (2u * (size_t)DIGIT_BIT))))) {
|
||||
return fast_s_mp_mul_digs(a, b, c, digs);
|
||||
return s_mp_mul_digs_fast(a, b, c, digs);
|
||||
}
|
||||
|
||||
if ((res = mp_init_size(&t, digs)) != MP_OKAY) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "tommath_private.h"
|
||||
#ifdef BN_FAST_S_MP_MUL_DIGS_C
|
||||
#ifdef BN_S_MP_MUL_DIGS_FAST_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
* Based on Algorithm 14.12 on pp.595 of HAC.
|
||||
*
|
||||
*/
|
||||
int fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
|
||||
int s_mp_mul_digs_fast(const mp_int *a, const mp_int *b, mp_int *c, int digs)
|
||||
{
|
||||
int olduse, res, pa, ix, iz;
|
||||
mp_digit W[MP_WARRAY];
|
@ -15,10 +15,10 @@ int s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
|
||||
mp_digit tmpx, *tmpt, *tmpy;
|
||||
|
||||
/* can we use the fast multiplier? */
|
||||
#ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C
|
||||
#ifdef BN_S_MP_MUL_HIGH_DIGS_FAST_C
|
||||
if (((a->used + b->used + 1) < (int)MP_WARRAY)
|
||||
&& (MP_MIN(a->used, b->used) < (int)(1u << ((CHAR_BIT * sizeof(mp_word)) - (2u * (size_t)DIGIT_BIT))))) {
|
||||
return fast_s_mp_mul_high_digs(a, b, c, digs);
|
||||
return s_mp_mul_high_digs_fast(a, b, c, digs);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "tommath_private.h"
|
||||
#ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C
|
||||
#ifdef BN_S_MP_MUL_HIGH_DIGS_FAST_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
*
|
||||
* Based on Algorithm 14.12 on pp.595 of HAC.
|
||||
*/
|
||||
int fast_s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
|
||||
int s_mp_mul_high_digs_fast(const mp_int *a, const mp_int *b, mp_int *c, int digs)
|
||||
{
|
||||
int olduse, res, pa, ix, iz;
|
||||
mp_digit W[MP_WARRAY];
|
@ -1,10 +1,10 @@
|
||||
#include "tommath_private.h"
|
||||
#ifdef BN_REVERSE_C
|
||||
#ifdef BN_S_MP_REVERSE_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
|
||||
/* reverse an array, used for radix code */
|
||||
void bn_reverse(unsigned char *s, int len)
|
||||
void s_mp_reverse(unsigned char *s, int len)
|
||||
{
|
||||
int ix, iy;
|
||||
unsigned char t;
|
@ -1,5 +1,5 @@
|
||||
#include "tommath_private.h"
|
||||
#ifdef BN_FAST_S_MP_SQR_C
|
||||
#ifdef BN_S_MP_SQR_FAST_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
After that loop you do the squares and add them in.
|
||||
*/
|
||||
|
||||
int fast_s_mp_sqr(const mp_int *a, mp_int *b)
|
||||
int s_mp_sqr_fast(const mp_int *a, mp_int *b)
|
||||
{
|
||||
int olduse, res, pa, ix, iz;
|
||||
mp_digit W[MP_WARRAY], *tmpx;
|
@ -1,5 +1,5 @@
|
||||
#include "tommath_private.h"
|
||||
#ifdef BN_MP_TOOM_MUL_C
|
||||
#ifdef BN_S_MP_TOOM_MUL_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* only particularly useful on VERY large inputs
|
||||
* (we're talking 1000s of digits here...).
|
||||
*/
|
||||
int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
int s_mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c)
|
||||
{
|
||||
mp_int w0, w1, w2, w3, w4, tmp1, tmp2, a0, a1, a2, b0, b1, b2;
|
||||
int res, B;
|
@ -1,10 +1,10 @@
|
||||
#include "tommath_private.h"
|
||||
#ifdef BN_MP_TOOM_SQR_C
|
||||
#ifdef BN_S_MP_TOOM_SQR_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
|
||||
/* squaring using Toom-Cook 3-way algorithm */
|
||||
int mp_toom_sqr(const mp_int *a, mp_int *b)
|
||||
int s_mp_toom_sqr(const mp_int *a, mp_int *b)
|
||||
{
|
||||
mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2;
|
||||
int res, B;
|
4488
callgraph.txt
4488
callgraph.txt
File diff suppressed because it is too large
Load Diff
@ -1764,7 +1764,7 @@ LTM_ERR:
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
static int test_mp_balance_mul(void)
|
||||
static int test_s_mp_balance_mul(void)
|
||||
{
|
||||
mp_int a, b, c;
|
||||
int e = MP_OKAY;
|
||||
@ -1840,7 +1840,7 @@ int unit_tests(void)
|
||||
T(mp_tc_xor),
|
||||
T(mp_incr),
|
||||
T(mp_decr),
|
||||
T(mp_balance_mul),
|
||||
T(s_mp_balance_mul),
|
||||
T(mp_ilogb)
|
||||
#undef T
|
||||
};
|
||||
|
@ -160,11 +160,11 @@ The wrong \texttt{libtool} will build it all fine but when it comes to the final
|
||||
cc -I./ -Wall -Wsign-compare -Wextra -Wshadow -Wsystem-headers -Wdeclaration-afo...
|
||||
cc -I./ -Wall -Wsign-compare -Wextra -Wshadow -Wsystem-headers -Wdeclaration-afo...
|
||||
cc -I./ -Wall -Wsign-compare -Wextra -Wshadow -Wsystem-headers -Wdeclaration-afo...
|
||||
libtool --mode=link --tag=CC cc bn_error.lo bn_fast_mp_invmod.lo bn_fast_mp_mo
|
||||
libtool: link: cc bn_error.lo bn_fast_mp_invmod.lo bn_fast_mp_montgomery_reduce0
|
||||
libtool --mode=link --tag=CC cc bn_error.lo bn_s_mp_invmod_fast.lo bn_fast_mp_mo
|
||||
libtool: link: cc bn_error.lo bn_s_mp_invmod_fast.lo bn_s_mp_montgomery_reduce_fast0
|
||||
bn_error.lo: file not recognized: File format not recognized
|
||||
cc: error: linker command failed with exit code 1 (use -v to see invocation)
|
||||
Error while executing cc bn_error.lo bn_fast_mp_invmod.lo bn_fast_mp_montgomery0
|
||||
Error while executing cc bn_error.lo bn_s_mp_invmod_fast.lo bn_fast_mp_montgomery0
|
||||
gmake: *** [makefile.shared:64: libtommath.la] Error 1
|
||||
\end{alltt}
|
||||
|
||||
|
@ -2644,7 +2644,7 @@ $O \left ((p + q)n^2 \right )$ time to multiply two $n$-digit numbers. The Comb
|
||||
the speed increase is actually much more. With $O(n)$ space the algorithm can be reduced to $O(pn + qn)$ time by implementing the $n$ multiply
|
||||
and addition operations in the nested loop in parallel.
|
||||
|
||||
EXAM,bn_fast_s_mp_mul_digs.c
|
||||
EXAM,bn_s_mp_mul_digs_fast.c
|
||||
|
||||
As per the pseudo--code we first calculate $pa$ (line @47,MIN@) as the number of digits to output. Next we begin the outer loop
|
||||
to produce the individual columns of the product. We use the two aliases $tmpx$ and $tmpy$ (lines @61,tmpx@, @62,tmpy@) to point
|
||||
@ -2842,7 +2842,7 @@ of an additional temporary variable, the algorithm can avoid an addition memory
|
||||
|
||||
The remaining steps 13 through 18 compute the Karatsuba polynomial through a variety of digit shifting and addition operations.
|
||||
|
||||
EXAM,bn_mp_karatsuba_mul.c
|
||||
EXAM,bn_s_mp_karatsuba_mul.c
|
||||
|
||||
The new coding element in this routine, not seen in previous routines, is the usage of goto statements. The conventional
|
||||
wisdom is that goto statements should be avoided. This is generally true, however when every single function call can fail, it makes sense
|
||||
@ -2976,7 +2976,7 @@ that row $1$ must be subtracted from row $4$ and simultaneously row $0$ subtract
|
||||
Once the coeffients have been isolated, the polynomial $W(x) = \sum_{i=0}^{2n} w_i x^i$ is known. By substituting $\beta^{k}$ for $x$, the integer
|
||||
result $a \cdot b$ is produced.
|
||||
|
||||
EXAM,bn_mp_toom_mul.c
|
||||
EXAM,bn_s_mp_toom_mul.c
|
||||
|
||||
The first obvious thing to note is that this algorithm is complicated. The complexity is worth it if you are multiplying very
|
||||
large numbers. For example, a 10,000 digit multiplication takes approximaly 99,282,205 fewer single precision multiplications with
|
||||
@ -3217,7 +3217,7 @@ fewer multiplications and the routine ends up being faster.
|
||||
Finally the last difference is the addition of the ``square'' term outside the inner loop (step 5.8). We add in the square
|
||||
only to even outputs and it is the square of the term at the $\lfloor ix / 2 \rfloor$ position.
|
||||
|
||||
EXAM,bn_fast_s_mp_sqr.c
|
||||
EXAM,bn_s_mp_sqr_fast.c
|
||||
|
||||
This implementation is essentially a copy of Comba multiplication with the appropriate changes added to make it faster for
|
||||
the special case of squaring.
|
||||
@ -3321,7 +3321,7 @@ where multiplication is substantially slower\footnote{On the Athlon there is a 1
|
||||
the Intel P4 processor this ratio is 1:29 making this method even more beneficial. The only common exception is the ARMv4 processor which has a
|
||||
ratio of 1:7. } than simpler operations such as addition.
|
||||
|
||||
EXAM,bn_mp_karatsuba_sqr.c
|
||||
EXAM,bn_s_mp_karatsuba_sqr.c
|
||||
|
||||
This implementation is largely based on the implementation of algorithm mp\_karatsuba\_mul. It uses the same inline style to copy and
|
||||
shift the input into the two halves. The loop from line @54,{@ to line @70,}@ has been modified since only one input exists. The \textbf{used}
|
||||
@ -3998,7 +3998,7 @@ point.
|
||||
Step 5 will propagate the remainder of the carries upwards. On step 6 the columns are reduced modulo $\beta$ and shifted simultaneously as they are
|
||||
stored in the destination $x$.
|
||||
|
||||
EXAM,bn_fast_mp_montgomery_reduce.c
|
||||
EXAM,bn_s_mp_montgomery_reduce_fast.c
|
||||
|
||||
The $\hat W$ array is first filled with digits of $x$ on line @49,for@ then the rest of the digits are zeroed on line @54,for@. Both loops share
|
||||
the same alias variables to make the code easier to read.
|
||||
|
@ -313,23 +313,7 @@
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="bn_fast_mp_invmod.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_fast_mp_montgomery_reduce.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_fast_s_mp_mul_digs.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_fast_s_mp_mul_high_digs.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_fast_s_mp_sqr.c"
|
||||
RelativePath="bn_deprecated.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@ -356,10 +340,6 @@
|
||||
RelativePath="bn_mp_and.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_mp_balance_mul.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_mp_clamp.c"
|
||||
>
|
||||
@ -460,10 +440,6 @@
|
||||
RelativePath="bn_mp_exptmod.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_mp_exptmod_fast.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_mp_exteuclid.c"
|
||||
>
|
||||
@ -544,10 +520,6 @@
|
||||
RelativePath="bn_mp_invmod.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_mp_invmod_slow.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_mp_is_square.c"
|
||||
>
|
||||
@ -564,14 +536,6 @@
|
||||
RelativePath="bn_mp_jacobi.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_mp_karatsuba_mul.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_mp_karatsuba_sqr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_mp_kronecker.c"
|
||||
>
|
||||
@ -828,14 +792,6 @@
|
||||
RelativePath="bn_mp_to_unsigned_bin_n.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_mp_toom_mul.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_mp_toom_sqr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_mp_toradix.c"
|
||||
>
|
||||
@ -861,33 +817,81 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_reverse.c"
|
||||
RelativePath="bn_s_mp_add.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_add.c"
|
||||
RelativePath="bn_s_mp_balance_mul.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_exptmod.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_exptmod_fast.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_invmod_fast.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_invmod_slow.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_karatsuba_mul.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_karatsuba_sqr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_montgomery_reduce_fast.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_mul_digs.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_mul_digs_fast.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_mul_high_digs.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_mul_high_digs_fast.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_reverse.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_sqr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_sqr_fast.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_sub.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_toom_mul.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bn_s_mp_toom_sqr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="bncore.c"
|
||||
>
|
||||
|
29
makefile
29
makefile
@ -26,17 +26,15 @@ endif
|
||||
LCOV_ARGS=--directory .
|
||||
|
||||
#START_INS
|
||||
OBJECTS=bn_fast_mp_invmod.o bn_fast_mp_montgomery_reduce.o bn_fast_s_mp_mul_digs.o \
|
||||
bn_fast_s_mp_mul_high_digs.o bn_fast_s_mp_sqr.o bn_mp_2expt.o bn_mp_abs.o bn_mp_add.o bn_mp_add_d.o \
|
||||
bn_mp_addmod.o bn_mp_and.o bn_mp_balance_mul.o bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o bn_mp_cmp.o \
|
||||
bn_mp_cmp_d.o bn_mp_cmp_mag.o bn_mp_cnt_lsb.o bn_mp_complement.o bn_mp_copy.o bn_mp_count_bits.o \
|
||||
bn_mp_decr.o bn_mp_div.o bn_mp_div_2.o bn_mp_div_2d.o bn_mp_div_3.o bn_mp_div_d.o bn_mp_dr_is_modulus.o \
|
||||
bn_mp_dr_reduce.o bn_mp_dr_setup.o bn_mp_error_to_string.o bn_mp_exch.o bn_mp_export.o bn_mp_expt_d.o \
|
||||
bn_mp_expt_d_ex.o bn_mp_exptmod.o bn_mp_exptmod_fast.o bn_mp_exteuclid.o bn_mp_fread.o bn_mp_fwrite.o \
|
||||
bn_mp_gcd.o bn_mp_get_bit.o bn_mp_get_double.o bn_mp_get_int.o bn_mp_get_long.o bn_mp_get_long_long.o \
|
||||
bn_mp_grow.o bn_mp_ilogb.o bn_mp_import.o bn_mp_incr.o bn_mp_init.o bn_mp_init_copy.o bn_mp_init_multi.o \
|
||||
bn_mp_init_set.o bn_mp_init_set_int.o bn_mp_init_size.o bn_mp_invmod.o bn_mp_invmod_slow.o \
|
||||
bn_mp_is_square.o bn_mp_iseven.o bn_mp_isodd.o bn_mp_jacobi.o bn_mp_karatsuba_mul.o bn_mp_karatsuba_sqr.o \
|
||||
OBJECTS=bn_deprecated.o bn_mp_2expt.o bn_mp_abs.o bn_mp_add.o bn_mp_add_d.o bn_mp_addmod.o bn_mp_and.o \
|
||||
bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o bn_mp_cmp.o bn_mp_cmp_d.o bn_mp_cmp_mag.o bn_mp_cnt_lsb.o \
|
||||
bn_mp_complement.o bn_mp_copy.o bn_mp_count_bits.o bn_mp_decr.o bn_mp_div.o bn_mp_div_2.o bn_mp_div_2d.o \
|
||||
bn_mp_div_3.o bn_mp_div_d.o bn_mp_dr_is_modulus.o bn_mp_dr_reduce.o bn_mp_dr_setup.o \
|
||||
bn_mp_error_to_string.o bn_mp_exch.o bn_mp_export.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_exptmod.o \
|
||||
bn_mp_exteuclid.o bn_mp_fread.o bn_mp_fwrite.o bn_mp_gcd.o bn_mp_get_bit.o bn_mp_get_double.o \
|
||||
bn_mp_get_int.o bn_mp_get_long.o bn_mp_get_long_long.o bn_mp_grow.o bn_mp_ilogb.o bn_mp_import.o \
|
||||
bn_mp_incr.o bn_mp_init.o bn_mp_init_copy.o bn_mp_init_multi.o bn_mp_init_set.o bn_mp_init_set_int.o \
|
||||
bn_mp_init_size.o bn_mp_invmod.o bn_mp_is_square.o bn_mp_iseven.o bn_mp_isodd.o bn_mp_jacobi.o \
|
||||
bn_mp_kronecker.o bn_mp_lcm.o bn_mp_lshd.o bn_mp_mod.o bn_mp_mod_2d.o bn_mp_mod_d.o \
|
||||
bn_mp_montgomery_calc_normalization.o bn_mp_montgomery_reduce.o bn_mp_montgomery_setup.o bn_mp_mul.o \
|
||||
bn_mp_mul_2.o bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_mulmod.o bn_mp_n_root.o bn_mp_n_root_ex.o bn_mp_neg.o \
|
||||
@ -50,9 +48,12 @@ bn_mp_set.o bn_mp_set_double.o bn_mp_set_int.o bn_mp_set_long.o bn_mp_set_long_l
|
||||
bn_mp_signed_bin_size.o bn_mp_sqr.o bn_mp_sqrmod.o bn_mp_sqrt.o bn_mp_sqrtmod_prime.o bn_mp_sub.o \
|
||||
bn_mp_sub_d.o bn_mp_submod.o bn_mp_tc_and.o bn_mp_tc_div_2d.o bn_mp_tc_or.o bn_mp_tc_xor.o \
|
||||
bn_mp_to_signed_bin.o bn_mp_to_signed_bin_n.o bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o \
|
||||
bn_mp_toom_mul.o bn_mp_toom_sqr.o bn_mp_toradix.o bn_mp_toradix_n.o bn_mp_unsigned_bin_size.o bn_mp_xor.o \
|
||||
bn_mp_zero.o bn_prime_tab.o bn_reverse.o bn_s_mp_add.o bn_s_mp_exptmod.o bn_s_mp_mul_digs.o \
|
||||
bn_s_mp_mul_high_digs.o bn_s_mp_sqr.o bn_s_mp_sub.o bncore.o
|
||||
bn_mp_toradix.o bn_mp_toradix_n.o bn_mp_unsigned_bin_size.o bn_mp_xor.o bn_mp_zero.o bn_prime_tab.o \
|
||||
bn_s_mp_add.o bn_s_mp_balance_mul.o bn_s_mp_exptmod.o bn_s_mp_exptmod_fast.o bn_s_mp_invmod_fast.o \
|
||||
bn_s_mp_invmod_slow.o bn_s_mp_karatsuba_mul.o bn_s_mp_karatsuba_sqr.o bn_s_mp_montgomery_reduce_fast.o \
|
||||
bn_s_mp_mul_digs.o bn_s_mp_mul_digs_fast.o bn_s_mp_mul_high_digs.o bn_s_mp_mul_high_digs_fast.o \
|
||||
bn_s_mp_reverse.o bn_s_mp_sqr.o bn_s_mp_sqr_fast.o bn_s_mp_sub.o bn_s_mp_toom_mul.o bn_s_mp_toom_sqr.o \
|
||||
bncore.o
|
||||
|
||||
#END_INS
|
||||
|
||||
|
@ -29,17 +29,15 @@ LIBMAIN_I =libtommath.dll.a
|
||||
LIBMAIN_D =libtommath.dll
|
||||
|
||||
#List of objects to compile (all goes to libtommath.a)
|
||||
OBJECTS=bn_fast_mp_invmod.o bn_fast_mp_montgomery_reduce.o bn_fast_s_mp_mul_digs.o \
|
||||
bn_fast_s_mp_mul_high_digs.o bn_fast_s_mp_sqr.o bn_mp_2expt.o bn_mp_abs.o bn_mp_add.o bn_mp_add_d.o \
|
||||
bn_mp_addmod.o bn_mp_and.o bn_mp_balance_mul.o bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o bn_mp_cmp.o \
|
||||
bn_mp_cmp_d.o bn_mp_cmp_mag.o bn_mp_cnt_lsb.o bn_mp_complement.o bn_mp_copy.o bn_mp_count_bits.o \
|
||||
bn_mp_decr.o bn_mp_div.o bn_mp_div_2.o bn_mp_div_2d.o bn_mp_div_3.o bn_mp_div_d.o bn_mp_dr_is_modulus.o \
|
||||
bn_mp_dr_reduce.o bn_mp_dr_setup.o bn_mp_error_to_string.o bn_mp_exch.o bn_mp_export.o bn_mp_expt_d.o \
|
||||
bn_mp_expt_d_ex.o bn_mp_exptmod.o bn_mp_exptmod_fast.o bn_mp_exteuclid.o bn_mp_fread.o bn_mp_fwrite.o \
|
||||
bn_mp_gcd.o bn_mp_get_bit.o bn_mp_get_double.o bn_mp_get_int.o bn_mp_get_long.o bn_mp_get_long_long.o \
|
||||
bn_mp_grow.o bn_mp_ilogb.o bn_mp_import.o bn_mp_incr.o bn_mp_init.o bn_mp_init_copy.o bn_mp_init_multi.o \
|
||||
bn_mp_init_set.o bn_mp_init_set_int.o bn_mp_init_size.o bn_mp_invmod.o bn_mp_invmod_slow.o \
|
||||
bn_mp_is_square.o bn_mp_iseven.o bn_mp_isodd.o bn_mp_jacobi.o bn_mp_karatsuba_mul.o bn_mp_karatsuba_sqr.o \
|
||||
OBJECTS=bn_deprecated.o bn_mp_2expt.o bn_mp_abs.o bn_mp_add.o bn_mp_add_d.o bn_mp_addmod.o bn_mp_and.o \
|
||||
bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o bn_mp_cmp.o bn_mp_cmp_d.o bn_mp_cmp_mag.o bn_mp_cnt_lsb.o \
|
||||
bn_mp_complement.o bn_mp_copy.o bn_mp_count_bits.o bn_mp_decr.o bn_mp_div.o bn_mp_div_2.o bn_mp_div_2d.o \
|
||||
bn_mp_div_3.o bn_mp_div_d.o bn_mp_dr_is_modulus.o bn_mp_dr_reduce.o bn_mp_dr_setup.o \
|
||||
bn_mp_error_to_string.o bn_mp_exch.o bn_mp_export.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_exptmod.o \
|
||||
bn_mp_exteuclid.o bn_mp_fread.o bn_mp_fwrite.o bn_mp_gcd.o bn_mp_get_bit.o bn_mp_get_double.o \
|
||||
bn_mp_get_int.o bn_mp_get_long.o bn_mp_get_long_long.o bn_mp_grow.o bn_mp_ilogb.o bn_mp_import.o \
|
||||
bn_mp_incr.o bn_mp_init.o bn_mp_init_copy.o bn_mp_init_multi.o bn_mp_init_set.o bn_mp_init_set_int.o \
|
||||
bn_mp_init_size.o bn_mp_invmod.o bn_mp_is_square.o bn_mp_iseven.o bn_mp_isodd.o bn_mp_jacobi.o \
|
||||
bn_mp_kronecker.o bn_mp_lcm.o bn_mp_lshd.o bn_mp_mod.o bn_mp_mod_2d.o bn_mp_mod_d.o \
|
||||
bn_mp_montgomery_calc_normalization.o bn_mp_montgomery_reduce.o bn_mp_montgomery_setup.o bn_mp_mul.o \
|
||||
bn_mp_mul_2.o bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_mulmod.o bn_mp_n_root.o bn_mp_n_root_ex.o bn_mp_neg.o \
|
||||
@ -53,9 +51,12 @@ bn_mp_set.o bn_mp_set_double.o bn_mp_set_int.o bn_mp_set_long.o bn_mp_set_long_l
|
||||
bn_mp_signed_bin_size.o bn_mp_sqr.o bn_mp_sqrmod.o bn_mp_sqrt.o bn_mp_sqrtmod_prime.o bn_mp_sub.o \
|
||||
bn_mp_sub_d.o bn_mp_submod.o bn_mp_tc_and.o bn_mp_tc_div_2d.o bn_mp_tc_or.o bn_mp_tc_xor.o \
|
||||
bn_mp_to_signed_bin.o bn_mp_to_signed_bin_n.o bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o \
|
||||
bn_mp_toom_mul.o bn_mp_toom_sqr.o bn_mp_toradix.o bn_mp_toradix_n.o bn_mp_unsigned_bin_size.o bn_mp_xor.o \
|
||||
bn_mp_zero.o bn_prime_tab.o bn_reverse.o bn_s_mp_add.o bn_s_mp_exptmod.o bn_s_mp_mul_digs.o \
|
||||
bn_s_mp_mul_high_digs.o bn_s_mp_sqr.o bn_s_mp_sub.o bncore.o
|
||||
bn_mp_toradix.o bn_mp_toradix_n.o bn_mp_unsigned_bin_size.o bn_mp_xor.o bn_mp_zero.o bn_prime_tab.o \
|
||||
bn_s_mp_add.o bn_s_mp_balance_mul.o bn_s_mp_exptmod.o bn_s_mp_exptmod_fast.o bn_s_mp_invmod_fast.o \
|
||||
bn_s_mp_invmod_slow.o bn_s_mp_karatsuba_mul.o bn_s_mp_karatsuba_sqr.o bn_s_mp_montgomery_reduce_fast.o \
|
||||
bn_s_mp_mul_digs.o bn_s_mp_mul_digs_fast.o bn_s_mp_mul_high_digs.o bn_s_mp_mul_high_digs_fast.o \
|
||||
bn_s_mp_reverse.o bn_s_mp_sqr.o bn_s_mp_sqr_fast.o bn_s_mp_sub.o bn_s_mp_toom_mul.o bn_s_mp_toom_sqr.o \
|
||||
bncore.o
|
||||
|
||||
HEADERS_PUB=tommath.h tommath_class.h tommath_superclass.h
|
||||
|
||||
|
@ -21,17 +21,15 @@ LTM_LDFLAGS = advapi32.lib
|
||||
LIBMAIN_S =tommath.lib
|
||||
|
||||
#List of objects to compile (all goes to tommath.lib)
|
||||
OBJECTS=bn_fast_mp_invmod.obj bn_fast_mp_montgomery_reduce.obj bn_fast_s_mp_mul_digs.obj \
|
||||
bn_fast_s_mp_mul_high_digs.obj bn_fast_s_mp_sqr.obj bn_mp_2expt.obj bn_mp_abs.obj bn_mp_add.obj bn_mp_add_d.obj \
|
||||
bn_mp_addmod.obj bn_mp_and.obj bn_mp_balance_mul.obj bn_mp_clamp.obj bn_mp_clear.obj bn_mp_clear_multi.obj bn_mp_cmp.obj \
|
||||
bn_mp_cmp_d.obj bn_mp_cmp_mag.obj bn_mp_cnt_lsb.obj bn_mp_complement.obj bn_mp_copy.obj bn_mp_count_bits.obj \
|
||||
bn_mp_decr.obj bn_mp_div.obj bn_mp_div_2.obj bn_mp_div_2d.obj bn_mp_div_3.obj bn_mp_div_d.obj bn_mp_dr_is_modulus.obj \
|
||||
bn_mp_dr_reduce.obj bn_mp_dr_setup.obj bn_mp_error_to_string.obj bn_mp_exch.obj bn_mp_export.obj bn_mp_expt_d.obj \
|
||||
bn_mp_expt_d_ex.obj bn_mp_exptmod.obj bn_mp_exptmod_fast.obj bn_mp_exteuclid.obj bn_mp_fread.obj bn_mp_fwrite.obj \
|
||||
bn_mp_gcd.obj bn_mp_get_bit.obj bn_mp_get_double.obj bn_mp_get_int.obj bn_mp_get_long.obj bn_mp_get_long_long.obj \
|
||||
bn_mp_grow.obj bn_mp_ilogb.obj bn_mp_import.obj bn_mp_incr.obj bn_mp_init.obj bn_mp_init_copy.obj bn_mp_init_multi.obj \
|
||||
bn_mp_init_set.obj bn_mp_init_set_int.obj bn_mp_init_size.obj bn_mp_invmod.obj bn_mp_invmod_slow.obj \
|
||||
bn_mp_is_square.obj bn_mp_iseven.obj bn_mp_isodd.obj bn_mp_jacobi.obj bn_mp_karatsuba_mul.obj bn_mp_karatsuba_sqr.obj \
|
||||
OBJECTS=bn_deprecated.obj bn_mp_2expt.obj bn_mp_abs.obj bn_mp_add.obj bn_mp_add_d.obj bn_mp_addmod.obj bn_mp_and.obj \
|
||||
bn_mp_clamp.obj bn_mp_clear.obj bn_mp_clear_multi.obj bn_mp_cmp.obj bn_mp_cmp_d.obj bn_mp_cmp_mag.obj bn_mp_cnt_lsb.obj \
|
||||
bn_mp_complement.obj bn_mp_copy.obj bn_mp_count_bits.obj bn_mp_decr.obj bn_mp_div.obj bn_mp_div_2.obj bn_mp_div_2d.obj \
|
||||
bn_mp_div_3.obj bn_mp_div_d.obj bn_mp_dr_is_modulus.obj bn_mp_dr_reduce.obj bn_mp_dr_setup.obj \
|
||||
bn_mp_error_to_string.obj bn_mp_exch.obj bn_mp_export.obj bn_mp_expt_d.obj bn_mp_expt_d_ex.obj bn_mp_exptmod.obj \
|
||||
bn_mp_exteuclid.obj bn_mp_fread.obj bn_mp_fwrite.obj bn_mp_gcd.obj bn_mp_get_bit.obj bn_mp_get_double.obj \
|
||||
bn_mp_get_int.obj bn_mp_get_long.obj bn_mp_get_long_long.obj bn_mp_grow.obj bn_mp_ilogb.obj bn_mp_import.obj \
|
||||
bn_mp_incr.obj bn_mp_init.obj bn_mp_init_copy.obj bn_mp_init_multi.obj bn_mp_init_set.obj bn_mp_init_set_int.obj \
|
||||
bn_mp_init_size.obj bn_mp_invmod.obj bn_mp_is_square.obj bn_mp_iseven.obj bn_mp_isodd.obj bn_mp_jacobi.obj \
|
||||
bn_mp_kronecker.obj bn_mp_lcm.obj bn_mp_lshd.obj bn_mp_mod.obj bn_mp_mod_2d.obj bn_mp_mod_d.obj \
|
||||
bn_mp_montgomery_calc_normalization.obj bn_mp_montgomery_reduce.obj bn_mp_montgomery_setup.obj bn_mp_mul.obj \
|
||||
bn_mp_mul_2.obj bn_mp_mul_2d.obj bn_mp_mul_d.obj bn_mp_mulmod.obj bn_mp_n_root.obj bn_mp_n_root_ex.obj bn_mp_neg.obj \
|
||||
@ -45,9 +43,12 @@ bn_mp_set.obj bn_mp_set_double.obj bn_mp_set_int.obj bn_mp_set_long.obj bn_mp_se
|
||||
bn_mp_signed_bin_size.obj bn_mp_sqr.obj bn_mp_sqrmod.obj bn_mp_sqrt.obj bn_mp_sqrtmod_prime.obj bn_mp_sub.obj \
|
||||
bn_mp_sub_d.obj bn_mp_submod.obj bn_mp_tc_and.obj bn_mp_tc_div_2d.obj bn_mp_tc_or.obj bn_mp_tc_xor.obj \
|
||||
bn_mp_to_signed_bin.obj bn_mp_to_signed_bin_n.obj bn_mp_to_unsigned_bin.obj bn_mp_to_unsigned_bin_n.obj \
|
||||
bn_mp_toom_mul.obj bn_mp_toom_sqr.obj bn_mp_toradix.obj bn_mp_toradix_n.obj bn_mp_unsigned_bin_size.obj bn_mp_xor.obj \
|
||||
bn_mp_zero.obj bn_prime_tab.obj bn_reverse.obj bn_s_mp_add.obj bn_s_mp_exptmod.obj bn_s_mp_mul_digs.obj \
|
||||
bn_s_mp_mul_high_digs.obj bn_s_mp_sqr.obj bn_s_mp_sub.obj bncore.obj
|
||||
bn_mp_toradix.obj bn_mp_toradix_n.obj bn_mp_unsigned_bin_size.obj bn_mp_xor.obj bn_mp_zero.obj bn_prime_tab.obj \
|
||||
bn_s_mp_add.obj bn_s_mp_balance_mul.obj bn_s_mp_exptmod.obj bn_s_mp_exptmod_fast.obj bn_s_mp_invmod_fast.obj \
|
||||
bn_s_mp_invmod_slow.obj bn_s_mp_karatsuba_mul.obj bn_s_mp_karatsuba_sqr.obj bn_s_mp_montgomery_reduce_fast.obj \
|
||||
bn_s_mp_mul_digs.obj bn_s_mp_mul_digs_fast.obj bn_s_mp_mul_high_digs.obj bn_s_mp_mul_high_digs_fast.obj \
|
||||
bn_s_mp_reverse.obj bn_s_mp_sqr.obj bn_s_mp_sqr_fast.obj bn_s_mp_sub.obj bn_s_mp_toom_mul.obj bn_s_mp_toom_sqr.obj \
|
||||
bncore.obj
|
||||
|
||||
HEADERS_PUB=tommath.h tommath_class.h tommath_superclass.h
|
||||
|
||||
|
@ -23,17 +23,15 @@ LTLINK = $(LIBTOOL) --mode=link --tag=CC $(CC)
|
||||
LCOV_ARGS=--directory .libs --directory .
|
||||
|
||||
#START_INS
|
||||
OBJECTS=bn_fast_mp_invmod.o bn_fast_mp_montgomery_reduce.o bn_fast_s_mp_mul_digs.o \
|
||||
bn_fast_s_mp_mul_high_digs.o bn_fast_s_mp_sqr.o bn_mp_2expt.o bn_mp_abs.o bn_mp_add.o bn_mp_add_d.o \
|
||||
bn_mp_addmod.o bn_mp_and.o bn_mp_balance_mul.o bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o bn_mp_cmp.o \
|
||||
bn_mp_cmp_d.o bn_mp_cmp_mag.o bn_mp_cnt_lsb.o bn_mp_complement.o bn_mp_copy.o bn_mp_count_bits.o \
|
||||
bn_mp_decr.o bn_mp_div.o bn_mp_div_2.o bn_mp_div_2d.o bn_mp_div_3.o bn_mp_div_d.o bn_mp_dr_is_modulus.o \
|
||||
bn_mp_dr_reduce.o bn_mp_dr_setup.o bn_mp_error_to_string.o bn_mp_exch.o bn_mp_export.o bn_mp_expt_d.o \
|
||||
bn_mp_expt_d_ex.o bn_mp_exptmod.o bn_mp_exptmod_fast.o bn_mp_exteuclid.o bn_mp_fread.o bn_mp_fwrite.o \
|
||||
bn_mp_gcd.o bn_mp_get_bit.o bn_mp_get_double.o bn_mp_get_int.o bn_mp_get_long.o bn_mp_get_long_long.o \
|
||||
bn_mp_grow.o bn_mp_ilogb.o bn_mp_import.o bn_mp_incr.o bn_mp_init.o bn_mp_init_copy.o bn_mp_init_multi.o \
|
||||
bn_mp_init_set.o bn_mp_init_set_int.o bn_mp_init_size.o bn_mp_invmod.o bn_mp_invmod_slow.o \
|
||||
bn_mp_is_square.o bn_mp_iseven.o bn_mp_isodd.o bn_mp_jacobi.o bn_mp_karatsuba_mul.o bn_mp_karatsuba_sqr.o \
|
||||
OBJECTS=bn_deprecated.o bn_mp_2expt.o bn_mp_abs.o bn_mp_add.o bn_mp_add_d.o bn_mp_addmod.o bn_mp_and.o \
|
||||
bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o bn_mp_cmp.o bn_mp_cmp_d.o bn_mp_cmp_mag.o bn_mp_cnt_lsb.o \
|
||||
bn_mp_complement.o bn_mp_copy.o bn_mp_count_bits.o bn_mp_decr.o bn_mp_div.o bn_mp_div_2.o bn_mp_div_2d.o \
|
||||
bn_mp_div_3.o bn_mp_div_d.o bn_mp_dr_is_modulus.o bn_mp_dr_reduce.o bn_mp_dr_setup.o \
|
||||
bn_mp_error_to_string.o bn_mp_exch.o bn_mp_export.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_exptmod.o \
|
||||
bn_mp_exteuclid.o bn_mp_fread.o bn_mp_fwrite.o bn_mp_gcd.o bn_mp_get_bit.o bn_mp_get_double.o \
|
||||
bn_mp_get_int.o bn_mp_get_long.o bn_mp_get_long_long.o bn_mp_grow.o bn_mp_ilogb.o bn_mp_import.o \
|
||||
bn_mp_incr.o bn_mp_init.o bn_mp_init_copy.o bn_mp_init_multi.o bn_mp_init_set.o bn_mp_init_set_int.o \
|
||||
bn_mp_init_size.o bn_mp_invmod.o bn_mp_is_square.o bn_mp_iseven.o bn_mp_isodd.o bn_mp_jacobi.o \
|
||||
bn_mp_kronecker.o bn_mp_lcm.o bn_mp_lshd.o bn_mp_mod.o bn_mp_mod_2d.o bn_mp_mod_d.o \
|
||||
bn_mp_montgomery_calc_normalization.o bn_mp_montgomery_reduce.o bn_mp_montgomery_setup.o bn_mp_mul.o \
|
||||
bn_mp_mul_2.o bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_mulmod.o bn_mp_n_root.o bn_mp_n_root_ex.o bn_mp_neg.o \
|
||||
@ -47,9 +45,12 @@ bn_mp_set.o bn_mp_set_double.o bn_mp_set_int.o bn_mp_set_long.o bn_mp_set_long_l
|
||||
bn_mp_signed_bin_size.o bn_mp_sqr.o bn_mp_sqrmod.o bn_mp_sqrt.o bn_mp_sqrtmod_prime.o bn_mp_sub.o \
|
||||
bn_mp_sub_d.o bn_mp_submod.o bn_mp_tc_and.o bn_mp_tc_div_2d.o bn_mp_tc_or.o bn_mp_tc_xor.o \
|
||||
bn_mp_to_signed_bin.o bn_mp_to_signed_bin_n.o bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o \
|
||||
bn_mp_toom_mul.o bn_mp_toom_sqr.o bn_mp_toradix.o bn_mp_toradix_n.o bn_mp_unsigned_bin_size.o bn_mp_xor.o \
|
||||
bn_mp_zero.o bn_prime_tab.o bn_reverse.o bn_s_mp_add.o bn_s_mp_exptmod.o bn_s_mp_mul_digs.o \
|
||||
bn_s_mp_mul_high_digs.o bn_s_mp_sqr.o bn_s_mp_sub.o bncore.o
|
||||
bn_mp_toradix.o bn_mp_toradix_n.o bn_mp_unsigned_bin_size.o bn_mp_xor.o bn_mp_zero.o bn_prime_tab.o \
|
||||
bn_s_mp_add.o bn_s_mp_balance_mul.o bn_s_mp_exptmod.o bn_s_mp_exptmod_fast.o bn_s_mp_invmod_fast.o \
|
||||
bn_s_mp_invmod_slow.o bn_s_mp_karatsuba_mul.o bn_s_mp_karatsuba_sqr.o bn_s_mp_montgomery_reduce_fast.o \
|
||||
bn_s_mp_mul_digs.o bn_s_mp_mul_digs_fast.o bn_s_mp_mul_high_digs.o bn_s_mp_mul_high_digs_fast.o \
|
||||
bn_s_mp_reverse.o bn_s_mp_sqr.o bn_s_mp_sqr_fast.o bn_s_mp_sub.o bn_s_mp_toom_mul.o bn_s_mp_toom_sqr.o \
|
||||
bncore.o
|
||||
|
||||
#END_INS
|
||||
|
||||
|
@ -30,17 +30,15 @@ LTM_LDFLAGS = $(LDFLAGS)
|
||||
#Library to be created (this makefile builds only static library)
|
||||
LIBMAIN_S = libtommath.a
|
||||
|
||||
OBJECTS=bn_fast_mp_invmod.o bn_fast_mp_montgomery_reduce.o bn_fast_s_mp_mul_digs.o \
|
||||
bn_fast_s_mp_mul_high_digs.o bn_fast_s_mp_sqr.o bn_mp_2expt.o bn_mp_abs.o bn_mp_add.o bn_mp_add_d.o \
|
||||
bn_mp_addmod.o bn_mp_and.o bn_mp_balance_mul.o bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o bn_mp_cmp.o \
|
||||
bn_mp_cmp_d.o bn_mp_cmp_mag.o bn_mp_cnt_lsb.o bn_mp_complement.o bn_mp_copy.o bn_mp_count_bits.o \
|
||||
bn_mp_decr.o bn_mp_div.o bn_mp_div_2.o bn_mp_div_2d.o bn_mp_div_3.o bn_mp_div_d.o bn_mp_dr_is_modulus.o \
|
||||
bn_mp_dr_reduce.o bn_mp_dr_setup.o bn_mp_error_to_string.o bn_mp_exch.o bn_mp_export.o bn_mp_expt_d.o \
|
||||
bn_mp_expt_d_ex.o bn_mp_exptmod.o bn_mp_exptmod_fast.o bn_mp_exteuclid.o bn_mp_fread.o bn_mp_fwrite.o \
|
||||
bn_mp_gcd.o bn_mp_get_bit.o bn_mp_get_double.o bn_mp_get_int.o bn_mp_get_long.o bn_mp_get_long_long.o \
|
||||
bn_mp_grow.o bn_mp_ilogb.o bn_mp_import.o bn_mp_incr.o bn_mp_init.o bn_mp_init_copy.o bn_mp_init_multi.o \
|
||||
bn_mp_init_set.o bn_mp_init_set_int.o bn_mp_init_size.o bn_mp_invmod.o bn_mp_invmod_slow.o \
|
||||
bn_mp_is_square.o bn_mp_iseven.o bn_mp_isodd.o bn_mp_jacobi.o bn_mp_karatsuba_mul.o bn_mp_karatsuba_sqr.o \
|
||||
OBJECTS=bn_deprecated.o bn_mp_2expt.o bn_mp_abs.o bn_mp_add.o bn_mp_add_d.o bn_mp_addmod.o bn_mp_and.o \
|
||||
bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o bn_mp_cmp.o bn_mp_cmp_d.o bn_mp_cmp_mag.o bn_mp_cnt_lsb.o \
|
||||
bn_mp_complement.o bn_mp_copy.o bn_mp_count_bits.o bn_mp_decr.o bn_mp_div.o bn_mp_div_2.o bn_mp_div_2d.o \
|
||||
bn_mp_div_3.o bn_mp_div_d.o bn_mp_dr_is_modulus.o bn_mp_dr_reduce.o bn_mp_dr_setup.o \
|
||||
bn_mp_error_to_string.o bn_mp_exch.o bn_mp_export.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_exptmod.o \
|
||||
bn_mp_exteuclid.o bn_mp_fread.o bn_mp_fwrite.o bn_mp_gcd.o bn_mp_get_bit.o bn_mp_get_double.o \
|
||||
bn_mp_get_int.o bn_mp_get_long.o bn_mp_get_long_long.o bn_mp_grow.o bn_mp_ilogb.o bn_mp_import.o \
|
||||
bn_mp_incr.o bn_mp_init.o bn_mp_init_copy.o bn_mp_init_multi.o bn_mp_init_set.o bn_mp_init_set_int.o \
|
||||
bn_mp_init_size.o bn_mp_invmod.o bn_mp_is_square.o bn_mp_iseven.o bn_mp_isodd.o bn_mp_jacobi.o \
|
||||
bn_mp_kronecker.o bn_mp_lcm.o bn_mp_lshd.o bn_mp_mod.o bn_mp_mod_2d.o bn_mp_mod_d.o \
|
||||
bn_mp_montgomery_calc_normalization.o bn_mp_montgomery_reduce.o bn_mp_montgomery_setup.o bn_mp_mul.o \
|
||||
bn_mp_mul_2.o bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_mulmod.o bn_mp_n_root.o bn_mp_n_root_ex.o bn_mp_neg.o \
|
||||
@ -54,9 +52,12 @@ bn_mp_set.o bn_mp_set_double.o bn_mp_set_int.o bn_mp_set_long.o bn_mp_set_long_l
|
||||
bn_mp_signed_bin_size.o bn_mp_sqr.o bn_mp_sqrmod.o bn_mp_sqrt.o bn_mp_sqrtmod_prime.o bn_mp_sub.o \
|
||||
bn_mp_sub_d.o bn_mp_submod.o bn_mp_tc_and.o bn_mp_tc_div_2d.o bn_mp_tc_or.o bn_mp_tc_xor.o \
|
||||
bn_mp_to_signed_bin.o bn_mp_to_signed_bin_n.o bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o \
|
||||
bn_mp_toom_mul.o bn_mp_toom_sqr.o bn_mp_toradix.o bn_mp_toradix_n.o bn_mp_unsigned_bin_size.o bn_mp_xor.o \
|
||||
bn_mp_zero.o bn_prime_tab.o bn_reverse.o bn_s_mp_add.o bn_s_mp_exptmod.o bn_s_mp_mul_digs.o \
|
||||
bn_s_mp_mul_high_digs.o bn_s_mp_sqr.o bn_s_mp_sub.o bncore.o
|
||||
bn_mp_toradix.o bn_mp_toradix_n.o bn_mp_unsigned_bin_size.o bn_mp_xor.o bn_mp_zero.o bn_prime_tab.o \
|
||||
bn_s_mp_add.o bn_s_mp_balance_mul.o bn_s_mp_exptmod.o bn_s_mp_exptmod_fast.o bn_s_mp_invmod_fast.o \
|
||||
bn_s_mp_invmod_slow.o bn_s_mp_karatsuba_mul.o bn_s_mp_karatsuba_sqr.o bn_s_mp_montgomery_reduce_fast.o \
|
||||
bn_s_mp_mul_digs.o bn_s_mp_mul_digs_fast.o bn_s_mp_mul_high_digs.o bn_s_mp_mul_high_digs_fast.o \
|
||||
bn_s_mp_reverse.o bn_s_mp_sqr.o bn_s_mp_sqr_fast.o bn_s_mp_sub.o bn_s_mp_toom_mul.o bn_s_mp_toom_sqr.o \
|
||||
bncore.o
|
||||
|
||||
HEADERS_PUB=tommath.h tommath_class.h tommath_superclass.h
|
||||
|
||||
|
370
tommath_class.h
370
tommath_class.h
@ -10,18 +10,13 @@
|
||||
#endif
|
||||
#define LTM1
|
||||
#if defined(LTM_ALL)
|
||||
# define BN_FAST_MP_INVMOD_C
|
||||
# define BN_FAST_MP_MONTGOMERY_REDUCE_C
|
||||
# define BN_FAST_S_MP_MUL_DIGS_C
|
||||
# define BN_FAST_S_MP_MUL_HIGH_DIGS_C
|
||||
# define BN_FAST_S_MP_SQR_C
|
||||
# define BN_DEPRECATED_C
|
||||
# define BN_MP_2EXPT_C
|
||||
# define BN_MP_ABS_C
|
||||
# define BN_MP_ADD_C
|
||||
# define BN_MP_ADD_D_C
|
||||
# define BN_MP_ADDMOD_C
|
||||
# define BN_MP_AND_C
|
||||
# define BN_MP_BALANCE_MUL_C
|
||||
# define BN_MP_CLAMP_C
|
||||
# define BN_MP_CLEAR_C
|
||||
# define BN_MP_CLEAR_MULTI_C
|
||||
@ -47,7 +42,6 @@
|
||||
# define BN_MP_EXPT_D_C
|
||||
# define BN_MP_EXPT_D_EX_C
|
||||
# define BN_MP_EXPTMOD_C
|
||||
# define BN_MP_EXPTMOD_FAST_C
|
||||
# define BN_MP_EXTEUCLID_C
|
||||
# define BN_MP_FREAD_C
|
||||
# define BN_MP_FWRITE_C
|
||||
@ -68,13 +62,10 @@
|
||||
# define BN_MP_INIT_SET_INT_C
|
||||
# define BN_MP_INIT_SIZE_C
|
||||
# define BN_MP_INVMOD_C
|
||||
# define BN_MP_INVMOD_SLOW_C
|
||||
# define BN_MP_IS_SQUARE_C
|
||||
# define BN_MP_ISEVEN_C
|
||||
# define BN_MP_ISODD_C
|
||||
# define BN_MP_JACOBI_C
|
||||
# define BN_MP_KARATSUBA_MUL_C
|
||||
# define BN_MP_KARATSUBA_SQR_C
|
||||
# define BN_MP_KRONECKER_C
|
||||
# define BN_MP_LCM_C
|
||||
# define BN_MP_LSHD_C
|
||||
@ -139,59 +130,59 @@
|
||||
# define BN_MP_TO_SIGNED_BIN_N_C
|
||||
# define BN_MP_TO_UNSIGNED_BIN_C
|
||||
# define BN_MP_TO_UNSIGNED_BIN_N_C
|
||||
# define BN_MP_TOOM_MUL_C
|
||||
# define BN_MP_TOOM_SQR_C
|
||||
# define BN_MP_TORADIX_C
|
||||
# define BN_MP_TORADIX_N_C
|
||||
# define BN_MP_UNSIGNED_BIN_SIZE_C
|
||||
# define BN_MP_XOR_C
|
||||
# define BN_MP_ZERO_C
|
||||
# define BN_PRIME_TAB_C
|
||||
# define BN_REVERSE_C
|
||||
# define BN_S_MP_ADD_C
|
||||
# define BN_S_MP_BALANCE_MUL_C
|
||||
# define BN_S_MP_EXPTMOD_C
|
||||
# define BN_S_MP_EXPTMOD_FAST_C
|
||||
# define BN_S_MP_INVMOD_FAST_C
|
||||
# define BN_S_MP_INVMOD_SLOW_C
|
||||
# define BN_S_MP_KARATSUBA_MUL_C
|
||||
# define BN_S_MP_KARATSUBA_SQR_C
|
||||
# define BN_S_MP_MONTGOMERY_REDUCE_FAST_C
|
||||
# define BN_S_MP_MUL_DIGS_C
|
||||
# define BN_S_MP_MUL_DIGS_FAST_C
|
||||
# define BN_S_MP_MUL_HIGH_DIGS_C
|
||||
# define BN_S_MP_MUL_HIGH_DIGS_FAST_C
|
||||
# define BN_S_MP_REVERSE_C
|
||||
# define BN_S_MP_SQR_C
|
||||
# define BN_S_MP_SQR_FAST_C
|
||||
# define BN_S_MP_SUB_C
|
||||
# define BN_S_MP_TOOM_MUL_C
|
||||
# define BN_S_MP_TOOM_SQR_C
|
||||
# define BNCORE_C
|
||||
#endif
|
||||
#if defined(BN_FAST_MP_INVMOD_C)
|
||||
# define BN_MP_INIT_MULTI_C
|
||||
# define BN_MP_COPY_C
|
||||
# define BN_MP_MOD_C
|
||||
# define BN_MP_SET_C
|
||||
# define BN_MP_DIV_2_C
|
||||
# define BN_MP_SUB_C
|
||||
# define BN_MP_CMP_C
|
||||
# define BN_MP_CMP_D_C
|
||||
# define BN_MP_ADD_C
|
||||
# define BN_MP_CMP_MAG_C
|
||||
# define BN_MP_EXCH_C
|
||||
# define BN_MP_CLEAR_MULTI_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_FAST_MP_MONTGOMERY_REDUCE_C)
|
||||
# define BN_MP_GROW_C
|
||||
# define BN_MP_RSHD_C
|
||||
# define BN_MP_CLAMP_C
|
||||
# define BN_MP_CMP_MAG_C
|
||||
# define BN_S_MP_SUB_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_FAST_S_MP_MUL_DIGS_C)
|
||||
# define BN_MP_GROW_C
|
||||
# define BN_MP_CLAMP_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C)
|
||||
# define BN_MP_GROW_C
|
||||
# define BN_MP_CLAMP_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_FAST_S_MP_SQR_C)
|
||||
# define BN_MP_GROW_C
|
||||
# define BN_MP_CLAMP_C
|
||||
#if defined(BN_DEPRECATED_C)
|
||||
# define BN_FAST_MP_INVMOD_C
|
||||
# define BN_S_MP_INVMOD_FAST_C
|
||||
# define BN_FAST_MP_MONTGOMERY_REDUCE_C
|
||||
# define BN_S_MP_MONTGOMERY_REDUCE_FAST_C
|
||||
# define BN_FAST_S_MP_MUL_DIGS_C
|
||||
# define BN_S_MP_MUL_DIGS_FAST_C
|
||||
# define BN_FAST_S_MP_MUL_HIGH_DIGS_C
|
||||
# define BN_S_MP_MUL_HIGH_DIGS_FAST_C
|
||||
# define BN_FAST_S_MP_SQR_C
|
||||
# define BN_S_MP_SQR_FAST_C
|
||||
# define BN_MP_BALANCE_MUL_C
|
||||
# define BN_S_MP_BALANCE_MUL_C
|
||||
# define BN_MP_EXPTMOD_FAST_C
|
||||
# define BN_S_MP_EXPTMOD_FAST_C
|
||||
# define BN_MP_INVMOD_SLOW_C
|
||||
# define BN_S_MP_INVMOD_SLOW_C
|
||||
# define BN_MP_KARATSUBA_MUL_C
|
||||
# define BN_S_MP_KARATSUBA_MUL_C
|
||||
# define BN_MP_KARATSUBA_SQR_C
|
||||
# define BN_S_MP_KARATSUBA_SQR_C
|
||||
# define BN_MP_TOOM_MUL_C
|
||||
# define BN_S_MP_TOOM_MUL_C
|
||||
# define BN_MP_TOOM_SQR_C
|
||||
# define BN_S_MP_TOOM_SQR_C
|
||||
# define BN_S_MP_REVERSE_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_2EXPT_C)
|
||||
@ -229,17 +220,6 @@
|
||||
# define BN_MP_CLEAR_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_BALANCE_MUL_C)
|
||||
# define BN_MP_INIT_SIZE_C
|
||||
# define BN_MP_INIT_MULTI_C
|
||||
# define BN_MP_CLEAR_C
|
||||
# define BN_MP_MUL_C
|
||||
# define BN_MP_LSHD_C
|
||||
# define BN_MP_ADD_C
|
||||
# define BN_MP_EXCH_C
|
||||
# define BN_MP_CLEAR_MULTI_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_CLAMP_C)
|
||||
#endif
|
||||
|
||||
@ -385,28 +365,7 @@
|
||||
# define BN_S_MP_EXPTMOD_C
|
||||
# define BN_MP_DR_IS_MODULUS_C
|
||||
# define BN_MP_REDUCE_IS_2K_C
|
||||
# define BN_MP_EXPTMOD_FAST_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_EXPTMOD_FAST_C)
|
||||
# define BN_MP_COUNT_BITS_C
|
||||
# define BN_MP_INIT_SIZE_C
|
||||
# define BN_MP_CLEAR_C
|
||||
# define BN_MP_MONTGOMERY_SETUP_C
|
||||
# define BN_FAST_MP_MONTGOMERY_REDUCE_C
|
||||
# define BN_MP_MONTGOMERY_REDUCE_C
|
||||
# define BN_MP_DR_SETUP_C
|
||||
# define BN_MP_DR_REDUCE_C
|
||||
# define BN_MP_REDUCE_2K_SETUP_C
|
||||
# define BN_MP_REDUCE_2K_C
|
||||
# define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C
|
||||
# define BN_MP_MULMOD_C
|
||||
# define BN_MP_SET_C
|
||||
# define BN_MP_MOD_C
|
||||
# define BN_MP_COPY_C
|
||||
# define BN_MP_SQR_C
|
||||
# define BN_MP_MUL_C
|
||||
# define BN_MP_EXCH_C
|
||||
# define BN_S_MP_EXPTMOD_FAST_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_EXTEUCLID_C)
|
||||
@ -527,23 +486,8 @@
|
||||
|
||||
#if defined(BN_MP_INVMOD_C)
|
||||
# define BN_MP_CMP_D_C
|
||||
# define BN_FAST_MP_INVMOD_C
|
||||
# define BN_MP_INVMOD_SLOW_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_INVMOD_SLOW_C)
|
||||
# define BN_MP_INIT_MULTI_C
|
||||
# define BN_MP_MOD_C
|
||||
# define BN_MP_COPY_C
|
||||
# define BN_MP_SET_C
|
||||
# define BN_MP_DIV_2_C
|
||||
# define BN_MP_ADD_C
|
||||
# define BN_MP_SUB_C
|
||||
# define BN_MP_CMP_C
|
||||
# define BN_MP_CMP_D_C
|
||||
# define BN_MP_CMP_MAG_C
|
||||
# define BN_MP_EXCH_C
|
||||
# define BN_MP_CLEAR_MULTI_C
|
||||
# define BN_S_MP_INVMOD_FAST_C
|
||||
# define BN_S_MP_INVMOD_SLOW_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_IS_SQUARE_C)
|
||||
@ -568,28 +512,6 @@
|
||||
# define BN_MP_CMP_D_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_KARATSUBA_MUL_C)
|
||||
# define BN_MP_MUL_C
|
||||
# define BN_MP_INIT_SIZE_C
|
||||
# define BN_MP_CLAMP_C
|
||||
# define BN_S_MP_ADD_C
|
||||
# define BN_MP_ADD_C
|
||||
# define BN_S_MP_SUB_C
|
||||
# define BN_MP_LSHD_C
|
||||
# define BN_MP_CLEAR_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_KARATSUBA_SQR_C)
|
||||
# define BN_MP_INIT_SIZE_C
|
||||
# define BN_MP_CLAMP_C
|
||||
# define BN_MP_SQR_C
|
||||
# define BN_S_MP_ADD_C
|
||||
# define BN_S_MP_SUB_C
|
||||
# define BN_MP_LSHD_C
|
||||
# define BN_MP_ADD_C
|
||||
# define BN_MP_CLEAR_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_KRONECKER_C)
|
||||
# define BN_MP_INIT_COPY_C
|
||||
# define BN_MP_CNT_LSB_C
|
||||
@ -642,7 +564,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_MONTGOMERY_REDUCE_C)
|
||||
# define BN_FAST_MP_MONTGOMERY_REDUCE_C
|
||||
# define BN_S_MP_MONTGOMERY_REDUCE_FAST_C
|
||||
# define BN_MP_GROW_C
|
||||
# define BN_MP_CLAMP_C
|
||||
# define BN_MP_RSHD_C
|
||||
@ -655,10 +577,10 @@
|
||||
|
||||
#if defined(BN_MP_MUL_C)
|
||||
# define BN_FAST_S_MP_MUL_DIGS_C
|
||||
# define BN_MP_BALANCE_MUL_C
|
||||
# define BN_MP_TOOM_MUL_C
|
||||
# define BN_MP_KARATSUBA_MUL_C
|
||||
# define BN_S_MP_MUL_C
|
||||
# define BN_S_MP_BALANCE_MUL_C
|
||||
# define BN_S_MP_TOOM_MUL_C
|
||||
# define BN_S_MP_KARATSUBA_MUL_C
|
||||
# define BN_S_MP_MUL_DIGS_FAST_C
|
||||
# define BN_S_MP_MUL_DIGS_C
|
||||
#endif
|
||||
|
||||
@ -879,7 +801,7 @@
|
||||
# define BN_MP_RSHD_C
|
||||
# define BN_MP_MUL_C
|
||||
# define BN_S_MP_MUL_HIGH_DIGS_C
|
||||
# define BN_FAST_S_MP_MUL_HIGH_DIGS_C
|
||||
# define BN_S_MP_MUL_HIGH_DIGS_FAST_C
|
||||
# define BN_MP_MOD_2D_C
|
||||
# define BN_S_MP_MUL_DIGS_C
|
||||
# define BN_MP_SUB_C
|
||||
@ -975,9 +897,9 @@
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_SQR_C)
|
||||
# define BN_MP_TOOM_SQR_C
|
||||
# define BN_MP_KARATSUBA_SQR_C
|
||||
# define BN_FAST_S_MP_SQR_C
|
||||
# define BN_S_MP_TOOM_SQR_C
|
||||
# define BN_S_MP_KARATSUBA_SQR_C
|
||||
# define BN_S_MP_SQR_FAST_C
|
||||
# define BN_S_MP_SQR_C
|
||||
#endif
|
||||
|
||||
@ -1090,6 +1012,7 @@
|
||||
# define BN_MP_INIT_COPY_C
|
||||
# define BN_MP_DIV_2D_C
|
||||
# define BN_MP_CLEAR_C
|
||||
# define BN_S_MP_REVERSE_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_TO_UNSIGNED_BIN_N_C)
|
||||
@ -1097,45 +1020,12 @@
|
||||
# define BN_MP_TO_UNSIGNED_BIN_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_TOOM_MUL_C)
|
||||
# define BN_MP_INIT_MULTI_C
|
||||
# define BN_MP_MOD_2D_C
|
||||
# define BN_MP_COPY_C
|
||||
# define BN_MP_RSHD_C
|
||||
# define BN_MP_MUL_C
|
||||
# define BN_MP_MUL_2_C
|
||||
# define BN_MP_ADD_C
|
||||
# define BN_MP_SUB_C
|
||||
# define BN_MP_DIV_2_C
|
||||
# define BN_MP_MUL_2D_C
|
||||
# define BN_MP_MUL_D_C
|
||||
# define BN_MP_DIV_3_C
|
||||
# define BN_MP_LSHD_C
|
||||
# define BN_MP_CLEAR_MULTI_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_TOOM_SQR_C)
|
||||
# define BN_MP_INIT_MULTI_C
|
||||
# define BN_MP_MOD_2D_C
|
||||
# define BN_MP_COPY_C
|
||||
# define BN_MP_RSHD_C
|
||||
# define BN_MP_SQR_C
|
||||
# define BN_MP_MUL_2_C
|
||||
# define BN_MP_ADD_C
|
||||
# define BN_MP_SUB_C
|
||||
# define BN_MP_DIV_2_C
|
||||
# define BN_MP_MUL_2D_C
|
||||
# define BN_MP_MUL_D_C
|
||||
# define BN_MP_DIV_3_C
|
||||
# define BN_MP_LSHD_C
|
||||
# define BN_MP_CLEAR_MULTI_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_TORADIX_C)
|
||||
# define BN_MP_INIT_COPY_C
|
||||
# define BN_MP_DIV_D_C
|
||||
# define BN_MP_CLEAR_C
|
||||
# define BN_MP_S_RMAP_C
|
||||
# define BN_S_MP_REVERSE_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_TORADIX_N_C)
|
||||
@ -1143,6 +1033,7 @@
|
||||
# define BN_MP_DIV_D_C
|
||||
# define BN_MP_CLEAR_C
|
||||
# define BN_MP_S_RMAP_C
|
||||
# define BN_S_MP_REVERSE_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_MP_UNSIGNED_BIN_SIZE_C)
|
||||
@ -1162,14 +1053,22 @@
|
||||
#if defined(BN_PRIME_TAB_C)
|
||||
#endif
|
||||
|
||||
#if defined(BN_REVERSE_C)
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_ADD_C)
|
||||
# define BN_MP_GROW_C
|
||||
# define BN_MP_CLAMP_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_BALANCE_MUL_C)
|
||||
# define BN_MP_INIT_SIZE_C
|
||||
# define BN_MP_INIT_MULTI_C
|
||||
# define BN_MP_CLEAR_C
|
||||
# define BN_MP_MUL_C
|
||||
# define BN_MP_LSHD_C
|
||||
# define BN_MP_ADD_C
|
||||
# define BN_MP_EXCH_C
|
||||
# define BN_MP_CLEAR_MULTI_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_EXPTMOD_C)
|
||||
# define BN_MP_COUNT_BITS_C
|
||||
# define BN_MP_INIT_C
|
||||
@ -1186,22 +1085,116 @@
|
||||
# define BN_MP_EXCH_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_EXPTMOD_FAST_C)
|
||||
# define BN_MP_COUNT_BITS_C
|
||||
# define BN_MP_INIT_SIZE_C
|
||||
# define BN_MP_CLEAR_C
|
||||
# define BN_MP_MONTGOMERY_SETUP_C
|
||||
# define BN_S_MP_MONTGOMERY_REDUCE_FAST_C
|
||||
# define BN_MP_MONTGOMERY_REDUCE_C
|
||||
# define BN_MP_DR_SETUP_C
|
||||
# define BN_MP_DR_REDUCE_C
|
||||
# define BN_MP_REDUCE_2K_SETUP_C
|
||||
# define BN_MP_REDUCE_2K_C
|
||||
# define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C
|
||||
# define BN_MP_MULMOD_C
|
||||
# define BN_MP_SET_C
|
||||
# define BN_MP_MOD_C
|
||||
# define BN_MP_COPY_C
|
||||
# define BN_MP_SQR_C
|
||||
# define BN_MP_MUL_C
|
||||
# define BN_MP_EXCH_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_INVMOD_FAST_C)
|
||||
# define BN_MP_INIT_MULTI_C
|
||||
# define BN_MP_COPY_C
|
||||
# define BN_MP_MOD_C
|
||||
# define BN_MP_SET_C
|
||||
# define BN_MP_DIV_2_C
|
||||
# define BN_MP_SUB_C
|
||||
# define BN_MP_CMP_C
|
||||
# define BN_MP_CMP_D_C
|
||||
# define BN_MP_ADD_C
|
||||
# define BN_MP_CMP_MAG_C
|
||||
# define BN_MP_EXCH_C
|
||||
# define BN_MP_CLEAR_MULTI_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_INVMOD_SLOW_C)
|
||||
# define BN_MP_INIT_MULTI_C
|
||||
# define BN_MP_MOD_C
|
||||
# define BN_MP_COPY_C
|
||||
# define BN_MP_SET_C
|
||||
# define BN_MP_DIV_2_C
|
||||
# define BN_MP_ADD_C
|
||||
# define BN_MP_SUB_C
|
||||
# define BN_MP_CMP_C
|
||||
# define BN_MP_CMP_D_C
|
||||
# define BN_MP_CMP_MAG_C
|
||||
# define BN_MP_EXCH_C
|
||||
# define BN_MP_CLEAR_MULTI_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_KARATSUBA_MUL_C)
|
||||
# define BN_MP_MUL_C
|
||||
# define BN_MP_INIT_SIZE_C
|
||||
# define BN_MP_CLAMP_C
|
||||
# define BN_S_MP_ADD_C
|
||||
# define BN_MP_ADD_C
|
||||
# define BN_S_MP_SUB_C
|
||||
# define BN_MP_LSHD_C
|
||||
# define BN_MP_CLEAR_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_KARATSUBA_SQR_C)
|
||||
# define BN_MP_INIT_SIZE_C
|
||||
# define BN_MP_CLAMP_C
|
||||
# define BN_MP_SQR_C
|
||||
# define BN_S_MP_ADD_C
|
||||
# define BN_S_MP_SUB_C
|
||||
# define BN_MP_LSHD_C
|
||||
# define BN_MP_ADD_C
|
||||
# define BN_MP_CLEAR_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_MONTGOMERY_REDUCE_FAST_C)
|
||||
# define BN_MP_GROW_C
|
||||
# define BN_MP_RSHD_C
|
||||
# define BN_MP_CLAMP_C
|
||||
# define BN_MP_CMP_MAG_C
|
||||
# define BN_S_MP_SUB_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_MUL_DIGS_C)
|
||||
# define BN_FAST_S_MP_MUL_DIGS_C
|
||||
# define BN_S_MP_MUL_DIGS_FAST_C
|
||||
# define BN_MP_INIT_SIZE_C
|
||||
# define BN_MP_CLAMP_C
|
||||
# define BN_MP_EXCH_C
|
||||
# define BN_MP_CLEAR_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_MUL_DIGS_FAST_C)
|
||||
# define BN_MP_GROW_C
|
||||
# define BN_MP_CLAMP_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_MUL_HIGH_DIGS_C)
|
||||
# define BN_FAST_S_MP_MUL_HIGH_DIGS_C
|
||||
# define BN_S_MP_MUL_HIGH_DIGS_FAST_C
|
||||
# define BN_MP_INIT_SIZE_C
|
||||
# define BN_MP_CLAMP_C
|
||||
# define BN_MP_EXCH_C
|
||||
# define BN_MP_CLEAR_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_MUL_HIGH_DIGS_FAST_C)
|
||||
# define BN_MP_GROW_C
|
||||
# define BN_MP_CLAMP_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_REVERSE_C)
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_SQR_C)
|
||||
# define BN_MP_INIT_SIZE_C
|
||||
# define BN_MP_CLAMP_C
|
||||
@ -1209,11 +1202,50 @@
|
||||
# define BN_MP_CLEAR_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_SQR_FAST_C)
|
||||
# define BN_MP_GROW_C
|
||||
# define BN_MP_CLAMP_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_SUB_C)
|
||||
# define BN_MP_GROW_C
|
||||
# define BN_MP_CLAMP_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_TOOM_MUL_C)
|
||||
# define BN_MP_INIT_MULTI_C
|
||||
# define BN_MP_MOD_2D_C
|
||||
# define BN_MP_COPY_C
|
||||
# define BN_MP_RSHD_C
|
||||
# define BN_MP_MUL_C
|
||||
# define BN_MP_MUL_2_C
|
||||
# define BN_MP_ADD_C
|
||||
# define BN_MP_SUB_C
|
||||
# define BN_MP_DIV_2_C
|
||||
# define BN_MP_MUL_2D_C
|
||||
# define BN_MP_MUL_D_C
|
||||
# define BN_MP_DIV_3_C
|
||||
# define BN_MP_LSHD_C
|
||||
# define BN_MP_CLEAR_MULTI_C
|
||||
#endif
|
||||
|
||||
#if defined(BN_S_MP_TOOM_SQR_C)
|
||||
# define BN_MP_INIT_MULTI_C
|
||||
# define BN_MP_MOD_2D_C
|
||||
# define BN_MP_COPY_C
|
||||
# define BN_MP_RSHD_C
|
||||
# define BN_MP_SQR_C
|
||||
# define BN_MP_MUL_2_C
|
||||
# define BN_MP_ADD_C
|
||||
# define BN_MP_SUB_C
|
||||
# define BN_MP_DIV_2_C
|
||||
# define BN_MP_MUL_2D_C
|
||||
# define BN_MP_MUL_D_C
|
||||
# define BN_MP_DIV_3_C
|
||||
# define BN_MP_LSHD_C
|
||||
# define BN_MP_CLEAR_MULTI_C
|
||||
#endif
|
||||
|
||||
#if defined(BNCORE_C)
|
||||
#endif
|
||||
|
||||
|
@ -44,23 +44,23 @@ extern void MP_FREE(void *mem, size_t size);
|
||||
/* lowlevel functions, do not call! */
|
||||
int s_mp_add(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
int s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
int fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs);
|
||||
int s_mp_mul_digs_fast(const mp_int *a, const mp_int *b, mp_int *c, int digs);
|
||||
int s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs);
|
||||
int fast_s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs);
|
||||
int s_mp_mul_high_digs_fast(const mp_int *a, const mp_int *b, mp_int *c, int digs);
|
||||
int s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs);
|
||||
int fast_s_mp_sqr(const mp_int *a, mp_int *b);
|
||||
int s_mp_sqr_fast(const mp_int *a, mp_int *b);
|
||||
int s_mp_sqr(const mp_int *a, mp_int *b);
|
||||
int mp_balance_mul(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
int mp_karatsuba_sqr(const mp_int *a, mp_int *b);
|
||||
int mp_toom_sqr(const mp_int *a, mp_int *b);
|
||||
int fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
int mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
int fast_mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho);
|
||||
int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode);
|
||||
int s_mp_balance_mul(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
int s_mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
int s_mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
int s_mp_karatsuba_sqr(const mp_int *a, mp_int *b);
|
||||
int s_mp_toom_sqr(const mp_int *a, mp_int *b);
|
||||
int s_mp_invmod_fast(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
int s_mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
int s_mp_montgomery_reduce_fast(mp_int *x, const mp_int *n, mp_digit rho);
|
||||
int s_mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode);
|
||||
int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode);
|
||||
void bn_reverse(unsigned char *s, int len);
|
||||
void s_mp_reverse(unsigned char *s, int len);
|
||||
|
||||
extern const char *const mp_s_rmap;
|
||||
extern const uint8_t mp_s_rmap_reverse[];
|
||||
@ -91,6 +91,21 @@ int func_name (mp_int * a, type b) \
|
||||
}
|
||||
|
||||
/* deprecated functions */
|
||||
MP_DEPRECATED(s_mp_invmod_fast) int fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
MP_DEPRECATED(s_mp_montgomery_reduce_fast) int fast_mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho);
|
||||
MP_DEPRECATED(s_mp_mul_digs_fast) int fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs);
|
||||
MP_DEPRECATED(s_mp_mul_high_digs_fast) int fast_s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c,
|
||||
int digs);
|
||||
MP_DEPRECATED(s_mp_sqr_fast) int fast_s_mp_sqr(const mp_int *a, mp_int *b);
|
||||
MP_DEPRECATED(s_mp_balance_mul) int mp_balance_mul(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
MP_DEPRECATED(s_mp_exptmod_fast) int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y,
|
||||
int redmode);
|
||||
MP_DEPRECATED(s_mp_invmod_slow) int mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
MP_DEPRECATED(s_mp_karatsuba_mul) int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
MP_DEPRECATED(s_mp_karatsuba_sqr) int mp_karatsuba_sqr(const mp_int *a, mp_int *b);
|
||||
MP_DEPRECATED(s_mp_toom_mul) int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c);
|
||||
MP_DEPRECATED(s_mp_toom_sqr) int mp_toom_sqr(const mp_int *a, mp_int *b);
|
||||
MP_DEPRECATED(s_mp_reverse) void bn_reverse(unsigned char *s, int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
# define BN_MP_TO_UNSIGNED_BIN_C
|
||||
# define BN_MP_MOD_D_C
|
||||
# define BN_MP_PRIME_RABIN_MILLER_TRIALS_C
|
||||
# define BN_REVERSE_C
|
||||
# define BN_S_MP_REVERSE_C
|
||||
# define BN_PRIME_TAB_C
|
||||
|
||||
/* other modifiers */
|
||||
@ -44,10 +44,10 @@
|
||||
* like removing support for even moduli, etc...
|
||||
*/
|
||||
# ifdef LTM_LAST
|
||||
# undef BN_MP_TOOM_MUL_C
|
||||
# undef BN_MP_TOOM_SQR_C
|
||||
# undef BN_MP_KARATSUBA_MUL_C
|
||||
# undef BN_MP_KARATSUBA_SQR_C
|
||||
# undef BN_S_MP_TOOM_MUL_C
|
||||
# undef BN_S_MP_TOOM_SQR_C
|
||||
# undef BN_S_MP_KARATSUBA_MUL_C
|
||||
# undef BN_S_MP_KARATSUBA_SQR_C
|
||||
# undef BN_MP_REDUCE_C
|
||||
# undef BN_MP_REDUCE_SETUP_C
|
||||
# undef BN_MP_DR_IS_MODULUS_C
|
||||
@ -59,8 +59,8 @@
|
||||
# undef BN_S_MP_EXPTMOD_C
|
||||
# undef BN_MP_DIV_3_C
|
||||
# undef BN_S_MP_MUL_HIGH_DIGS_C
|
||||
# undef BN_FAST_S_MP_MUL_HIGH_DIGS_C
|
||||
# undef BN_FAST_MP_INVMOD_C
|
||||
# undef BN_S_MP_MUL_HIGH_DIGS_FAST_C
|
||||
# undef BN_S_MP_INVMOD_FAST_C
|
||||
|
||||
/* To safely undefine these you have to make sure your RSA key won't exceed the Comba threshold
|
||||
* which is roughly 255 digits [7140 bits for 32-bit machines, 15300 bits for 64-bit machines]
|
||||
|
Loading…
Reference in New Issue
Block a user