summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclInt.h2
-rw-r--r--generic/tclStrToD.c26
-rw-r--r--generic/tclStubInit.c16
-rw-r--r--generic/tclTomMath.decls11
-rw-r--r--generic/tclTomMath.h25
-rw-r--r--generic/tclTomMathDecls.h70
-rw-r--r--libtommath/bn_deprecated.c2
-rw-r--r--libtommath/bn_mp_fread.c4
-rw-r--r--libtommath/bn_mp_mul.c4
-rw-r--r--libtommath/bn_mp_prime_rand.c2
-rw-r--r--libtommath/bn_mp_radix_smap.c5
-rw-r--r--libtommath/bn_mp_read_radix.c4
-rw-r--r--libtommath/bn_mp_sqrt.c10
-rw-r--r--libtommath/bn_mp_to_radix.c2
-rw-r--r--libtommath/bn_prime_tab.c16
-rw-r--r--libtommath/tommath.h33
-rw-r--r--libtommath/tommath_private.h69
-rw-r--r--unix/tclUnixFile.c1
18 files changed, 101 insertions, 201 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 27137c7..2740953 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -4193,7 +4193,7 @@ MODULE_SCOPE int TclIndexEncode(Tcl_Interp *interp, Tcl_Obj *objPtr,
int before, int after, int *indexPtr);
MODULE_SCOPE int TclIndexDecode(int encoded, int endValue);
-MODULE_SCOPE void TclBN_int_reverse(unsigned char *s, size_t len);
+MODULE_SCOPE void TclBN_s_mp_reverse(unsigned char *s, size_t len);
/* Constants used in index value encoding routines. */
#define TCL_INDEX_END (-2)
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index 478c16b..d542da0 100644
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -145,7 +145,7 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
#define QUICK_MAX 14 /* floor((FP_PRECISION-1)*log(2)/log(10))-1 */
#define BLETCH 0x10 /* Highest power of two that is greater than
* DBL_MAX_10_EXP, divided by 16. */
-#define DIGIT_GROUP 8 /* floor(DIGIT_BIT*log(2)/log(10)) */
+#define DIGIT_GROUP 8 /* floor(MP_DIGIT_BIT*log(2)/log(10)) */
/*
* Union used to dismantle floating point numbers.
@@ -1485,9 +1485,9 @@ AccumulateDecimalDigit(
* More than single digit multiplication. Multiply by the appropriate
* small powers of 5, and then shift. Large strings of zeroes are
* eaten 256 at a time; this is less efficient than it could be, but
- * seems implausible. We presume that DIGIT_BIT is at least 27. The
+ * seems implausible. We presume that MP_DIGIT_BIT is at least 27. The
* first multiplication, by up to 10**7, is done with a one-DIGIT
- * multiply (this presumes that DIGIT_BIT >= 24).
+ * multiply (this presumes that MP_DIGIT_BIT >= 24).
*/
n = numZeros + 1;
@@ -3130,7 +3130,7 @@ StrictInt64Conversion(
*
* Test whether bankers' rounding should round a digit up. Assumption is
* made that the denominator of the fraction being tested is a power of
- * 2**DIGIT_BIT.
+ * 2**MP_DIGIT_BIT.
*
* Results:
* Returns 1 iff the fraction is more than 1/2, or if the fraction is
@@ -3142,7 +3142,7 @@ StrictInt64Conversion(
static inline int
ShouldBankerRoundUpPowD(
mp_int *b, /* Numerator of the fraction. */
- int sd, /* Denominator is 2**(sd*DIGIT_BIT). */
+ int sd, /* Denominator is 2**(sd*MP_DIGIT_BIT). */
int isodd) /* 1 if the digit is odd, 0 if even. */
{
int i;
@@ -3181,7 +3181,7 @@ static inline int
ShouldBankerRoundUpToNextPowD(
mp_int *b, /* Numerator of the fraction. */
mp_int *m, /* Numerator of the rounding tolerance. */
- int sd, /* Common denominator is 2**(sd*DIGIT_BIT). */
+ int sd, /* Common denominator is 2**(sd*MP_DIGIT_BIT). */
int isodd, /* 1 if the integer significand is odd. */
mp_int *temp) /* Work area for the calculation. */
{
@@ -3190,7 +3190,7 @@ ShouldBankerRoundUpToNextPowD(
/*
* Compare B and S-m - which is the same as comparing B+m and S - which we
* do by computing b+m and doing a bitwhack compare against
- * 2**(DIGIT_BIT*sd)
+ * 2**(MP_DIGIT_BIT*sd)
*/
mp_add(b, m, temp);
@@ -3218,7 +3218,7 @@ ShouldBankerRoundUpToNextPowD(
* Converts a double-precision number to the shortest string of digits
* that reconverts exactly to the given number, or to 'ilim' digits if
* that will yield a shorter result. The denominator in David Gay's
- * conversion algorithm is known to be a power of 2**DIGIT_BIT, and hence
+ * conversion algorithm is known to be a power of 2**MP_DIGIT_BIT, and hence
* the division in the main loop may be replaced by a digit shift and
* mask.
*
@@ -3298,7 +3298,7 @@ ShorteningBignumConversionPowD(
mp_init(&temp);
/*
- * Loop through the digits. Do division and mod by s == 2**(sd*DIGIT_BIT)
+ * Loop through the digits. Do division and mod by s == 2**(sd*MP_DIGIT_BIT)
* by mp_digit extraction.
*/
@@ -3410,7 +3410,7 @@ ShorteningBignumConversionPowD(
* Converts a double-precision number to a fixed-lengt string of 'ilim'
* digits (or 'ilim1' if log10(d) has been overestimated). The
* denominator in David Gay's conversion algorithm is known to be a power
- * of 2**DIGIT_BIT, and hence the division in the main loop may be
+ * of 2**MP_DIGIT_BIT, and hence the division in the main loop may be
* replaced by a digit shift and mask.
*
* Results:
@@ -3468,7 +3468,7 @@ StrictBignumConversionPowD(
}
/*
- * Loop through the digits. Do division and mod by s == 2**(sd*DIGIT_BIT)
+ * Loop through the digits. Do division and mod by s == 2**(sd*MP_DIGIT_BIT)
* by mp_digit extraction.
*/
@@ -4211,7 +4211,7 @@ TclDoubleDigits(
} else if (s5 == 0) {
/*
* The denominator is a power of 2, so we can replace division by
- * digit shifts. First we round up s2 to a multiple of DIGIT_BIT,
+ * digit shifts. First we round up s2 to a multiple of MP_DIGIT_BIT,
* and adjust m2 and b2 accordingly. Then we launch into a version
* of the comparison that's specialized for the 'power of mp_digit
* in the denominator' case.
@@ -4267,7 +4267,7 @@ TclDoubleDigits(
} else if (s5 == 0) {
/*
* The denominator is a power of 2, so we can replace division by
- * digit shifts. First we round up s2 to a multiple of DIGIT_BIT,
+ * digit shifts. First we round up s2 to a multiple of MP_DIGIT_BIT,
* and adjust m2 and b2 accordingly. Then we launch into a version
* of the comparison that's specialized for the 'power of mp_digit
* in the denominator' case.
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 89f59c2..76f0230 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -103,6 +103,7 @@ static mp_err TclBN_mp_set_long(mp_int *a, unsigned long i)
# define TclBN_mp_expt_d_ex 0
# define TclBN_mp_to_unsigned_bin 0
# define TclBN_mp_to_unsigned_bin_n 0
+# define TclBN_mp_toradix_n 0
# define TclSetStartupScriptPath 0
# define TclGetStartupScriptPath 0
# define TclSetStartupScriptFileName 0
@@ -479,8 +480,8 @@ static int uniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsig
# undef Tcl_StringMatch
# define Tcl_StringMatch 0
# define TclBN_reverse 0
-# define TclBN_fast_s_mp_mul_digs 0
-# define TclBN_fast_s_mp_sqr 0
+# define TclBN_s_mp_mul_digs_fast 0
+# define TclBN_s_mp_sqr_fast 0
# define TclBN_mp_karatsuba_mul 0
# define TclBN_mp_karatsuba_sqr 0
# define TclBN_mp_toom_mul 0
@@ -534,9 +535,6 @@ tellOld(
#define Tcl_WinTCharToUtf 0
#endif
-#undef TclBN_mp_unsigned_bin_size
-#define TclBN_mp_unsigned_bin_size (int (*)(const mp_int *a)) mp_ubin_size
-
/*
* WARNING: The contents of this file is automatically generated by the
* tools/genStubs.tcl script. Any modifications to the function declarations
@@ -988,12 +986,12 @@ const TclTomMathStubs tclTomMathStubs = {
TclBN_mp_to_unsigned_bin, /* 44 */
TclBN_mp_to_unsigned_bin_n, /* 45 */
TclBN_mp_toradix_n, /* 46 */
- TclBN_mp_unsigned_bin_size, /* 47 */
+ TclBN_mp_ubin_size, /* 47 */
TclBN_mp_xor, /* 48 */
TclBN_mp_zero, /* 49 */
TclBN_reverse, /* 50 */
- TclBN_fast_s_mp_mul_digs, /* 51 */
- TclBN_fast_s_mp_sqr, /* 52 */
+ TclBN_s_mp_mul_digs_fast, /* 51 */
+ TclBN_s_mp_sqr_fast, /* 52 */
TclBN_mp_karatsuba_mul, /* 53 */
TclBN_mp_karatsuba_sqr, /* 54 */
TclBN_mp_toom_mul, /* 55 */
@@ -1020,7 +1018,7 @@ const TclTomMathStubs tclTomMathStubs = {
TclBN_mp_signed_rsh, /* 76 */
TclBN_mp_get_bit, /* 77 */
TclBN_mp_to_ubin, /* 78 */
- TclBN_mp_ubin_size, /* 79 */
+ 0, /* 79 */
TclBN_mp_to_radix, /* 80 */
};
diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls
index 9f7db14..89751bd 100644
--- a/generic/tclTomMath.decls
+++ b/generic/tclTomMath.decls
@@ -165,8 +165,8 @@ declare 45 {deprecated {Use mp_to_ubin}} {
declare 46 {deprecated {Use mp_to_radix}} {
mp_err TclBN_mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen)
}
-declare 47 {deprecated {Use mp_ubin_size}} {
- int TclBN_mp_unsigned_bin_size(const mp_int *a)
+declare 47 {
+ size_t TclBN_mp_ubin_size(const mp_int *a)
}
declare 48 {
mp_err MP_WUR TclBN_mp_xor(const mp_int *a, const mp_int *b, mp_int *c)
@@ -182,10 +182,10 @@ declare 50 {deprecated {is private function in libtommath}} {
void TclBN_reverse(unsigned char *s, int len)
}
declare 51 {deprecated {is private function in libtommath}} {
- mp_err TclBN_fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
+ mp_err TclBN_s_mp_mul_digs_fast(const mp_int *a, const mp_int *b, mp_int *c, int digs)
}
declare 52 {deprecated {is private function in libtommath}} {
- mp_err TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b)
+ mp_err TclBN_s_mp_sqr_fast(const mp_int *a, mp_int *b)
}
declare 53 {deprecated {is private function in libtommath}} {
mp_err TclBN_mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c)
@@ -272,9 +272,6 @@ declare 77 {deprecated {is private function in libtommath}} {
declare 78 {
int MP_WUR TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written)
}
-declare 79 {
- size_t MP_WUR TclBN_mp_ubin_size(const mp_int *a)
-}
declare 80 {
int MP_WUR TclBN_mp_to_radix(const mp_int *a, char *str, size_t maxlen, size_t *written, int radix)
}
diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h
index 9afa10f..618e555 100644
--- a/generic/tclTomMath.h
+++ b/generic/tclTomMath.h
@@ -41,7 +41,6 @@ extern "C" {
/* some default configurations.
*
* A "mp_digit" must be able to hold MP_DIGIT_BIT + 1 bits
- * A "mp_word" must be able to hold 2*MP_DIGIT_BIT + 1 bits
*
* At the very least a mp_digit must be able to hold 7 bits
* [any size beyond that is ok provided it doesn't overflow the data type]
@@ -52,7 +51,6 @@ extern "C" {
typedef unsigned char mp_digit;
#define MP_DIGIT_DECLARED
#endif
-typedef unsigned short mp_word;
# define MP_SIZEOF_MP_DIGIT 1
# ifdef MP_DIGIT_BIT
# error You must not define MP_DIGIT_BIT when using MP_8BIT
@@ -62,7 +60,6 @@ typedef unsigned short mp_word;
typedef unsigned short mp_digit;
#define MP_DIGIT_DECLARED
#endif
-typedef unsigned int mp_word;
# define MP_SIZEOF_MP_DIGIT 2
# ifdef MP_DIGIT_BIT
# error You must not define MP_DIGIT_BIT when using MP_16BIT
@@ -73,7 +70,6 @@ typedef unsigned int mp_word;
typedef unsigned long long mp_digit;
#define MP_DIGIT_DECLARED
#endif
-typedef unsigned long mp_word __attribute__((mode(TI)));
# define MP_DIGIT_BIT 60
#else
/* this is the default case, 28-bit digits */
@@ -83,11 +79,6 @@ typedef unsigned long mp_word __attribute__((mode(TI)));
typedef unsigned int mp_digit;
#define MP_DIGIT_DECLARED
#endif
-#ifdef _WIN32
-typedef unsigned __int64 mp_word;
-#else
-typedef unsigned long long mp_word;
-#endif
# ifdef MP_31BIT
/*
@@ -204,9 +195,6 @@ TOOM_SQR_CUTOFF;
# endif
#endif
-/* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */
-#define PRIVATE_MP_WARRAY (int)(1 << (((CHAR_BIT * sizeof(mp_word)) - (2 * MP_DIGIT_BIT)) + 1))
-
#if defined(__GNUC__) && __GNUC__ >= 4
# define MP_NULL_TERMINATED __attribute__((sentinel))
#else
@@ -264,10 +252,6 @@ struct mp_int {
mp_digit *dp;
};
-/* callback for mp_prime_random, should fill dst with random bytes and return how many read [upto len] */
-typedef int private_mp_prime_callback(unsigned char *dst, int len, void *dat);
-typedef private_mp_prime_callback MP_DEPRECATED(mp_rand_source) ltm_prime_callback;
-
/* error code to char* string */
/*
const char *mp_error_to_string(mp_err code) MP_WUR;
@@ -896,11 +880,6 @@ mp_err mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y)
#endif
#define PRIME_SIZE (MP_DEPRECATED_PRAGMA("PRIME_SIZE has been made internal") PRIVATE_MP_PRIME_TAB_SIZE)
-/* table of first PRIME_SIZE primes */
-#if defined(BUILD_tcl) || !defined(_WIN32)
-MODULE_SCOPE const mp_digit ltm_prime_tab[PRIVATE_MP_PRIME_TAB_SIZE];
-#endif
-
/* result=1 if a is divisible by one of the first PRIME_SIZE primes */
/*
MP_DEPRECATED(mp_prime_is_prime) mp_err mp_prime_is_divisible(const mp_int *a, mp_bool *result) MP_WUR;
@@ -993,10 +972,6 @@ mp_err mp_prime_next_prime(mp_int *a, int t, int bbs_style) MP_WUR;
*
*/
/*
-MP_DEPRECATED(mp_prime_rand) mp_err mp_prime_random_ex(mp_int *a, int t, int size, int flags,
- 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;
*/
diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h
index 1460f1c..811727d 100644
--- a/generic/tclTomMathDecls.h
+++ b/generic/tclTomMathDecls.h
@@ -51,11 +51,6 @@
/* Rename the global symbols in libtommath to avoid linkage conflicts */
#define bn_reverse TclBN_reverse
-#define s_mp_reverse TclBN_int_reverse
-#define fast_s_mp_mul_digs TclBN_fast_s_mp_mul_digs
-#define s_mp_mul_digs_fast TclBN_fast_s_mp_mul_digs
-#define fast_s_mp_sqr TclBN_fast_s_mp_sqr
-#define s_mp_sqr_fast TclBN_fast_s_mp_sqr
#define mp_add TclBN_mp_add
#define mp_add_d TclBN_mp_add_d
#define mp_and TclBN_mp_and
@@ -78,24 +73,16 @@
#define mp_expt_d_ex TclBN_mp_expt_d_ex
#define mp_expt_u32 TclBN_mp_expt_u32
#define mp_get_bit TclBN_mp_get_bit
-#define mp_get_long TclBN_mp_get_mag_ul
#define mp_get_mag_ul TclBN_mp_get_mag_ul
-#define mp_get_long_long TclBN_mp_get_mag_ull
#define mp_get_mag_ull TclBN_mp_get_mag_ull
#define mp_grow TclBN_mp_grow
-#define s_mp_get_bit TclBN_mp_get_bit
-#define mp_grow TclBN_mp_grow
#define mp_init TclBN_mp_init
#define mp_init_copy TclBN_mp_init_copy
#define mp_init_multi TclBN_mp_init_multi
#define mp_init_set TclBN_mp_init_set
-#define mp_init_set_int(a,i) TclBN_mp_init_ul(a,(unsigned int)(i))
+#define mp_init_set_int(a,i) (MP_DEPRECATED_PRAGMA("replaced by mp_init_ul") TclBN_mp_init_ul(a,(unsigned int)(i)))
#define mp_init_size TclBN_mp_init_size
#define mp_init_ul TclBN_mp_init_ul
-#define mp_karatsuba_mul TclBN_mp_karatsuba_mul
-#define s_mp_karatsuba_mul TclBN_mp_karatsuba_mul
-#define mp_karatsuba_sqr TclBN_mp_karatsuba_sqr
-#define s_mp_karatsuba_sqr TclBN_mp_karatsuba_sqr
#define mp_isodd TclBN_mp_isodd
#define mp_lshd TclBN_mp_lshd
#define mp_mod TclBN_mp_mod
@@ -110,9 +97,9 @@
#define mp_read_radix TclBN_mp_read_radix
#define mp_rshd TclBN_mp_rshd
#define mp_set TclBN_mp_set
-#define mp_set_int(a,b) (TclBN_mp_set_ul((a),((unsigned int)(b))),MP_OKAY)
-#define mp_set_long(a,b) (TclBN_mp_set_ul((a),(b)),MP_OKAY)
-#define mp_set_long_long(a,b) (TclBN_mp_set_ull((a),(b)),MP_OKAY)
+#define mp_set_int(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_ul") (TclBN_mp_set_ul((a),((unsigned int)(b))),MP_OKAY))
+#define mp_set_long(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_ul") (TclBN_mp_set_ul((a),(b)),MP_OKAY))
+#define mp_set_long_long(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_ull") (TclBN_mp_set_ull((a),(b)),MP_OKAY))
#define mp_set_ul TclBN_mp_set_ul
#define mp_set_ull TclBN_mp_set_ull
#define mp_shrink TclBN_mp_shrink
@@ -127,22 +114,26 @@
#define mp_tc_xor TclBN_mp_xor
#define mp_to_unsigned_bin TclBN_mp_to_unsigned_bin
#define mp_to_unsigned_bin_n TclBN_mp_to_unsigned_bin_n
-#define mp_toom_mul TclBN_mp_toom_mul
-#define s_mp_toom_mul TclBN_mp_toom_mul
-#define s_mp_balance_mul TclBN_mp_balance_mul
-#define mp_toom_sqr TclBN_mp_toom_sqr
-#define s_mp_toom_sqr TclBN_mp_toom_sqr
#define mp_toradix_n TclBN_mp_toradix_n
#define mp_to_radix TclBN_mp_to_radix
#define mp_to_ubin TclBN_mp_to_ubin
#define mp_ubin_size TclBN_mp_ubin_size
-#define mp_unsigned_bin_size TclBN_mp_unsigned_bin_size
+#define mp_unsigned_bin_size(mp) (MP_DEPRECATED_PRAGMA("replaced by mp_ubin_size") (int)TclBN_mp_ubin_size(mp))
#define mp_xor TclBN_mp_xor
#define mp_zero TclBN_mp_zero
#define s_mp_add TclBN_s_mp_add
+#define s_mp_balance_mul TclBN_mp_balance_mul
+#define s_mp_get_bit TclBN_mp_get_bit
+#define s_mp_karatsuba_mul TclBN_mp_karatsuba_mul
+#define s_mp_karatsuba_sqr TclBN_mp_karatsuba_sqr
#define s_mp_mul_digs TclBN_s_mp_mul_digs
+#define s_mp_mul_digs_fast TclBN_s_mp_mul_digs_fast
+#define s_mp_reverse TclBN_s_mp_reverse
#define s_mp_sqr TclBN_s_mp_sqr
+#define s_mp_sqr_fast TclBN_s_mp_sqr_fast
#define s_mp_sub TclBN_s_mp_sub
+#define s_mp_toom_mul TclBN_mp_toom_mul
+#define s_mp_toom_sqr TclBN_mp_toom_sqr
#undef TCL_STORAGE_CLASS
#ifdef BUILD_tcl
@@ -288,8 +279,7 @@ TCL_DEPRECATED("Use mp_to_radix")
mp_err TclBN_mp_toradix_n(const mp_int *a, char *str,
int radix, int maxlen);
/* 47 */
-TCL_DEPRECATED("Use mp_ubin_size")
-int TclBN_mp_unsigned_bin_size(const mp_int *a);
+EXTERN size_t TclBN_mp_ubin_size(const mp_int *a);
/* 48 */
EXTERN mp_err TclBN_mp_xor(const mp_int *a, const mp_int *b,
mp_int *c) MP_WUR;
@@ -300,11 +290,11 @@ TCL_DEPRECATED("is private function in libtommath")
void TclBN_reverse(unsigned char *s, int len);
/* 51 */
TCL_DEPRECATED("is private function in libtommath")
-mp_err TclBN_fast_s_mp_mul_digs(const mp_int *a,
+mp_err TclBN_s_mp_mul_digs_fast(const mp_int *a,
const mp_int *b, mp_int *c, int digs);
/* 52 */
TCL_DEPRECATED("is private function in libtommath")
-mp_err TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b);
+mp_err TclBN_s_mp_sqr_fast(const mp_int *a, mp_int *b);
/* 53 */
TCL_DEPRECATED("is private function in libtommath")
mp_err TclBN_mp_karatsuba_mul(const mp_int *a,
@@ -382,8 +372,7 @@ mp_bool TclBN_mp_get_bit(const mp_int *a, unsigned int b);
/* 78 */
EXTERN int TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf,
size_t maxlen, size_t *written) MP_WUR;
-/* 79 */
-EXTERN size_t TclBN_mp_ubin_size(const mp_int *a) MP_WUR;
+/* Slot 79 is reserved */
/* 80 */
EXTERN int TclBN_mp_to_radix(const mp_int *a, char *str,
size_t maxlen, size_t *written, int radix) MP_WUR;
@@ -439,12 +428,12 @@ typedef struct TclTomMathStubs {
TCL_DEPRECATED_API("Use mp_to_ubin") mp_err (*tclBN_mp_to_unsigned_bin) (const mp_int *a, unsigned char *b); /* 44 */
TCL_DEPRECATED_API("Use mp_to_ubin") mp_err (*tclBN_mp_to_unsigned_bin_n) (const mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */
TCL_DEPRECATED_API("Use mp_to_radix") mp_err (*tclBN_mp_toradix_n) (const mp_int *a, char *str, int radix, int maxlen); /* 46 */
- TCL_DEPRECATED_API("Use mp_ubin_size") int (*tclBN_mp_unsigned_bin_size) (const mp_int *a); /* 47 */
+ size_t (*tclBN_mp_ubin_size) (const mp_int *a); /* 47 */
mp_err (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; /* 48 */
void (*tclBN_mp_zero) (mp_int *a); /* 49 */
TCL_DEPRECATED_API("is private function in libtommath") void (*tclBN_reverse) (unsigned char *s, int len); /* 50 */
- TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_fast_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 51 */
- TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_fast_s_mp_sqr) (const mp_int *a, mp_int *b); /* 52 */
+ TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_s_mp_mul_digs_fast) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 51 */
+ TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_s_mp_sqr_fast) (const mp_int *a, mp_int *b); /* 52 */
TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_mp_karatsuba_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 53 */
TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_mp_karatsuba_sqr) (const mp_int *a, mp_int *b); /* 54 */
TCL_DEPRECATED_API("is private function in libtommath") mp_err (*tclBN_mp_toom_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 55 */
@@ -471,7 +460,7 @@ typedef struct TclTomMathStubs {
mp_err (*tclBN_mp_signed_rsh) (const mp_int *a, int b, mp_int *c) MP_WUR; /* 76 */
TCL_DEPRECATED_API("is private function in libtommath") mp_bool (*tclBN_mp_get_bit) (const mp_int *a, unsigned int b); /* 77 */
int (*tclBN_mp_to_ubin) (const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written) MP_WUR; /* 78 */
- size_t (*tclBN_mp_ubin_size) (const mp_int *a) MP_WUR; /* 79 */
+ void (*reserved79)(void);
int (*tclBN_mp_to_radix) (const mp_int *a, char *str, size_t maxlen, size_t *written, int radix) MP_WUR; /* 80 */
} TclTomMathStubs;
@@ -581,18 +570,18 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
(tclTomMathStubsPtr->tclBN_mp_to_unsigned_bin_n) /* 45 */
#define TclBN_mp_toradix_n \
(tclTomMathStubsPtr->tclBN_mp_toradix_n) /* 46 */
-#define TclBN_mp_unsigned_bin_size \
- (tclTomMathStubsPtr->tclBN_mp_unsigned_bin_size) /* 47 */
+#define TclBN_mp_ubin_size \
+ (tclTomMathStubsPtr->tclBN_mp_ubin_size) /* 47 */
#define TclBN_mp_xor \
(tclTomMathStubsPtr->tclBN_mp_xor) /* 48 */
#define TclBN_mp_zero \
(tclTomMathStubsPtr->tclBN_mp_zero) /* 49 */
#define TclBN_reverse \
(tclTomMathStubsPtr->tclBN_reverse) /* 50 */
-#define TclBN_fast_s_mp_mul_digs \
- (tclTomMathStubsPtr->tclBN_fast_s_mp_mul_digs) /* 51 */
-#define TclBN_fast_s_mp_sqr \
- (tclTomMathStubsPtr->tclBN_fast_s_mp_sqr) /* 52 */
+#define TclBN_s_mp_mul_digs_fast \
+ (tclTomMathStubsPtr->tclBN_s_mp_mul_digs_fast) /* 51 */
+#define TclBN_s_mp_sqr_fast \
+ (tclTomMathStubsPtr->tclBN_s_mp_sqr_fast) /* 52 */
#define TclBN_mp_karatsuba_mul \
(tclTomMathStubsPtr->tclBN_mp_karatsuba_mul) /* 53 */
#define TclBN_mp_karatsuba_sqr \
@@ -644,8 +633,7 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
(tclTomMathStubsPtr->tclBN_mp_get_bit) /* 77 */
#define TclBN_mp_to_ubin \
(tclTomMathStubsPtr->tclBN_mp_to_ubin) /* 78 */
-#define TclBN_mp_ubin_size \
- (tclTomMathStubsPtr->tclBN_mp_ubin_size) /* 79 */
+/* Slot 79 is reserved */
#define TclBN_mp_to_radix \
(tclTomMathStubsPtr->tclBN_mp_to_radix) /* 80 */
diff --git a/libtommath/bn_deprecated.c b/libtommath/bn_deprecated.c
index 456f8a2..873414e 100644
--- a/libtommath/bn_deprecated.c
+++ b/libtommath/bn_deprecated.c
@@ -25,7 +25,7 @@ mp_err mp_jacobi(const mp_int *a, const mp_int *n, int *c)
}
#endif
#ifdef BN_MP_PRIME_RANDOM_EX_C
-mp_err mp_prime_random_ex(mp_int *a, int t, int size, int flags, private_mp_prime_callback cb, void *dat)
+mp_err mp_prime_random_ex(mp_int *a, int t, int size, int flags, mp_prime_callback cb, void *dat)
{
return s_mp_prime_random_ex(a, t, size, flags, cb, dat);
}
diff --git a/libtommath/bn_mp_fread.c b/libtommath/bn_mp_fread.c
index 52ea773..1e5ecf7 100644
--- a/libtommath/bn_mp_fread.c
+++ b/libtommath/bn_mp_fread.c
@@ -30,11 +30,11 @@ mp_err mp_fread(mp_int *a, int radix, FILE *stream)
do {
int y;
unsigned pos = (unsigned)(ch - (int)'(');
- if (mp_s_rmap_reverse_sz < pos) {
+ if (MP_RMAP_REVERSE_SIZE < pos) {
break;
}
- y = (int)mp_s_rmap_reverse[pos];
+ y = (int)s_mp_rmap_reverse[pos];
if ((y == 0xff) || (y >= radix)) {
break;
diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c
index c5e0438..c76b97d 100644
--- a/libtommath/bn_mp_mul.c
+++ b/libtommath/bn_mp_mul.c
@@ -17,7 +17,7 @@ mp_err mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
* The bigger one needs to be at least about one MP_KARATSUBA_MUL_CUTOFF bigger
* to make some sense, but it depends on architecture, OS, position of the
* stars... so YMMV.
- * Using it to cut the input into slices small enough for fast_s_mp_mul_digs
+ * Using it to cut the input into slices small enough for s_mp_mul_digs_fast
* was actually slower on the author's machine, but YMMV.
*/
(min_len >= MP_KARATSUBA_MUL_CUTOFF) &&
@@ -35,7 +35,7 @@ mp_err mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
/* can we use the fast multiplier?
*
* The fast multiplier can be used if the output will
- * have less than MP_WARRAY digits and the number of
+ * have less than PRIVATE_MP_WARRAY digits and the number of
* digits won't affect carry propagation
*/
(digs < PRIVATE_MP_WARRAY) &&
diff --git a/libtommath/bn_mp_prime_rand.c b/libtommath/bn_mp_prime_rand.c
index 4530e9a..af19d76 100644
--- a/libtommath/bn_mp_prime_rand.c
+++ b/libtommath/bn_mp_prime_rand.c
@@ -18,7 +18,7 @@
*/
/* This is possibly the mother of all prime generation functions, muahahahahaha! */
-mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, private_mp_prime_callback cb, void *dat)
+mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, mp_prime_callback cb, void *dat)
{
unsigned char *tmp, maskAND, maskOR_msb, maskOR_lsb;
int bsize, maskOR_msb_offset;
diff --git a/libtommath/bn_mp_radix_smap.c b/libtommath/bn_mp_radix_smap.c
index eb4765a..5147c74 100644
--- a/libtommath/bn_mp_radix_smap.c
+++ b/libtommath/bn_mp_radix_smap.c
@@ -4,8 +4,8 @@
/* SPDX-License-Identifier: Unlicense */
/* chars used in radix conversions */
-const char *const mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";
-const unsigned char mp_s_rmap_reverse[] = {
+const char s_mp_rmap[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";
+const unsigned char s_mp_rmap_reverse[] = {
0xff, 0xff, 0xff, 0x3e, 0xff, 0xff, 0xff, 0x3f, /* ()*+,-./ */
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 01234567 */
0x08, 0x09, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 89:;<=>? */
@@ -18,5 +18,4 @@ const unsigned char mp_s_rmap_reverse[] = {
0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, /* pqrstuvw */
0x3b, 0x3c, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, /* xyz{|}~. */
};
-const size_t mp_s_rmap_reverse_sz = sizeof(mp_s_rmap_reverse);
#endif
diff --git a/libtommath/bn_mp_read_radix.c b/libtommath/bn_mp_read_radix.c
index de18e06..456a387 100644
--- a/libtommath/bn_mp_read_radix.c
+++ b/libtommath/bn_mp_read_radix.c
@@ -43,10 +43,10 @@ mp_err mp_read_radix(mp_int *a, const char *str, int radix)
*/
ch = (radix <= 36) ? (char)MP_TOUPPER((int)*str) : *str;
pos = (unsigned)(ch - '(');
- if (mp_s_rmap_reverse_sz < pos) {
+ if (MP_RMAP_REVERSE_SIZE < pos) {
break;
}
- y = (int)mp_s_rmap_reverse[pos];
+ y = (int)s_mp_rmap_reverse[pos];
/* if the char was found in the map
* and is less than the given radix add it
diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c
index aaeac1d..4481d3a 100644
--- a/libtommath/bn_mp_sqrt.c
+++ b/libtommath/bn_mp_sqrt.c
@@ -5,7 +5,7 @@
#ifndef NO_FLOATING_POINT
#include <math.h>
-#if (DIGIT_BIT != 28) || (FLT_RADIX != 2) || (DBL_MANT_DIG != 53) || (DBL_MAX_EXP != 1024)
+#if (MP_DIGIT_BIT != 28) || (FLT_RADIX != 2) || (DBL_MANT_DIG != 53) || (DBL_MAX_EXP != 1024)
#define NO_FLOATING_POINT
#endif
#endif
@@ -52,7 +52,7 @@ mp_err mp_sqrt(const mp_int *arg, mp_int *ret)
d = 0.0;
for (k = arg->used-1; k >= j; --k) {
- d = ldexp(d, DIGIT_BIT) + (double)(arg->dp[k]);
+ d = ldexp(d, MP_DIGIT_BIT) + (double)(arg->dp[k]);
}
/*
@@ -64,18 +64,18 @@ mp_err mp_sqrt(const mp_int *arg, mp_int *ret)
/* dig is the most significant mp_digit of the square root */
- dig = (mp_digit) ldexp(d, -DIGIT_BIT);
+ dig = (mp_digit) ldexp(d, -MP_DIGIT_BIT);
/*
* If the most significant digit is nonzero, find the next digit down
- * by subtracting DIGIT_BIT times thie most significant digit.
+ * by subtracting MP_DIGIT_BIT times thie most significant digit.
* Subtract one from the result so that our initial estimate is always
* low.
*/
if (dig) {
t1.used = i+2;
- d -= ldexp((double) dig, DIGIT_BIT);
+ d -= ldexp((double) dig, MP_DIGIT_BIT);
if (d >= 1.0) {
t1.dp[i+1] = dig;
t1.dp[i] = ((mp_digit) d) - 1;
diff --git a/libtommath/bn_mp_to_radix.c b/libtommath/bn_mp_to_radix.c
index 7fa86ca..18cb504 100644
--- a/libtommath/bn_mp_to_radix.c
+++ b/libtommath/bn_mp_to_radix.c
@@ -60,7 +60,7 @@ mp_err mp_to_radix(const mp_int *a, char *str, size_t maxlen, size_t *written, i
if ((err = mp_div_d(&t, (mp_digit)radix, &t, &d)) != MP_OKAY) {
goto LBL_ERR;
}
- *str++ = mp_s_rmap[d];
+ *str++ = s_mp_rmap[d];
++digs;
}
/* reverse the digits of the string. In this case _s points
diff --git a/libtommath/bn_prime_tab.c b/libtommath/bn_prime_tab.c
index a6c07f8..6bd53fe 100644
--- a/libtommath/bn_prime_tab.c
+++ b/libtommath/bn_prime_tab.c
@@ -3,7 +3,7 @@
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
-const mp_digit ltm_prime_tab[] = {
+const mp_digit s_mp_prime_tab[] = {
0x0002, 0x0003, 0x0005, 0x0007, 0x000B, 0x000D, 0x0011, 0x0013,
0x0017, 0x001D, 0x001F, 0x0025, 0x0029, 0x002B, 0x002F, 0x0035,
0x003B, 0x003D, 0x0043, 0x0047, 0x0049, 0x004F, 0x0053, 0x0059,
@@ -44,18 +44,4 @@ const mp_digit ltm_prime_tab[] = {
#endif
};
-#if defined(__GNUC__) && __GNUC__ >= 4
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-const mp_digit *s_mp_prime_tab = ltm_prime_tab;
-#pragma GCC diagnostic pop
-#elif defined(_MSC_VER) && _MSC_VER >= 1500
-#pragma warning(push)
-#pragma warning(disable: 4996)
-const mp_digit *s_mp_prime_tab = ltm_prime_tab;
-#pragma warning(pop)
-#else
-const mp_digit *s_mp_prime_tab = ltm_prime_tab;
-#endif
-
#endif
diff --git a/libtommath/tommath.h b/libtommath/tommath.h
index 63f8190..82330c3 100644
--- a/libtommath/tommath.h
+++ b/libtommath/tommath.h
@@ -61,7 +61,6 @@ extern "C" {
/* some default configurations.
*
* A "mp_digit" must be able to hold MP_DIGIT_BIT + 1 bits
- * A "mp_word" must be able to hold 2*MP_DIGIT_BIT + 1 bits
*
* At the very least a mp_digit must be able to hold 7 bits
* [any size beyond that is ok provided it doesn't overflow the data type]
@@ -69,22 +68,16 @@ extern "C" {
#ifdef MP_8BIT
typedef unsigned char mp_digit;
-typedef unsigned short mp_word;
# define MP_DIGIT_BIT 7
#elif defined(MP_16BIT)
typedef unsigned short mp_digit;
-typedef unsigned int mp_word;
# define MP_DIGIT_BIT 15
#elif defined(MP_64BIT)
/* for GCC only on supported platforms */
typedef Tcl_WideUInt mp_digit;
-#if defined(__GNUC__)
-typedef unsigned long mp_word __attribute__((mode(TI)));
-#endif
# define MP_DIGIT_BIT 60
#else
typedef unsigned int mp_digit;
-typedef Tcl_WideUInt mp_word;
# ifdef MP_31BIT
/*
* This is an extension that uses 31-bit digits.
@@ -191,9 +184,6 @@ TOOM_SQR_CUTOFF;
# define MP_PREC (MP_DEPRECATED_PRAGMA("MP_PREC is an internal macro") PRIVATE_MP_PREC)
#endif
-/* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */
-#define PRIVATE_MP_WARRAY (int)(1 << (((CHAR_BIT * (int)sizeof(mp_word)) - (2 * MP_DIGIT_BIT)) + 1))
-
#if defined(__GNUC__) && __GNUC__ >= 4
# define MP_NULL_TERMINATED __attribute__((sentinel))
#else
@@ -247,10 +237,6 @@ typedef struct {
mp_digit *dp;
} mp_int;
-/* callback for mp_prime_random, should fill dst with random bytes and return how many read [upto len] */
-typedef int private_mp_prime_callback(unsigned char *dst, int len, void *dat);
-typedef private_mp_prime_callback MP_DEPRECATED(mp_rand_source) ltm_prime_callback;
-
/* error code to char* string */
const char *mp_error_to_string(mp_err code) MP_WUR;
@@ -627,12 +613,6 @@ mp_err mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y)
#endif
#define PRIME_SIZE (MP_DEPRECATED_PRAGMA("PRIME_SIZE has been made internal") PRIVATE_MP_PRIME_TAB_SIZE)
-/* table of first PRIME_SIZE primes */
-MP_DEPRECATED(internal) extern const mp_digit ltm_prime_tab[PRIVATE_MP_PRIME_TAB_SIZE];
-
-/* result=1 if a is divisible by one of the first PRIME_SIZE primes */
-MP_DEPRECATED(mp_prime_is_prime) mp_err mp_prime_is_divisible(const mp_int *a, mp_bool *result) MP_WUR;
-
/* performs one Fermat test of "a" using base "b".
* Sets result to 0 if composite or 1 if probable prime
*/
@@ -681,17 +661,6 @@ mp_err mp_prime_is_prime(const mp_int *a, int t, mp_bool *result) MP_WUR;
*/
mp_err mp_prime_next_prime(mp_int *a, int t, int bbs_style) MP_WUR;
-/* makes a truly random prime of a given size (bytes),
- * call with bbs = 1 if you want it to be congruent to 3 mod 4
- *
- * You have to supply a callback which fills in a buffer with random bytes. "dat" is a parameter you can
- * have passed to the callback (e.g. a state or something). This function doesn't use "dat" itself
- * so it can be NULL
- *
- * The prime generated will be larger than 2^(8*size).
- */
-#define mp_prime_random(a, t, size, bbs, cb, dat) (MP_DEPRECATED_PRAGMA("mp_prime_random has been deprecated, use mp_prime_rand instead") mp_prime_random_ex(a, t, ((size) * 8) + 1, (bbs==1)?MP_PRIME_BBS:0, cb, dat))
-
/* makes a truly random prime of a given size (bits),
*
* Flags are as follows:
@@ -705,8 +674,6 @@ mp_err mp_prime_next_prime(mp_int *a, int t, int bbs_style) MP_WUR;
* so it can be NULL
*
*/
-MP_DEPRECATED(mp_prime_rand) mp_err mp_prime_random_ex(mp_int *a, int t, int size, int flags,
- 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 */
diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h
index 29607d4..61d382d 100644
--- a/libtommath/tommath_private.h
+++ b/libtommath/tommath_private.h
@@ -1,11 +1,12 @@
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
-#ifndef TOMMATH_PRIV_H_
-#define TOMMATH_PRIV_H_
+#ifndef TOMMATH_PRIVATE_H_
+#define TOMMATH_PRIVATE_H_
#include <tommath.h>
#include "tommath_class.h"
+#include <limits.h>
/*
* Private symbols
@@ -117,11 +118,6 @@ do { \
# define MP_KARATSUBA_SQR_CUTOFF MP_DEFAULT_KARATSUBA_SQR_CUTOFF
# define MP_TOOM_MUL_CUTOFF MP_DEFAULT_TOOM_MUL_CUTOFF
# define MP_TOOM_SQR_CUTOFF MP_DEFAULT_TOOM_SQR_CUTOFF
-#else
-# define MP_KARATSUBA_MUL_CUTOFF KARATSUBA_MUL_CUTOFF
-# define MP_KARATSUBA_SQR_CUTOFF KARATSUBA_SQR_CUTOFF
-# define MP_TOOM_MUL_CUTOFF TOOM_MUL_CUTOFF
-# define MP_TOOM_SQR_CUTOFF TOOM_SQR_CUTOFF
#endif
/* define heap macros */
@@ -163,10 +159,27 @@ extern void MP_FREE(void *mem, size_t size);
#define MP_SIZEOF_BITS(type) ((size_t)CHAR_BIT * sizeof(type))
#define MP_MAXFAST (int)(1uL << (MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)))
-/* TODO: Remove PRIVATE_MP_PREC as soon as deprecated MP_PREC is removed from tommath.h */
-#ifdef PRIVATE_MP_PREC
-# undef MP_PREC
-# define MP_PREC PRIVATE_MP_PREC
+#define PRIVATE_MP_WARRAY (1 << ((MP_SIZEOF_BITS(mp_word) - (2 * MP_DIGIT_BIT)) + 1))
+
+#if defined(MP_16BIT)
+typedef unsigned int mp_word;
+#elif defined(MP_64BIT) && defined(__GNUC__)
+typedef unsigned long mp_word __attribute__((mode(TI)));
+#elif defined(_WIN32)
+typedef unsigned __int64 mp_word;
+#else
+typedef unsigned long long mp_word;
+#endif
+
+MP_STATIC_ASSERT(correct_word_size, sizeof(mp_word) == 2 * sizeof(mp_digit))
+
+/* default precision */
+#ifndef MP_PREC
+# ifndef MP_LOW_MEM
+# define MP_PREC 32 /* default digits of precision */
+# else
+# define MP_PREC 8 /* default digits of precision */
+# endif
#endif
/* Minimum number of available digits in mp_int, MP_PREC >= MP_MIN_PREC */
@@ -198,7 +211,8 @@ MP_PRIVATE mp_err s_mp_montgomery_reduce_fast(mp_int *x, const mp_int *n, mp_dig
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_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);
+typedef int mp_prime_callback(unsigned char *dst, int len, void *dat);
+MP_PRIVATE mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, mp_prime_callback cb, void *dat);
MP_PRIVATE void s_mp_reverse(unsigned char *s, size_t len);
MP_PRIVATE mp_err s_mp_prime_is_divisible(const mp_int *a, mp_bool *result);
@@ -208,33 +222,10 @@ MP_PRIVATE mp_err s_mp_rand_jenkins(void *p, size_t n) MP_WUR;
MP_PRIVATE void s_mp_rand_jenkins_init(uint64_t seed);
#endif
-extern MP_PRIVATE const char *const mp_s_rmap;
-extern MP_PRIVATE const unsigned char mp_s_rmap_reverse[];
-extern MP_PRIVATE const size_t mp_s_rmap_reverse_sz;
-extern MP_PRIVATE const mp_digit *s_mp_prime_tab;
-
-/* deprecated functions */
-#if 0
-MP_DEPRECATED(s_mp_invmod_fast) mp_err fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c);
-MP_DEPRECATED(s_mp_montgomery_reduce_fast) mp_err fast_mp_montgomery_reduce(mp_int *x, const mp_int *n,
- mp_digit rho);
-MP_DEPRECATED(s_mp_mul_digs_fast) mp_err 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) mp_err 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) mp_err fast_s_mp_sqr(const mp_int *a, mp_int *b);
-MP_DEPRECATED(s_mp_balance_mul) mp_err mp_balance_mul(const mp_int *a, const mp_int *b, mp_int *c);
-MP_DEPRECATED(s_mp_exptmod_fast) mp_err 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) mp_err mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c);
-MP_DEPRECATED(s_mp_karatsuba_mul) mp_err mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c);
-MP_DEPRECATED(s_mp_karatsuba_sqr) mp_err mp_karatsuba_sqr(const mp_int *a, mp_int *b);
-MP_DEPRECATED(s_mp_toom_mul) mp_err mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c);
-MP_DEPRECATED(s_mp_toom_sqr) mp_err mp_toom_sqr(const mp_int *a, mp_int *b);
-MP_DEPRECATED(s_mp_reverse) void bn_reverse(unsigned char *s, int len);
-#endif
+#define MP_RMAP_REVERSE_SIZE 88
+extern MP_PRIVATE const char s_mp_rmap[];
+extern MP_PRIVATE const unsigned char s_mp_rmap_reverse[];
+extern MP_PRIVATE const mp_digit s_mp_prime_tab[];
#define MP_GET_ENDIANNESS(x) \
do{\
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index 9a2d7bc..6b0ddb0 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -269,7 +269,6 @@ TclpMatchInDirectory(
Tcl_StatBuf statBuf;
Tcl_DString ds; /* native encoding of dir */
Tcl_DString dsOrig; /* utf-8 encoding of dir */
- Tcl_Encoding encoding = Tcl_GetEncoding(interp ,NULL);
Tcl_DStringInit(&dsOrig);
dirName = TclGetString(fileNamePtr);