summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-04-02 08:01:43 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-04-02 08:01:43 (GMT)
commit435d68de7599105bc6d10e40d70ef2c681b84555 (patch)
treeb8610d5d6f7e48ee60258242ef955dc57b5a02bb
parentb6408f7dfcf83ca08e8b1b4a3a20b834dfab8bff (diff)
parente1870dc5016164aa8b603cfd5737f13a93e3d6f4 (diff)
downloadtcl-435d68de7599105bc6d10e40d70ef2c681b84555.zip
tcl-435d68de7599105bc6d10e40d70ef2c681b84555.tar.gz
tcl-435d68de7599105bc6d10e40d70ef2c681b84555.tar.bz2
Update to libtommath-1.3 (but keep Tcl 8.6-specific tweaks)
-rw-r--r--generic/tclStrToD.c10
-rw-r--r--generic/tclStubInit.c2
-rw-r--r--generic/tclTomMath.decls2
-rw-r--r--generic/tclTomMath.h6
-rw-r--r--generic/tclTomMathDecls.h6
-rw-r--r--libtommath/bn_mp_div_d.c4
-rw-r--r--libtommath/bn_mp_expt_n.c (renamed from libtommath/bn_mp_expt_u32.c)13
-rw-r--r--libtommath/bn_mp_to_ubin.c3
-rw-r--r--libtommath/bn_s_mp_div_3.c (renamed from libtommath/bn_mp_div_3.c)4
-rw-r--r--libtommath/bn_s_mp_toom_mul.c2
-rw-r--r--libtommath/changes.txt6
-rw-r--r--libtommath/libtommath.pc.in9
-rw-r--r--libtommath/tommath.def1
-rw-r--r--libtommath/tommath.h43
-rw-r--r--libtommath/tommath_class.h113
-rw-r--r--libtommath/tommath_private.h6
-rw-r--r--macosx/Tcl.xcode/project.pbxproj8
-rw-r--r--macosx/Tcl.xcodeproj/project.pbxproj16
-rw-r--r--unix/Makefile.in14
-rw-r--r--win/Makefile.in4
-rw-r--r--win/makefile.vc4
21 files changed, 142 insertions, 134 deletions
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index 75125f0..12fe4ee 100644
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -3566,7 +3566,7 @@ ShorteningBignumConversionPowD(
if (m2plus > m2minus) {
mp_clear(&mplus);
}
- mp_clear_multi(&b, &mminus, &temp, NULL);
+ mp_clear_multi(&b, &mminus, &temp, (void *)NULL);
*s = '\0';
*decpt = k;
if (endPtr) {
@@ -3690,7 +3690,7 @@ StrictBignumConversionPowD(
* string.
*/
- mp_clear_multi(&b, &temp, NULL);
+ mp_clear_multi(&b, &temp, (void *)NULL);
*s = '\0';
*decpt = k;
if (endPtr) {
@@ -3991,7 +3991,7 @@ ShorteningBignumConversion(
if (m2plus > m2minus) {
mp_clear(&mplus);
}
- mp_clear_multi(&b, &mminus, &temp, &dig, &S, NULL);
+ mp_clear_multi(&b, &mminus, &temp, &dig, &S, (void *)NULL);
*s = '\0';
*decpt = k;
if (endPtr) {
@@ -4048,7 +4048,7 @@ StrictBignumConversion(
* S = 2**s2 * 5*s5
*/
- mp_init_multi(&temp, &dig, NULL);
+ mp_init_multi(&temp, &dig, (void *)NULL);
TclBNInitBignumFromWideUInt(&b, bw);
mp_mul_2d(&b, b2, &b);
mp_init_set(&S, 1);
@@ -4155,7 +4155,7 @@ StrictBignumConversion(
* string.
*/
- mp_clear_multi(&b, &S, &temp, &dig, NULL);
+ mp_clear_multi(&b, &S, &temp, &dig, (void *)NULL);
*s = '\0';
*decpt = k;
if (endPtr) {
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 036dba2..0a7fb01 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -95,7 +95,7 @@ mp_err TclBN_mp_init_set_int(mp_int *a, unsigned long i)
int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast)
{
- return mp_expt_u32(a, b, c);
+ return mp_expt_n(a, b, c);
}
#define TclBN_mp_div_ld TclBNMpDivLd
diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls
index 27afefd..55cc8f7 100644
--- a/generic/tclTomMath.decls
+++ b/generic/tclTomMath.decls
@@ -80,7 +80,7 @@ declare 18 {
void TclBN_mp_exch(mp_int *a, mp_int *b)
}
declare 19 {
- mp_err TclBN_mp_expt_d(const mp_int *a, unsigned int b, mp_int *c)
+ mp_err TclBN_mp_expt_d(const mp_int *a, int b, mp_int *c)
}
declare 20 {
mp_err TclBN_mp_grow(mp_int *a, int size)
diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h
index 79899e7..00b6503 100644
--- a/generic/tclTomMath.h
+++ b/generic/tclTomMath.h
@@ -1019,13 +1019,13 @@ mp_err mp_log_u32(const mp_int *a, unsigned int base, unsigned int *c) MP_WUR;
/* c = a**b */
/*
-mp_err mp_expt_u32(const mp_int *a, unsigned int b, mp_int *c) MP_WUR;
+mp_err mp_expt_n(const mp_int *a, int b, mp_int *c) MP_WUR;
*/
/*
-MP_DEPRECATED(mp_expt_u32) mp_err mp_expt_d(const mp_int *a, mp_digit b, mp_int *c) MP_WUR;
+MP_DEPRECATED(mp_expt_n) mp_err mp_expt_d(const mp_int *a, mp_digit b, mp_int *c) MP_WUR;
*/
/*
-MP_DEPRECATED(mp_expt_u32) mp_err mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) MP_WUR;
+MP_DEPRECATED(mp_expt_n) mp_err mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) MP_WUR;
*/
/* ---> radix conversion <--- */
diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h
index 550283d..27bf147 100644
--- a/generic/tclTomMathDecls.h
+++ b/generic/tclTomMathDecls.h
@@ -67,6 +67,7 @@
#define mp_div_2 TclBN_mp_div_2
#define mp_div_2d TclBN_mp_div_2d
#define mp_div_3 TclBN_mp_div_3
+#define s_mp_div_3 TclBN_mp_div_3
#define mp_div_d TclBN_mp_div_d
#define mp_exch TclBN_mp_exch
#define mp_expt_d TclBN_mp_expt_d
@@ -208,8 +209,7 @@ EXTERN mp_err TclBN_mp_div_3(const mp_int *a, mp_int *q,
/* 18 */
EXTERN void TclBN_mp_exch(mp_int *a, mp_int *b);
/* 19 */
-EXTERN mp_err TclBN_mp_expt_d(const mp_int *a, unsigned int b,
- mp_int *c);
+EXTERN mp_err TclBN_mp_expt_d(const mp_int *a, int b, mp_int *c);
/* 20 */
EXTERN mp_err TclBN_mp_grow(mp_int *a, int size);
/* 21 */
@@ -391,7 +391,7 @@ typedef struct TclTomMathStubs {
mp_err (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */
mp_err (*tclBN_mp_div_3) (const mp_int *a, mp_int *q, mp_digit *r); /* 17 */
void (*tclBN_mp_exch) (mp_int *a, mp_int *b); /* 18 */
- mp_err (*tclBN_mp_expt_d) (const mp_int *a, unsigned int b, mp_int *c); /* 19 */
+ mp_err (*tclBN_mp_expt_d) (const mp_int *a, int b, mp_int *c); /* 19 */
mp_err (*tclBN_mp_grow) (mp_int *a, int size); /* 20 */
mp_err (*tclBN_mp_init) (mp_int *a); /* 21 */
mp_err (*tclBN_mp_init_copy) (mp_int *a, const mp_int *b); /* 22 */
diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c
index b9d718b..24a2c19 100644
--- a/libtommath/bn_mp_div_d.c
+++ b/libtommath/bn_mp_div_d.c
@@ -44,8 +44,8 @@ mp_err mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d)
}
/* three? */
- if (MP_HAS(MP_DIV_3) && (b == 3u)) {
- return mp_div_3(a, c, d);
+ if (MP_HAS(S_MP_DIV_3) && (b == 3u)) {
+ return s_mp_div_3(a, c, d);
}
/* no easy answer [c'est la vie]. Just division */
diff --git a/libtommath/bn_mp_expt_u32.c b/libtommath/bn_mp_expt_n.c
index 67c8fd2..2b8b6d4 100644
--- a/libtommath/bn_mp_expt_u32.c
+++ b/libtommath/bn_mp_expt_n.c
@@ -1,13 +1,12 @@
#include "tommath_private.h"
-#ifdef BN_MP_EXPT_U32_C
+#ifdef BN_MP_EXPT_N_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
/* calculate c = a**b using a square-multiply algorithm */
-mp_err mp_expt_u32(const mp_int *a, unsigned int b, mp_int *c)
+mp_err mp_expt_n(const mp_int *a, int b, mp_int *c)
{
mp_err err;
-
mp_int g;
if ((err = mp_init_copy(&g, a)) != MP_OKAY) {
@@ -17,16 +16,16 @@ mp_err mp_expt_u32(const mp_int *a, unsigned int b, mp_int *c)
/* set initial result */
mp_set(c, 1uL);
- while (b > 0u) {
+ while (b > 0) {
/* if the bit is set multiply */
- if ((b & 1u) != 0u) {
+ if ((b & 1) != 0) {
if ((err = mp_mul(c, &g, c)) != MP_OKAY) {
goto LBL_ERR;
}
}
/* square */
- if (b > 1u) {
+ if (b > 1) {
if ((err = mp_sqr(&g, &g)) != MP_OKAY) {
goto LBL_ERR;
}
@@ -36,8 +35,6 @@ mp_err mp_expt_u32(const mp_int *a, unsigned int b, mp_int *c)
b >>= 1;
}
- err = MP_OKAY;
-
LBL_ERR:
mp_clear(&g);
return err;
diff --git a/libtommath/bn_mp_to_ubin.c b/libtommath/bn_mp_to_ubin.c
index 4913c3a..1681ca7 100644
--- a/libtommath/bn_mp_to_ubin.c
+++ b/libtommath/bn_mp_to_ubin.c
@@ -10,8 +10,7 @@ mp_err mp_to_ubin(const mp_int *a, unsigned char *buf, size_t maxlen, size_t *wr
mp_err err;
mp_int t;
- size_t size = (size_t)mp_count_bits(a);
- count = (size / 8u) + (((size & 7u) != 0u) ? 1u : 0u);
+ count = mp_ubin_size(a);
if (count > maxlen) {
return MP_BUF;
}
diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_s_mp_div_3.c
index 3a23fdf..e0aeefc 100644
--- a/libtommath/bn_mp_div_3.c
+++ b/libtommath/bn_s_mp_div_3.c
@@ -1,10 +1,10 @@
#include "tommath_private.h"
-#ifdef BN_MP_DIV_3_C
+#ifdef BN_S_MP_DIV_3_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
/* divide by three (based on routine from MPI and the GMP manual) */
-mp_err mp_div_3(const mp_int *a, mp_int *c, mp_digit *d)
+mp_err s_mp_div_3(const mp_int *a, mp_int *c, mp_digit *d)
{
mp_int q;
mp_word w, t;
diff --git a/libtommath/bn_s_mp_toom_mul.c b/libtommath/bn_s_mp_toom_mul.c
index c7db3a5..fd574a2 100644
--- a/libtommath/bn_s_mp_toom_mul.c
+++ b/libtommath/bn_s_mp_toom_mul.c
@@ -146,7 +146,7 @@ mp_err s_mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c)
if ((err = mp_sub(&S2, &a1, &S2)) != MP_OKAY) goto LBL_ERR;
/** S2 = S2 / 3; \\ this is an exact division */
- if ((err = mp_div_3(&S2, &S2, NULL)) != MP_OKAY) goto LBL_ERR;
+ if ((err = s_mp_div_3(&S2, &S2, NULL)) != MP_OKAY) goto LBL_ERR;
/** a1 = S1 - a1; */
if ((err = mp_sub(&S1, &a1, &a1)) != MP_OKAY) goto LBL_ERR;
diff --git a/libtommath/changes.txt b/libtommath/changes.txt
index 956cdd4..ac9e49a 100644
--- a/libtommath/changes.txt
+++ b/libtommath/changes.txt
@@ -1,3 +1,9 @@
+Mar 27th, 2024
+v1.3.0
+ -- Deprecate more APIs which are replaced in develop (PR #572)
+ -- Add support for CMake (PR #573)
+ -- Add support for GitHub Actions (PR #573)
+
Sep 04th, 2023
v1.2.1
-- Bugfix release because of potential integer overflow
diff --git a/libtommath/libtommath.pc.in b/libtommath/libtommath.pc.in
index 099b1cd..7ce50fd 100644
--- a/libtommath/libtommath.pc.in
+++ b/libtommath/libtommath.pc.in
@@ -1,10 +1,9 @@
-prefix=@to-be-replaced@
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include
+prefix=@CMAKE_INSTALL_PREFIX@
+libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
Name: LibTomMath
Description: public domain library for manipulating large integer numbers
-Version: @to-be-replaced@
+Version: @PROJECT_VERSION@
Libs: -L${libdir} -ltommath
Cflags: -I${includedir}
diff --git a/libtommath/tommath.def b/libtommath/tommath.def
index cc6a9f1..ca84c3f 100644
--- a/libtommath/tommath.def
+++ b/libtommath/tommath.def
@@ -148,6 +148,7 @@ EXPORTS
mp_zero
s_mp_add
s_mp_balance_mul
+ s_mp_div_3
s_mp_karatsuba_mul
s_mp_karatsuba_sqr
s_mp_mul_digs
diff --git a/libtommath/tommath.h b/libtommath/tommath.h
index 8ccbb89..1e9a9c0 100644
--- a/libtommath/tommath.h
+++ b/libtommath/tommath.h
@@ -329,7 +329,7 @@ uint32_t mp_get_mag_u32(const mp_int *a) MP_WUR;
uint64_t mp_get_mag_u64(const mp_int *a) MP_WUR;
#endif
unsigned long mp_get_mag_ul(const mp_int *a) MP_WUR;
-Tcl_WideUInt mp_get_mag_ull(const mp_int *a) MP_WUR;
+MP_DEPRECATED(mp_get_mag_u64) Tcl_WideUInt mp_get_mag_ull(const mp_int *a) MP_WUR;
/* get integer, set integer (long) */
long mp_get_l(const mp_int *a) MP_WUR;
@@ -342,14 +342,14 @@ void mp_set_ul(mp_int *a, unsigned long b);
mp_err mp_init_ul(mp_int *a, unsigned long b) MP_WUR;
/* get integer, set integer (Tcl_WideInt) */
-Tcl_WideInt mp_get_ll(const mp_int *a) MP_WUR;
-void mp_set_ll(mp_int *a, Tcl_WideInt b);
-mp_err mp_init_ll(mp_int *a, Tcl_WideInt b) MP_WUR;
+MP_DEPRECATED(mp_get_i64) Tcl_WideInt mp_get_ll(const mp_int *a) MP_WUR;
+MP_DEPRECATED(mp_set_i64) void mp_set_ll(mp_int *a, Tcl_WideInt b);
+MP_DEPRECATED(mp_init_i64) mp_err mp_init_ll(mp_int *a, Tcl_WideInt b) MP_WUR;
/* get integer, set integer (Tcl_WideUInt) */
-#define mp_get_ull(a) ((Tcl_WideUInt)mp_get_ll(a))
-void mp_set_ull(mp_int *a, Tcl_WideUInt b);
-mp_err mp_init_ull(mp_int *a, Tcl_WideUInt b) MP_WUR;
+#define mp_get_ull(a) (MP_DEPRECATED_PRAGMA("mp_get_ull() has been deprecated, use mp_get_u64()") ((Tcl_WideUInt)mp_get_ll(a)))
+MP_DEPRECATED(mp_set_u64) void mp_set_ull(mp_int *a, Tcl_WideUInt b);
+MP_DEPRECATED(mp_init_u64) mp_err mp_init_ull(mp_int *a, Tcl_WideUInt b) MP_WUR;
/* set to single unsigned digit, up to MP_DIGIT_MAX */
void mp_set(mp_int *a, mp_digit b);
@@ -358,7 +358,7 @@ mp_err mp_init_set(mp_int *a, mp_digit b) MP_WUR;
/* get integer, set integer and init with integer (deprecated) */
MP_DEPRECATED(mp_get_mag_u32/mp_get_u32) unsigned long mp_get_int(const mp_int *a) MP_WUR;
MP_DEPRECATED(mp_get_mag_ul/mp_get_ul) unsigned long mp_get_long(const mp_int *a) MP_WUR;
-MP_DEPRECATED(mp_get_mag_ull/mp_get_ull) Tcl_WideUInt mp_get_long_long(const mp_int *a) MP_WUR;
+MP_DEPRECATED(mp_get_mag_u64/mp_get_u64) Tcl_WideUInt mp_get_long_long(const mp_int *a) MP_WUR;
MP_DEPRECATED(mp_set_ul) mp_err mp_set_int(mp_int *a, unsigned long b);
MP_DEPRECATED(mp_set_ul) mp_err mp_set_long(mp_int *a, unsigned long b);
MP_DEPRECATED(mp_set_ull) mp_err mp_set_long_long(mp_int *a, Tcl_WideUInt b);
@@ -407,7 +407,7 @@ mp_err mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d) MP_WUR;
mp_err mp_div_2(const mp_int *a, mp_int *b) MP_WUR;
/* a/3 => 3c + d == a */
-mp_err mp_div_3(const mp_int *a, mp_int *c, mp_digit *d) MP_WUR;
+MP_DEPRECATED(mp_div_d) mp_err mp_div_3(const mp_int *a, mp_int *c, mp_digit *d) MP_WUR;
/* c = a * 2**b, implemented as c = a << b */
mp_err mp_mul_2d(const mp_int *a, int b, mp_int *c) MP_WUR;
@@ -554,13 +554,24 @@ mp_err mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp
/* c = [a, b] or (a*b)/(a, b) */
mp_err mp_lcm(const mp_int *a, const mp_int *b, mp_int *c) MP_WUR;
+/* Integer logarithm to integer base */
+mp_err mp_log_n(const mp_int *a, int base, int *c) MP_WUR;
+MP_DEPRECATED(mp_log_n) mp_err mp_log_u32(const mp_int *a, uint32_t base, uint32_t *c) MP_WUR;
+
+/* c = a**b */
+mp_err mp_expt_n(const mp_int *a, int b, mp_int *c) MP_WUR;
+MP_DEPRECATED(mp_expt_n) mp_err mp_expt_u32(const mp_int *a, uint32_t b, mp_int *c) MP_WUR;
+MP_DEPRECATED(mp_expt_n) mp_err mp_expt_d(const mp_int *a, mp_digit b, mp_int *c) MP_WUR;
+MP_DEPRECATED(mp_expt_n) mp_err mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) MP_WUR;
+
/* finds one of the b'th root of a, such that |c|**b <= |a|
*
* returns error if a < 0 and b is even
*/
-mp_err mp_root_u32(const mp_int *a, unsigned int b, mp_int *c) MP_WUR;
-MP_DEPRECATED(mp_root_u32) mp_err mp_n_root(const mp_int *a, mp_digit b, mp_int *c) MP_WUR;
-MP_DEPRECATED(mp_root_u32) mp_err mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) MP_WUR;
+mp_err mp_root_n(const mp_int *a, int b, mp_int *c) MP_WUR;
+MP_DEPRECATED(mp_root_n) mp_err mp_root_u32(const mp_int *a, uint32_t b, mp_int *c) MP_WUR;
+MP_DEPRECATED(mp_root_n) mp_err mp_n_root(const mp_int *a, mp_digit b, mp_int *c) MP_WUR;
+MP_DEPRECATED(mp_root_n) mp_err mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) MP_WUR;
/* special sqrt algo */
mp_err mp_sqrt(const mp_int *arg, mp_int *ret) MP_WUR;
@@ -720,14 +731,6 @@ MP_DEPRECATED(mp_prime_rand) mp_err mp_prime_random_ex(mp_int *a, int t, int siz
private_mp_prime_callback cb, void *dat) MP_WUR;
mp_err mp_prime_rand(mp_int *a, int t, int size, int flags) MP_WUR;
-/* Integer logarithm to integer base */
-mp_err mp_log_u32(const mp_int *a, unsigned int base, unsigned int *c) MP_WUR;
-
-/* c = a**b */
-mp_err mp_expt_u32(const mp_int *a, unsigned int b, mp_int *c) MP_WUR;
-MP_DEPRECATED(mp_expt_u32) mp_err mp_expt_d(const mp_int *a, mp_digit b, mp_int *c) MP_WUR;
-MP_DEPRECATED(mp_expt_u32) mp_err mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) MP_WUR;
-
/* ---> radix conversion <--- */
int mp_count_bits(const mp_int *a) MP_WUR;
diff --git a/libtommath/tommath_class.h b/libtommath/tommath_class.h
index 52ba585..0be592b 100644
--- a/libtommath/tommath_class.h
+++ b/libtommath/tommath_class.h
@@ -33,14 +33,13 @@
# define BN_MP_DIV_C
# define BN_MP_DIV_2_C
# define BN_MP_DIV_2D_C
-# define BN_MP_DIV_3_C
# define BN_MP_DIV_D_C
# define BN_MP_DR_IS_MODULUS_C
# define BN_MP_DR_REDUCE_C
# define BN_MP_DR_SETUP_C
# define BN_MP_ERROR_TO_STRING_C
# define BN_MP_EXCH_C
-# define BN_MP_EXPT_U32_C
+# define BN_MP_EXPT_N_C
# define BN_MP_EXPTMOD_C
# define BN_MP_EXTEUCLID_C
# define BN_MP_FREAD_C
@@ -52,11 +51,9 @@
# define BN_MP_GET_I32_C
# define BN_MP_GET_I64_C
# define BN_MP_GET_L_C
-# define BN_MP_GET_LL_C
# define BN_MP_GET_MAG_U32_C
# define BN_MP_GET_MAG_U64_C
# define BN_MP_GET_MAG_UL_C
-# define BN_MP_GET_MAG_ULL_C
# define BN_MP_GROW_C
# define BN_MP_INCR_C
# define BN_MP_INIT_C
@@ -64,21 +61,19 @@
# define BN_MP_INIT_I32_C
# define BN_MP_INIT_I64_C
# define BN_MP_INIT_L_C
-# define BN_MP_INIT_LL_C
# define BN_MP_INIT_MULTI_C
# define BN_MP_INIT_SET_C
# define BN_MP_INIT_SIZE_C
# define BN_MP_INIT_U32_C
# define BN_MP_INIT_U64_C
# define BN_MP_INIT_UL_C
-# define BN_MP_INIT_ULL_C
# define BN_MP_INVMOD_C
# define BN_MP_IS_SQUARE_C
# define BN_MP_ISEVEN_C
# define BN_MP_ISODD_C
# define BN_MP_KRONECKER_C
# define BN_MP_LCM_C
-# define BN_MP_LOG_U32_C
+# define BN_MP_LOG_N_C
# define BN_MP_LSHD_C
# define BN_MP_MOD_C
# define BN_MP_MOD_2D_C
@@ -115,7 +110,7 @@
# define BN_MP_REDUCE_IS_2K_C
# define BN_MP_REDUCE_IS_2K_L_C
# define BN_MP_REDUCE_SETUP_C
-# define BN_MP_ROOT_U32_C
+# define BN_MP_ROOT_N_C
# define BN_MP_RSHD_C
# define BN_MP_SBIN_SIZE_C
# define BN_MP_SET_C
@@ -123,11 +118,9 @@
# define BN_MP_SET_I32_C
# define BN_MP_SET_I64_C
# define BN_MP_SET_L_C
-# define BN_MP_SET_LL_C
# define BN_MP_SET_U32_C
# define BN_MP_SET_U64_C
# define BN_MP_SET_UL_C
-# define BN_MP_SET_ULL_C
# define BN_MP_SHRINK_C
# define BN_MP_SIGNED_RSH_C
# define BN_MP_SQR_C
@@ -147,6 +140,7 @@
# define BN_PRIME_TAB_C
# define BN_S_MP_ADD_C
# define BN_S_MP_BALANCE_MUL_C
+# define BN_S_MP_DIV_3_C
# define BN_S_MP_EXPTMOD_C
# define BN_S_MP_EXPTMOD_FAST_C
# define BN_S_MP_GET_BIT_C
@@ -154,6 +148,9 @@
# 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_LOG_C
+# define BN_S_MP_LOG_2EXPT_C
+# define BN_S_MP_LOG_D_C
# define BN_S_MP_MONTGOMERY_REDUCE_FAST_C
# define BN_S_MP_MUL_DIGS_C
# define BN_S_MP_MUL_DIGS_FAST_C
@@ -182,28 +179,36 @@
# define BN_MP_AND_C
# define BN_MP_BALANCE_MUL_C
# define BN_MP_CMP_D_C
+# define BN_MP_DIV_3_C
# define BN_MP_EXPORT_C
# define BN_MP_EXPTMOD_FAST_C
# define BN_MP_EXPT_D_C
# define BN_MP_EXPT_D_EX_C
+# define BN_MP_EXPT_N_C
# define BN_MP_EXPT_U32_C
# define BN_MP_FROM_SBIN_C
# define BN_MP_FROM_UBIN_C
# define BN_MP_GET_BIT_C
# define BN_MP_GET_INT_C
+# define BN_MP_GET_LL_C
# define BN_MP_GET_LONG_C
# define BN_MP_GET_LONG_LONG_C
# define BN_MP_GET_MAG_U32_C
+# define BN_MP_GET_MAG_U64_C
# define BN_MP_GET_MAG_ULL_C
# define BN_MP_GET_MAG_UL_C
# define BN_MP_IMPORT_C
+# define BN_MP_INIT_LL_C
# define BN_MP_INIT_SET_INT_C
# define BN_MP_INIT_U32_C
+# define BN_MP_INIT_ULL_C
# define BN_MP_INVMOD_SLOW_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_LOG_N_C
+# define BN_MP_LOG_U32_C
# define BN_MP_N_ROOT_C
# define BN_MP_N_ROOT_EX_C
# define BN_MP_OR_C
@@ -213,13 +218,16 @@
# define BN_MP_RAND_DIGIT_C
# define BN_MP_READ_SIGNED_BIN_C
# define BN_MP_READ_UNSIGNED_BIN_C
+# define BN_MP_ROOT_N_C
# define BN_MP_ROOT_U32_C
# define BN_MP_SBIN_SIZE_C
# define BN_MP_SET_INT_C
+# define BN_MP_SET_LL_C
# define BN_MP_SET_LONG_C
# define BN_MP_SET_LONG_LONG_C
# define BN_MP_SET_U32_C
# define BN_MP_SET_U64_C
+# define BN_MP_SET_ULL_C
# define BN_MP_SIGNED_BIN_SIZE_C
# define BN_MP_SIGNED_RSH_C
# define BN_MP_TC_AND_C
@@ -242,6 +250,7 @@
# define BN_MP_UNSIGNED_BIN_SIZE_C
# define BN_MP_XOR_C
# define BN_S_MP_BALANCE_MUL_C
+# define BN_S_MP_DIV_3_C
# define BN_S_MP_EXPTMOD_FAST_C
# define BN_S_MP_GET_BIT_C
# define BN_S_MP_INVMOD_FAST_C
@@ -369,21 +378,14 @@
# define BN_MP_ZERO_C
#endif
-#if defined(BN_MP_DIV_3_C)
-# define BN_MP_CLAMP_C
-# define BN_MP_CLEAR_C
-# define BN_MP_EXCH_C
-# define BN_MP_INIT_SIZE_C
-#endif
-
#if defined(BN_MP_DIV_D_C)
# define BN_MP_CLAMP_C
# define BN_MP_CLEAR_C
# define BN_MP_COPY_C
# define BN_MP_DIV_2D_C
-# define BN_MP_DIV_3_C
# define BN_MP_EXCH_C
# define BN_MP_INIT_SIZE_C
+# define BN_S_MP_DIV_3_C
#endif
#if defined(BN_MP_DR_IS_MODULUS_C)
@@ -405,7 +407,7 @@
#if defined(BN_MP_EXCH_C)
#endif
-#if defined(BN_MP_EXPT_U32_C)
+#if defined(BN_MP_EXPT_N_C)
# define BN_MP_CLEAR_C
# define BN_MP_INIT_COPY_C
# define BN_MP_MUL_C
@@ -486,10 +488,6 @@
# define BN_MP_GET_MAG_UL_C
#endif
-#if defined(BN_MP_GET_LL_C)
-# define BN_MP_GET_MAG_ULL_C
-#endif
-
#if defined(BN_MP_GET_MAG_U32_C)
#endif
@@ -499,9 +497,6 @@
#if defined(BN_MP_GET_MAG_UL_C)
#endif
-#if defined(BN_MP_GET_MAG_ULL_C)
-#endif
-
#if defined(BN_MP_GROW_C)
#endif
@@ -535,11 +530,6 @@
# define BN_MP_SET_L_C
#endif
-#if defined(BN_MP_INIT_LL_C)
-# define BN_MP_INIT_C
-# define BN_MP_SET_LL_C
-#endif
-
#if defined(BN_MP_INIT_MULTI_C)
# define BN_MP_CLEAR_C
# define BN_MP_INIT_C
@@ -568,11 +558,6 @@
# define BN_MP_SET_UL_C
#endif
-#if defined(BN_MP_INIT_ULL_C)
-# define BN_MP_INIT_C
-# define BN_MP_SET_ULL_C
-#endif
-
#if defined(BN_MP_INVMOD_C)
# define BN_MP_CMP_D_C
# define BN_S_MP_INVMOD_FAST_C
@@ -616,18 +601,10 @@
# define BN_MP_MUL_C
#endif
-#if defined(BN_MP_LOG_U32_C)
-# define BN_MP_CLEAR_MULTI_C
-# define BN_MP_CMP_C
-# define BN_MP_CMP_D_C
-# define BN_MP_COPY_C
-# define BN_MP_COUNT_BITS_C
-# define BN_MP_EXCH_C
-# define BN_MP_EXPT_U32_C
-# define BN_MP_INIT_MULTI_C
-# define BN_MP_MUL_C
-# define BN_MP_SET_C
-# define BN_MP_SQR_C
+#if defined(BN_MP_LOG_N_C)
+# define BN_S_MP_LOG_2EXPT_C
+# define BN_S_MP_LOG_C
+# define BN_S_MP_LOG_D_C
#endif
#if defined(BN_MP_LSHD_C)
@@ -929,7 +906,7 @@
# define BN_MP_DIV_C
#endif
-#if defined(BN_MP_ROOT_U32_C)
+#if defined(BN_MP_ROOT_N_C)
# define BN_MP_2EXPT_C
# define BN_MP_ADD_D_C
# define BN_MP_CLEAR_MULTI_C
@@ -938,7 +915,7 @@
# define BN_MP_COUNT_BITS_C
# define BN_MP_DIV_C
# define BN_MP_EXCH_C
-# define BN_MP_EXPT_U32_C
+# define BN_MP_EXPT_N_C
# define BN_MP_INIT_MULTI_C
# define BN_MP_MUL_C
# define BN_MP_MUL_D_C
@@ -976,10 +953,6 @@
# define BN_MP_SET_UL_C
#endif
-#if defined(BN_MP_SET_LL_C)
-# define BN_MP_SET_ULL_C
-#endif
-
#if defined(BN_MP_SET_U32_C)
#endif
@@ -989,9 +962,6 @@
#if defined(BN_MP_SET_UL_C)
#endif
-#if defined(BN_MP_SET_ULL_C)
-#endif
-
#if defined(BN_MP_SHRINK_C)
#endif
@@ -1121,6 +1091,13 @@
# define BN_MP_MUL_C
#endif
+#if defined(BN_S_MP_DIV_3_C)
+# define BN_MP_CLAMP_C
+# define BN_MP_CLEAR_C
+# define BN_MP_EXCH_C
+# define BN_MP_INIT_SIZE_C
+#endif
+
#if defined(BN_S_MP_EXPTMOD_C)
# define BN_MP_CLEAR_C
# define BN_MP_COPY_C
@@ -1213,6 +1190,26 @@
# define BN_S_MP_SUB_C
#endif
+#if defined(BN_S_MP_LOG_C)
+# define BN_MP_CLEAR_MULTI_C
+# define BN_MP_CMP_C
+# define BN_MP_CMP_D_C
+# define BN_MP_COPY_C
+# define BN_MP_EXCH_C
+# define BN_MP_EXPT_N_C
+# define BN_MP_INIT_MULTI_C
+# define BN_MP_MUL_C
+# define BN_MP_SET_C
+# define BN_MP_SQR_C
+#endif
+
+#if defined(BN_S_MP_LOG_2EXPT_C)
+# define BN_MP_COUNT_BITS_C
+#endif
+
+#if defined(BN_S_MP_LOG_D_C)
+#endif
+
#if defined(BN_S_MP_MONTGOMERY_REDUCE_FAST_C)
# define BN_MP_CLAMP_C
# define BN_MP_CMP_MAG_C
@@ -1283,13 +1280,13 @@
# define BN_MP_CLEAR_C
# define BN_MP_CLEAR_MULTI_C
# define BN_MP_DIV_2_C
-# define BN_MP_DIV_3_C
# define BN_MP_INIT_MULTI_C
# define BN_MP_INIT_SIZE_C
# define BN_MP_LSHD_C
# define BN_MP_MUL_2_C
# define BN_MP_MUL_C
# define BN_MP_SUB_C
+# define BN_S_MP_DIV_3_C
#endif
#if defined(BN_S_MP_TOOM_SQR_C)
diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h
index 96ff41f..8edde83 100644
--- a/libtommath/tommath_private.h
+++ b/libtommath/tommath_private.h
@@ -156,6 +156,8 @@ typedef private_mp_word mp_word;
#define MP_MIN(x, y) (((x) < (y)) ? (x) : (y))
#define MP_MAX(x, y) (((x) > (y)) ? (x) : (y))
+#define MP_IS_2EXPT(x) (((x) != 0u) && (((x) & ((x) - 1u)) == 0u))
+
/* Static assertion */
#define MP_STATIC_ASSERT(msg, cond) typedef char mp_static_assert_##msg[(cond) ? 1 : -1];
@@ -190,8 +192,11 @@ extern "C" {
#endif
/* lowlevel functions, do not call! */
MP_PRIVATE mp_bool s_mp_get_bit(const mp_int *a, unsigned int b);
+MP_PRIVATE int s_mp_log_2expt(const mp_int *a, mp_digit base) MP_WUR;
+MP_PRIVATE int s_mp_log_d(mp_digit base, mp_digit n) MP_WUR;
MP_PRIVATE mp_err s_mp_add(const mp_int *a, const mp_int *b, mp_int *c) MP_WUR;
MP_PRIVATE mp_err s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) MP_WUR;
+MP_PRIVATE mp_err s_mp_div_3(const mp_int *a, mp_int *c, mp_digit *d) MP_WUR;
MP_PRIVATE mp_err s_mp_mul_digs_fast(const mp_int *a, const mp_int *b, mp_int *c, int digs) MP_WUR;
MP_PRIVATE mp_err s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) MP_WUR;
MP_PRIVATE mp_err s_mp_mul_high_digs_fast(const mp_int *a, const mp_int *b, mp_int *c, int digs) MP_WUR;
@@ -208,6 +213,7 @@ MP_PRIVATE mp_err s_mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c)
MP_PRIVATE mp_err s_mp_montgomery_reduce_fast(mp_int *x, const mp_int *n, mp_digit rho) MP_WUR;
MP_PRIVATE mp_err s_mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) MP_WUR;
MP_PRIVATE mp_err s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) MP_WUR;
+MP_PRIVATE mp_err s_mp_log(const mp_int *a, mp_digit base, int *c) MP_WUR;
MP_PRIVATE mp_err s_mp_rand_platform(void *p, size_t n) MP_WUR;
MP_PRIVATE mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, private_mp_prime_callback cb, void *dat);
MP_PRIVATE void s_mp_reverse(unsigned char *s, size_t len);
diff --git a/macosx/Tcl.xcode/project.pbxproj b/macosx/Tcl.xcode/project.pbxproj
index 22d728d..a829e0e 100644
--- a/macosx/Tcl.xcode/project.pbxproj
+++ b/macosx/Tcl.xcode/project.pbxproj
@@ -110,7 +110,7 @@
F96D48F408F272C3004A47F5 /* bn_mp_div.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427608F272B3004A47F5 /* bn_mp_div.c */; };
F96D48F508F272C3004A47F5 /* bn_mp_div_2.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427708F272B3004A47F5 /* bn_mp_div_2.c */; };
F96D48F608F272C3004A47F5 /* bn_mp_div_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427808F272B3004A47F5 /* bn_mp_div_2d.c */; };
- F96D48F708F272C3004A47F5 /* bn_mp_div_3.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427908F272B3004A47F5 /* bn_mp_div_3.c */; };
+ F96D48F708F272C3004A47F5 /* bn_s_mp_div_3.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427908F272B3004A47F5 /* bn_s_mp_div_3.c */; };
F96D48F808F272C3004A47F5 /* bn_mp_div_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427A08F272B3004A47F5 /* bn_mp_div_d.c */; };
F96D48FC08F272C3004A47F5 /* bn_mp_exch.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427E08F272B3004A47F5 /* bn_mp_exch.c */; };
F96D490508F272C3004A47F5 /* bn_mp_grow.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428708F272B3004A47F5 /* bn_mp_grow.c */; };
@@ -573,7 +573,7 @@
F96D427608F272B3004A47F5 /* bn_mp_div.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div.c; sourceTree = "<group>"; };
F96D427708F272B3004A47F5 /* bn_mp_div_2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_2.c; sourceTree = "<group>"; };
F96D427808F272B3004A47F5 /* bn_mp_div_2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_2d.c; sourceTree = "<group>"; };
- F96D427908F272B3004A47F5 /* bn_mp_div_3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_3.c; sourceTree = "<group>"; };
+ F96D427908F272B3004A47F5 /* bn_s_mp_div_3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_s_mp_div_3.c; sourceTree = "<group>"; };
F96D427A08F272B3004A47F5 /* bn_mp_div_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_d.c; sourceTree = "<group>"; };
F96D427E08F272B3004A47F5 /* bn_mp_exch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_exch.c; sourceTree = "<group>"; };
F96D427F08F272B3004A47F5 /* bn_mp_expt_u32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_expt_u32.c; sourceTree = "<group>"; };
@@ -1432,7 +1432,7 @@
F96D427608F272B3004A47F5 /* bn_mp_div.c */,
F96D427708F272B3004A47F5 /* bn_mp_div_2.c */,
F96D427808F272B3004A47F5 /* bn_mp_div_2d.c */,
- F96D427908F272B3004A47F5 /* bn_mp_div_3.c */,
+ F96D427908F272B3004A47F5 /* bn_s_mp_div_3.c */,
F96D427A08F272B3004A47F5 /* bn_mp_div_d.c */,
F96D427E08F272B3004A47F5 /* bn_mp_exch.c */,
F96D427F08F272B3004A47F5 /* bn_mp_expt_u32.c */,
@@ -2061,7 +2061,7 @@
F96D48F408F272C3004A47F5 /* bn_mp_div.c in Sources */,
F96D48F508F272C3004A47F5 /* bn_mp_div_2.c in Sources */,
F96D48F608F272C3004A47F5 /* bn_mp_div_2d.c in Sources */,
- F96D48F708F272C3004A47F5 /* bn_mp_div_3.c in Sources */,
+ F96D48F708F272C3004A47F5 /* bn_s_mp_div_3.c in Sources */,
F96D48F808F272C3004A47F5 /* bn_mp_div_d.c in Sources */,
F96D48FC08F272C3004A47F5 /* bn_mp_exch.c in Sources */,
F9E61D2C090A48AC002B3151 /* bn_mp_expt_u32.c in Sources */,
diff --git a/macosx/Tcl.xcodeproj/project.pbxproj b/macosx/Tcl.xcodeproj/project.pbxproj
index 212058f..c69fbfa 100644
--- a/macosx/Tcl.xcodeproj/project.pbxproj
+++ b/macosx/Tcl.xcodeproj/project.pbxproj
@@ -110,7 +110,7 @@
F96D48F408F272C3004A47F5 /* bn_mp_div.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427608F272B3004A47F5 /* bn_mp_div.c */; };
F96D48F508F272C3004A47F5 /* bn_mp_div_2.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427708F272B3004A47F5 /* bn_mp_div_2.c */; };
F96D48F608F272C3004A47F5 /* bn_mp_div_2d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427808F272B3004A47F5 /* bn_mp_div_2d.c */; };
- F96D48F708F272C3004A47F5 /* bn_mp_div_3.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427908F272B3004A47F5 /* bn_mp_div_3.c */; };
+ F96D48F708F272C3004A47F5 /* bn_s_mp_div_3.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427908F272B3004A47F5 /* bn_s_mp_div_3.c */; };
F96D48F808F272C3004A47F5 /* bn_mp_div_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427A08F272B3004A47F5 /* bn_mp_div_d.c */; };
F96D48FC08F272C3004A47F5 /* bn_mp_exch.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427E08F272B3004A47F5 /* bn_mp_exch.c */; };
F96D490508F272C3004A47F5 /* bn_mp_grow.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D428708F272B3004A47F5 /* bn_mp_grow.c */; };
@@ -164,7 +164,7 @@
F9E61D29090A486C002B3151 /* bn_mp_neg.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42A208F272B3004A47F5 /* bn_mp_neg.c */; };
F9E61D2A090A4891002B3151 /* bn_mp_sqrt.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C008F272B3004A47F5 /* bn_mp_sqrt.c */; };
F9E61D2B090A48A4002B3151 /* bn_mp_and.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D426C08F272B3004A47F5 /* bn_mp_and.c */; };
- F9E61D2C090A48AC002B3151 /* bn_mp_expt_u32.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427F08F272B3004A47F5 /* bn_mp_expt_u32.c */; };
+ F9E61D2C090A48AC002B3151 /* bn_mp_expt_n.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427F08F272B3004A47F5 /* bn_mp_expt_n.c */; };
F9E61D2D090A48BB002B3151 /* bn_mp_xor.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CD08F272B3004A47F5 /* bn_mp_xor.c */; };
F9E61D2E090A48BF002B3151 /* bn_mp_or.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42A308F272B3004A47F5 /* bn_mp_or.c */; };
F9E61D2F090A48C7002B3151 /* bn_mp_shrink.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42BC08F272B3004A47F5 /* bn_mp_shrink.c */; };
@@ -573,10 +573,10 @@
F96D427608F272B3004A47F5 /* bn_mp_div.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div.c; sourceTree = "<group>"; };
F96D427708F272B3004A47F5 /* bn_mp_div_2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_2.c; sourceTree = "<group>"; };
F96D427808F272B3004A47F5 /* bn_mp_div_2d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_2d.c; sourceTree = "<group>"; };
- F96D427908F272B3004A47F5 /* bn_mp_div_3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_3.c; sourceTree = "<group>"; };
+ F96D427908F272B3004A47F5 /* bn_s_mp_div_3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_s_mp_div_3.c; sourceTree = "<group>"; };
F96D427A08F272B3004A47F5 /* bn_mp_div_d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_div_d.c; sourceTree = "<group>"; };
F96D427E08F272B3004A47F5 /* bn_mp_exch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_exch.c; sourceTree = "<group>"; };
- F96D427F08F272B3004A47F5 /* bn_mp_expt_u32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_expt_u32.c; sourceTree = "<group>"; };
+ F96D427F08F272B3004A47F5 /* bn_mp_expt_n.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_expt_n.c; sourceTree = "<group>"; };
F96D428708F272B3004A47F5 /* bn_mp_grow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_grow.c; sourceTree = "<group>"; };
F96D428808F272B3004A47F5 /* bn_mp_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_init.c; sourceTree = "<group>"; };
F96D428908F272B3004A47F5 /* bn_mp_init_copy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bn_mp_init_copy.c; sourceTree = "<group>"; };
@@ -1432,10 +1432,10 @@
F96D427608F272B3004A47F5 /* bn_mp_div.c */,
F96D427708F272B3004A47F5 /* bn_mp_div_2.c */,
F96D427808F272B3004A47F5 /* bn_mp_div_2d.c */,
- F96D427908F272B3004A47F5 /* bn_mp_div_3.c */,
+ F96D427908F272B3004A47F5 /* bn_s_mp_div_3.c */,
F96D427A08F272B3004A47F5 /* bn_mp_div_d.c */,
F96D427E08F272B3004A47F5 /* bn_mp_exch.c */,
- F96D427F08F272B3004A47F5 /* bn_mp_expt_u32.c */,
+ F96D427F08F272B3004A47F5 /* bn_mp_expt_n.c */,
F96D428708F272B3004A47F5 /* bn_mp_grow.c */,
F96D428808F272B3004A47F5 /* bn_mp_init.c */,
F96D428908F272B3004A47F5 /* bn_mp_init_copy.c */,
@@ -2061,10 +2061,10 @@
F96D48F408F272C3004A47F5 /* bn_mp_div.c in Sources */,
F96D48F508F272C3004A47F5 /* bn_mp_div_2.c in Sources */,
F96D48F608F272C3004A47F5 /* bn_mp_div_2d.c in Sources */,
- F96D48F708F272C3004A47F5 /* bn_mp_div_3.c in Sources */,
+ F96D48F708F272C3004A47F5 /* bn_s_mp_div_3.c in Sources */,
F96D48F808F272C3004A47F5 /* bn_mp_div_d.c in Sources */,
F96D48FC08F272C3004A47F5 /* bn_mp_exch.c in Sources */,
- F9E61D2C090A48AC002B3151 /* bn_mp_expt_u32.c in Sources */,
+ F9E61D2C090A48AC002B3151 /* bn_mp_expt_n.c in Sources */,
F96D490508F272C3004A47F5 /* bn_mp_grow.c in Sources */,
F96D490608F272C3004A47F5 /* bn_mp_init.c in Sources */,
F96D490708F272C3004A47F5 /* bn_mp_init_copy.c in Sources */,
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 2ebadbb..b4d440d 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -328,7 +328,7 @@ TOMMATH_OBJS = bn_s_mp_reverse.o bn_s_mp_mul_digs_fast.o \
bn_mp_cmp.o bn_mp_cmp_d.o bn_mp_cmp_mag.o \
bn_mp_cnt_lsb.o bn_mp_copy.o \
bn_mp_count_bits.o bn_mp_div.o bn_mp_div_d.o bn_mp_div_2.o \
- bn_mp_div_2d.o bn_mp_div_3.o bn_mp_exch.o bn_mp_expt_u32.o \
+ bn_mp_div_2d.o bn_s_mp_div_3.o bn_mp_exch.o bn_mp_expt_n.o \
bn_mp_grow.o bn_mp_init.o \
bn_mp_init_copy.o bn_mp_init_multi.o bn_mp_init_set.o \
bn_mp_init_size.o bn_s_mp_karatsuba_mul.o \
@@ -504,10 +504,10 @@ TOMMATH_SRCS = \
$(TOMMATH_DIR)/bn_mp_div.c \
$(TOMMATH_DIR)/bn_mp_div_2.c \
$(TOMMATH_DIR)/bn_mp_div_2d.c \
- $(TOMMATH_DIR)/bn_mp_div_3.c \
+ $(TOMMATH_DIR)/bn_s_mp_div_3.c \
$(TOMMATH_DIR)/bn_mp_div_d.c \
$(TOMMATH_DIR)/bn_mp_exch.c \
- $(TOMMATH_DIR)/bn_mp_expt_u32.c \
+ $(TOMMATH_DIR)/bn_mp_expt_n.c \
$(TOMMATH_DIR)/bn_mp_grow.c \
$(TOMMATH_DIR)/bn_mp_init.c \
$(TOMMATH_DIR)/bn_mp_init_copy.c \
@@ -1422,14 +1422,14 @@ bn_mp_div_2.o: $(TOMMATH_DIR)/bn_mp_div_2.c $(MATHHDRS)
bn_mp_div_2d.o: $(TOMMATH_DIR)/bn_mp_div_2d.c $(MATHHDRS)
$(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_div_2d.c
-bn_mp_div_3.o: $(TOMMATH_DIR)/bn_mp_div_3.c $(MATHHDRS)
- $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_div_3.c
+bn_s_mp_div_3.o: $(TOMMATH_DIR)/bn_s_mp_div_3.c $(MATHHDRS)
+ $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_s_mp_div_3.c
bn_mp_exch.o: $(TOMMATH_DIR)/bn_mp_exch.c $(MATHHDRS)
$(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_exch.c
-bn_mp_expt_u32.o: $(TOMMATH_DIR)/bn_mp_expt_u32.c $(MATHHDRS)
- $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_expt_u32.c
+bn_mp_expt_n.o: $(TOMMATH_DIR)/bn_mp_expt_n.c $(MATHHDRS)
+ $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_expt_n.c
bn_mp_grow.o: $(TOMMATH_DIR)/bn_mp_grow.c $(MATHHDRS)
$(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_grow.c
diff --git a/win/Makefile.in b/win/Makefile.in
index 9527d9f..b9d7e6a 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -332,9 +332,9 @@ TOMMATH_OBJS = \
bn_mp_div_d.${OBJEXT} \
bn_mp_div_2.${OBJEXT} \
bn_mp_div_2d.${OBJEXT} \
- bn_mp_div_3.${OBJEXT} \
+ bn_s_mp_div_3.${OBJEXT} \
bn_mp_exch.${OBJEXT} \
- bn_mp_expt_u32.${OBJEXT} \
+ bn_mp_expt_n.${OBJEXT} \
bn_mp_grow.${OBJEXT} \
bn_mp_init.${OBJEXT} \
bn_mp_init_copy.${OBJEXT} \
diff --git a/win/makefile.vc b/win/makefile.vc
index 8d7d4cf..de7f889 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -337,9 +337,9 @@ TOMMATHOBJS = \
$(TMP_DIR)\bn_mp_div_d.obj \
$(TMP_DIR)\bn_mp_div_2.obj \
$(TMP_DIR)\bn_mp_div_2d.obj \
- $(TMP_DIR)\bn_mp_div_3.obj \
+ $(TMP_DIR)\bn_s_mp_div_3.obj \
$(TMP_DIR)\bn_mp_exch.obj \
- $(TMP_DIR)\bn_mp_expt_u32.obj \
+ $(TMP_DIR)\bn_mp_expt_n.obj \
$(TMP_DIR)\bn_mp_grow.obj \
$(TMP_DIR)\bn_mp_init.obj \
$(TMP_DIR)\bn_mp_init_copy.obj \