summaryrefslogtreecommitdiffstats
path: root/libtommath
diff options
context:
space:
mode:
Diffstat (limited to 'libtommath')
-rw-r--r--libtommath/bn_error.c4
-rw-r--r--libtommath/bn_fast_mp_invmod.c4
-rw-r--r--libtommath/bn_fast_mp_montgomery_reduce.c4
-rw-r--r--libtommath/bn_fast_s_mp_mul_digs.c4
-rw-r--r--libtommath/bn_fast_s_mp_mul_high_digs.c4
-rw-r--r--libtommath/bn_fast_s_mp_sqr.c4
-rw-r--r--libtommath/bn_mp_2expt.c4
-rw-r--r--libtommath/bn_mp_abs.c4
-rw-r--r--libtommath/bn_mp_add.c4
-rw-r--r--libtommath/bn_mp_add_d.c5
-rw-r--r--libtommath/bn_mp_addmod.c4
-rw-r--r--libtommath/bn_mp_and.c4
-rw-r--r--libtommath/bn_mp_clamp.c4
-rw-r--r--libtommath/bn_mp_clear.c4
-rw-r--r--libtommath/bn_mp_clear_multi.c4
-rw-r--r--libtommath/bn_mp_cmp.c6
-rw-r--r--libtommath/bn_mp_cmp_d.c6
-rw-r--r--libtommath/bn_mp_cmp_mag.c6
-rw-r--r--libtommath/bn_mp_cnt_lsb.c6
-rw-r--r--libtommath/bn_mp_copy.c6
-rw-r--r--libtommath/bn_mp_count_bits.c6
-rw-r--r--libtommath/bn_mp_div.c4
-rw-r--r--libtommath/bn_mp_div_2.c4
-rw-r--r--libtommath/bn_mp_div_2d.c6
-rw-r--r--libtommath/bn_mp_div_3.c4
-rw-r--r--libtommath/bn_mp_div_d.c6
-rw-r--r--libtommath/bn_mp_dr_is_modulus.c4
-rw-r--r--libtommath/bn_mp_dr_reduce.c4
-rw-r--r--libtommath/bn_mp_dr_setup.c4
-rw-r--r--libtommath/bn_mp_exch.c4
-rw-r--r--libtommath/bn_mp_expt_d.c4
-rw-r--r--libtommath/bn_mp_exptmod.c4
-rw-r--r--libtommath/bn_mp_exptmod_fast.c5
-rw-r--r--libtommath/bn_mp_exteuclid.c4
-rw-r--r--libtommath/bn_mp_fread.c4
-rw-r--r--libtommath/bn_mp_fwrite.c4
-rw-r--r--libtommath/bn_mp_gcd.c4
-rw-r--r--libtommath/bn_mp_get_int.c4
-rw-r--r--libtommath/bn_mp_grow.c4
-rw-r--r--libtommath/bn_mp_init.c4
-rw-r--r--libtommath/bn_mp_init_copy.c4
-rw-r--r--libtommath/bn_mp_init_multi.c4
-rw-r--r--libtommath/bn_mp_init_set.c4
-rw-r--r--libtommath/bn_mp_init_set_int.c4
-rw-r--r--libtommath/bn_mp_init_size.c4
-rw-r--r--libtommath/bn_mp_invmod.c4
-rw-r--r--libtommath/bn_mp_invmod_slow.c4
-rw-r--r--libtommath/bn_mp_is_square.c4
-rw-r--r--libtommath/bn_mp_jacobi.c4
-rw-r--r--libtommath/bn_mp_karatsuba_mul.c4
-rw-r--r--libtommath/bn_mp_karatsuba_sqr.c4
-rw-r--r--libtommath/bn_mp_lcm.c4
-rw-r--r--libtommath/bn_mp_lshd.c4
-rw-r--r--libtommath/bn_mp_mod.c4
-rw-r--r--libtommath/bn_mp_mod_2d.c6
-rw-r--r--libtommath/bn_mp_mod_d.c4
-rw-r--r--libtommath/bn_mp_montgomery_calc_normalization.c4
-rw-r--r--libtommath/bn_mp_montgomery_reduce.c4
-rw-r--r--libtommath/bn_mp_montgomery_setup.c6
-rw-r--r--libtommath/bn_mp_mul.c4
-rw-r--r--libtommath/bn_mp_mul_2.c4
-rw-r--r--libtommath/bn_mp_mul_2d.c6
-rw-r--r--libtommath/bn_mp_mul_d.c4
-rw-r--r--libtommath/bn_mp_mulmod.c4
-rw-r--r--libtommath/bn_mp_n_root.c4
-rw-r--r--libtommath/bn_mp_neg.c6
-rw-r--r--libtommath/bn_mp_or.c4
-rw-r--r--libtommath/bn_mp_prime_fermat.c4
-rw-r--r--libtommath/bn_mp_prime_is_divisible.c4
-rw-r--r--libtommath/bn_mp_prime_is_prime.c4
-rw-r--r--libtommath/bn_mp_prime_miller_rabin.c4
-rw-r--r--libtommath/bn_mp_prime_next_prime.c6
-rw-r--r--libtommath/bn_mp_prime_rabin_miller_trials.c4
-rw-r--r--libtommath/bn_mp_prime_random_ex.c4
-rw-r--r--libtommath/bn_mp_radix_size.c5
-rw-r--r--libtommath/bn_mp_radix_smap.c4
-rw-r--r--libtommath/bn_mp_rand.c4
-rw-r--r--libtommath/bn_mp_read_radix.c8
-rw-r--r--libtommath/bn_mp_read_signed_bin.c4
-rw-r--r--libtommath/bn_mp_read_unsigned_bin.c4
-rw-r--r--libtommath/bn_mp_reduce.c4
-rw-r--r--libtommath/bn_mp_reduce_2k.c4
-rw-r--r--libtommath/bn_mp_reduce_2k_l.c4
-rw-r--r--libtommath/bn_mp_reduce_2k_setup.c4
-rw-r--r--libtommath/bn_mp_reduce_2k_setup_l.c4
-rw-r--r--libtommath/bn_mp_reduce_is_2k.c4
-rw-r--r--libtommath/bn_mp_reduce_is_2k_l.c4
-rw-r--r--libtommath/bn_mp_reduce_setup.c4
-rw-r--r--libtommath/bn_mp_rshd.c4
-rw-r--r--libtommath/bn_mp_set.c4
-rw-r--r--libtommath/bn_mp_set_int.c4
-rw-r--r--libtommath/bn_mp_shrink.c15
-rw-r--r--libtommath/bn_mp_signed_bin_size.c4
-rw-r--r--libtommath/bn_mp_sqr.c4
-rw-r--r--libtommath/bn_mp_sqrmod.c4
-rw-r--r--libtommath/bn_mp_sqrt.c5
-rw-r--r--libtommath/bn_mp_sub.c4
-rw-r--r--libtommath/bn_mp_sub_d.c4
-rw-r--r--libtommath/bn_mp_submod.c4
-rw-r--r--libtommath/bn_mp_to_signed_bin.c4
-rw-r--r--libtommath/bn_mp_to_signed_bin_n.c4
-rw-r--r--libtommath/bn_mp_to_unsigned_bin.c4
-rw-r--r--libtommath/bn_mp_to_unsigned_bin_n.c4
-rw-r--r--libtommath/bn_mp_toom_mul.c4
-rw-r--r--libtommath/bn_mp_toom_sqr.c4
-rw-r--r--libtommath/bn_mp_toradix.c4
-rw-r--r--libtommath/bn_mp_toradix_n.c4
-rw-r--r--libtommath/bn_mp_unsigned_bin_size.c4
-rw-r--r--libtommath/bn_mp_xor.c4
-rw-r--r--libtommath/bn_mp_zero.c4
-rw-r--r--libtommath/bn_prime_tab.c4
-rw-r--r--libtommath/bn_reverse.c4
-rw-r--r--libtommath/bn_s_mp_add.c4
-rw-r--r--libtommath/bn_s_mp_exptmod.c4
-rw-r--r--libtommath/bn_s_mp_mul_digs.c4
-rw-r--r--libtommath/bn_s_mp_mul_high_digs.c4
-rw-r--r--libtommath/bn_s_mp_sqr.c4
-rw-r--r--libtommath/bn_s_mp_sub.c4
-rw-r--r--libtommath/bncore.c4
-rw-r--r--libtommath/changes.txt14
-rw-r--r--libtommath/demo/demo.c4
-rw-r--r--libtommath/demo/timing.c4
-rw-r--r--libtommath/etc/2kprime.c9
-rw-r--r--libtommath/etc/drprime.c5
-rw-r--r--libtommath/etc/drprimes.txt11
-rw-r--r--libtommath/etc/mersenne.c4
-rw-r--r--libtommath/etc/mont.c9
-rw-r--r--libtommath/etc/pprime.c4
-rw-r--r--libtommath/etc/tune.c4
-rw-r--r--libtommath/logs/index.html3
-rw-r--r--libtommath/makefile7
-rw-r--r--libtommath/makefile.cygwin_dll4
-rw-r--r--libtommath/makefile.shared2
-rw-r--r--libtommath/mtest/logtab.h5
-rw-r--r--libtommath/mtest/mpi-config.h5
-rw-r--r--libtommath/mtest/mpi-types.h5
-rw-r--r--libtommath/mtest/mpi.c8
-rw-r--r--libtommath/mtest/mpi.h6
-rw-r--r--libtommath/mtest/mtest.c4
-rw-r--r--libtommath/pre_gen/mpi.c502
-rw-r--r--libtommath/tommath.h80
-rw-r--r--libtommath/tommath_class.h4
-rw-r--r--libtommath/tommath_superclass.h4
143 files changed, 104 insertions, 1124 deletions
diff --git a/libtommath/bn_error.c b/libtommath/bn_error.c
index d96ea2a..6393bb0 100644
--- a/libtommath/bn_error.c
+++ b/libtommath/bn_error.c
@@ -41,7 +41,3 @@ char *mp_error_to_string(int code)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_error.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_fast_mp_invmod.c b/libtommath/bn_fast_mp_invmod.c
index 744ae4f..fafd9dc 100644
--- a/libtommath/bn_fast_mp_invmod.c
+++ b/libtommath/bn_fast_mp_invmod.c
@@ -142,7 +142,3 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL);
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_fast_mp_invmod.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_fast_mp_montgomery_reduce.c b/libtommath/bn_fast_mp_montgomery_reduce.c
index 45a4089..e941dc2 100644
--- a/libtommath/bn_fast_mp_montgomery_reduce.c
+++ b/libtommath/bn_fast_mp_montgomery_reduce.c
@@ -166,7 +166,3 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_fast_mp_montgomery_reduce.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_fast_s_mp_mul_digs.c b/libtommath/bn_fast_s_mp_mul_digs.c
index 86b78b4..ab157b9 100644
--- a/libtommath/bn_fast_s_mp_mul_digs.c
+++ b/libtommath/bn_fast_s_mp_mul_digs.c
@@ -101,7 +101,3 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_fast_s_mp_mul_digs.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_fast_s_mp_mul_high_digs.c b/libtommath/bn_fast_s_mp_mul_high_digs.c
index 607630a..ec9f58a 100644
--- a/libtommath/bn_fast_s_mp_mul_high_digs.c
+++ b/libtommath/bn_fast_s_mp_mul_high_digs.c
@@ -92,7 +92,3 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_fast_s_mp_mul_high_digs.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_fast_s_mp_sqr.c b/libtommath/bn_fast_s_mp_sqr.c
index 50adf00..1abf24b 100644
--- a/libtommath/bn_fast_s_mp_sqr.c
+++ b/libtommath/bn_fast_s_mp_sqr.c
@@ -108,7 +108,3 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_fast_s_mp_sqr.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_2expt.c b/libtommath/bn_mp_2expt.c
index a9d3e9c..a32572d 100644
--- a/libtommath/bn_mp_2expt.c
+++ b/libtommath/bn_mp_2expt.c
@@ -42,7 +42,3 @@ mp_2expt (mp_int * a, int b)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_2expt.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_abs.c b/libtommath/bn_mp_abs.c
index 2a7f02c..dc51884 100644
--- a/libtommath/bn_mp_abs.c
+++ b/libtommath/bn_mp_abs.c
@@ -37,7 +37,3 @@ mp_abs (mp_int * a, mp_int * b)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_abs.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_add.c b/libtommath/bn_mp_add.c
index ab3bb87..d9b8fa5 100644
--- a/libtommath/bn_mp_add.c
+++ b/libtommath/bn_mp_add.c
@@ -47,7 +47,3 @@ int mp_add (mp_int * a, mp_int * b, mp_int * c)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_add.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2006/12/01 19:45:38 $ */
diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c
index 325b067..5281ad4 100644
--- a/libtommath/bn_mp_add_d.c
+++ b/libtommath/bn_mp_add_d.c
@@ -107,8 +107,3 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_add_d.c,v $ */
-/* Tom's revision is 1.2 */
-/* $Revision: 1.4 $ */
-/* $Date: 2006/12/01 00:31:32 $ */
diff --git a/libtommath/bn_mp_addmod.c b/libtommath/bn_mp_addmod.c
index b0b4d8b..bff193f 100644
--- a/libtommath/bn_mp_addmod.c
+++ b/libtommath/bn_mp_addmod.c
@@ -35,7 +35,3 @@ mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_addmod.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c
index ff61017..02bef18 100644
--- a/libtommath/bn_mp_and.c
+++ b/libtommath/bn_mp_and.c
@@ -51,7 +51,3 @@ mp_and (mp_int * a, mp_int * b, mp_int * c)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_and.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_clamp.c b/libtommath/bn_mp_clamp.c
index 4f2f8ba..74887bb 100644
--- a/libtommath/bn_mp_clamp.c
+++ b/libtommath/bn_mp_clamp.c
@@ -38,7 +38,3 @@ mp_clamp (mp_int * a)
}
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_clamp.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_clear.c b/libtommath/bn_mp_clear.c
index e1fe10d..bd07e76 100644
--- a/libtommath/bn_mp_clear.c
+++ b/libtommath/bn_mp_clear.c
@@ -38,7 +38,3 @@ mp_clear (mp_int * a)
}
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_clear.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_clear_multi.c b/libtommath/bn_mp_clear_multi.c
index e9910e8..c3ad7a8 100644
--- a/libtommath/bn_mp_clear_multi.c
+++ b/libtommath/bn_mp_clear_multi.c
@@ -28,7 +28,3 @@ void mp_clear_multi(mp_int *mp, ...)
va_end(args);
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_clear_multi.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_cmp.c b/libtommath/bn_mp_cmp.c
index 6361730..943249d 100644
--- a/libtommath/bn_mp_cmp.c
+++ b/libtommath/bn_mp_cmp.c
@@ -17,7 +17,7 @@
/* compare two ints (signed)*/
int
-mp_cmp (mp_int * a, mp_int * b)
+mp_cmp (const mp_int * a, const mp_int * b)
{
/* compare based on sign */
if (a->sign != b->sign) {
@@ -37,7 +37,3 @@ mp_cmp (mp_int * a, mp_int * b)
}
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_cmp.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_cmp_d.c b/libtommath/bn_mp_cmp_d.c
index 92c3567..ecec091 100644
--- a/libtommath/bn_mp_cmp_d.c
+++ b/libtommath/bn_mp_cmp_d.c
@@ -16,7 +16,7 @@
*/
/* compare a digit */
-int mp_cmp_d(mp_int * a, mp_digit b)
+int mp_cmp_d(const mp_int * a, mp_digit b)
{
/* compare based on sign */
if (a->sign == MP_NEG) {
@@ -38,7 +38,3 @@ int mp_cmp_d(mp_int * a, mp_digit b)
}
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_cmp_d.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_cmp_mag.c b/libtommath/bn_mp_cmp_mag.c
index 31c8221..b23a191 100644
--- a/libtommath/bn_mp_cmp_mag.c
+++ b/libtommath/bn_mp_cmp_mag.c
@@ -16,7 +16,7 @@
*/
/* compare maginitude of two ints (unsigned) */
-int mp_cmp_mag (mp_int * a, mp_int * b)
+int mp_cmp_mag (const mp_int * a, const mp_int * b)
{
int n;
mp_digit *tmpa, *tmpb;
@@ -49,7 +49,3 @@ int mp_cmp_mag (mp_int * a, mp_int * b)
return MP_EQ;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_cmp_mag.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_cnt_lsb.c b/libtommath/bn_mp_cnt_lsb.c
index 4aa68b5..f205e8c 100644
--- a/libtommath/bn_mp_cnt_lsb.c
+++ b/libtommath/bn_mp_cnt_lsb.c
@@ -20,7 +20,7 @@ static const int lnz[16] = {
};
/* Counts the number of lsbs which are zero before the first zero bit */
-int mp_cnt_lsb(mp_int *a)
+int mp_cnt_lsb(const mp_int *a)
{
int x;
mp_digit q, qq;
@@ -47,7 +47,3 @@ int mp_cnt_lsb(mp_int *a)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_cnt_lsb.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c
index a5d5e6f..ffbc0d4 100644
--- a/libtommath/bn_mp_copy.c
+++ b/libtommath/bn_mp_copy.c
@@ -17,7 +17,7 @@
/* copy, b = a */
int
-mp_copy (mp_int * a, mp_int * b)
+mp_copy (const mp_int * a, mp_int * b)
{
int res, n;
@@ -62,7 +62,3 @@ mp_copy (mp_int * a, mp_int * b)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_copy.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_count_bits.c b/libtommath/bn_mp_count_bits.c
index 44c0cff..00d364e 100644
--- a/libtommath/bn_mp_count_bits.c
+++ b/libtommath/bn_mp_count_bits.c
@@ -17,7 +17,7 @@
/* returns the number of bits in an int */
int
-mp_count_bits (mp_int * a)
+mp_count_bits (const mp_int * a)
{
int r;
mp_digit q;
@@ -39,7 +39,3 @@ mp_count_bits (mp_int * a)
return r;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_count_bits.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c
index ce6c255..de4ca04 100644
--- a/libtommath/bn_mp_div.c
+++ b/libtommath/bn_mp_div.c
@@ -286,7 +286,3 @@ LBL_Q:mp_clear (&q);
#endif
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_div.c,v $ */
-/* $Revision: 1.4 $ */
-/* $Date: 2006/12/01 19:45:38 $ */
diff --git a/libtommath/bn_mp_div_2.c b/libtommath/bn_mp_div_2.c
index bcb17c1..186a959 100644
--- a/libtommath/bn_mp_div_2.c
+++ b/libtommath/bn_mp_div_2.c
@@ -62,7 +62,3 @@ int mp_div_2(mp_int * a, mp_int * b)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_div_2.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_div_2d.c b/libtommath/bn_mp_div_2d.c
index 12a7c99..d7b7e05 100644
--- a/libtommath/bn_mp_div_2d.c
+++ b/libtommath/bn_mp_div_2d.c
@@ -16,7 +16,7 @@
*/
/* shift right by a certain bit count (store quotient in c, optional remainder in d) */
-int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d)
+int mp_div_2d (const mp_int * a, int b, mp_int * c, mp_int * d)
{
mp_digit D, r, rr;
int x, res;
@@ -91,7 +91,3 @@ int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_div_2d.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c
index 571991a..79a9816 100644
--- a/libtommath/bn_mp_div_3.c
+++ b/libtommath/bn_mp_div_3.c
@@ -73,7 +73,3 @@ mp_div_3 (mp_int * a, mp_int *c, mp_digit * d)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_div_3.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c
index 4289602..af18d0a 100644
--- a/libtommath/bn_mp_div_d.c
+++ b/libtommath/bn_mp_div_d.c
@@ -20,7 +20,7 @@ static int s_is_power_of_two(mp_digit b, int *p)
int x;
/* quick out - if (b & (b-1)) isn't zero, b isn't a power of two */
- if ((b & (b-1)) != 0) {
+ if ((b==0) || (b & (b-1))) {
return 0;
}
for (x = 1; x < DIGIT_BIT; x++) {
@@ -108,7 +108,3 @@ int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_div_d.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2006/12/01 05:47:47 $ */
diff --git a/libtommath/bn_mp_dr_is_modulus.c b/libtommath/bn_mp_dr_is_modulus.c
index 9532df1..8ad31dc 100644
--- a/libtommath/bn_mp_dr_is_modulus.c
+++ b/libtommath/bn_mp_dr_is_modulus.c
@@ -37,7 +37,3 @@ int mp_dr_is_modulus(mp_int *a)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_dr_is_modulus.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_dr_reduce.c b/libtommath/bn_mp_dr_reduce.c
index 6d63462..8337591 100644
--- a/libtommath/bn_mp_dr_reduce.c
+++ b/libtommath/bn_mp_dr_reduce.c
@@ -88,7 +88,3 @@ top:
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_dr_reduce.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_dr_setup.c b/libtommath/bn_mp_dr_setup.c
index c6f4b2f..de00e2d 100644
--- a/libtommath/bn_mp_dr_setup.c
+++ b/libtommath/bn_mp_dr_setup.c
@@ -26,7 +26,3 @@ void mp_dr_setup(mp_int *a, mp_digit *d)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_dr_setup.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_exch.c b/libtommath/bn_mp_exch.c
index 691d9f6..b7bd186 100644
--- a/libtommath/bn_mp_exch.c
+++ b/libtommath/bn_mp_exch.c
@@ -28,7 +28,3 @@ mp_exch (mp_int * a, mp_int * b)
*b = t;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_exch.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_expt_d.c b/libtommath/bn_mp_expt_d.c
index dfd04eb..132f480 100644
--- a/libtommath/bn_mp_expt_d.c
+++ b/libtommath/bn_mp_expt_d.c
@@ -51,7 +51,3 @@ int mp_expt_d (mp_int * a, mp_digit b, mp_int * c)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_expt_d.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_exptmod.c b/libtommath/bn_mp_exptmod.c
index 714a96f..b7d9fb7 100644
--- a/libtommath/bn_mp_exptmod.c
+++ b/libtommath/bn_mp_exptmod.c
@@ -106,7 +106,3 @@ int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_exptmod.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c
index cb8d94a..1902e79 100644
--- a/libtommath/bn_mp_exptmod_fast.c
+++ b/libtommath/bn_mp_exptmod_fast.c
@@ -314,8 +314,3 @@ LBL_M:
return err;
}
#endif
-
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_exptmod_fast.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c
index 9730fa0..2e69ce1 100644
--- a/libtommath/bn_mp_exteuclid.c
+++ b/libtommath/bn_mp_exteuclid.c
@@ -76,7 +76,3 @@ _ERR: mp_clear_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL
return err;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_exteuclid.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_fread.c b/libtommath/bn_mp_fread.c
index c1b0128..44e1ea8 100644
--- a/libtommath/bn_mp_fread.c
+++ b/libtommath/bn_mp_fread.c
@@ -61,7 +61,3 @@ int mp_fread(mp_int *a, int radix, FILE *stream)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_fread.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_fwrite.c b/libtommath/bn_mp_fwrite.c
index 5785c02..b0ec29e 100644
--- a/libtommath/bn_mp_fwrite.c
+++ b/libtommath/bn_mp_fwrite.c
@@ -46,7 +46,3 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_fwrite.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_gcd.c b/libtommath/bn_mp_gcd.c
index bbc5421..68cfa03 100644
--- a/libtommath/bn_mp_gcd.c
+++ b/libtommath/bn_mp_gcd.c
@@ -99,7 +99,3 @@ LBL_U:mp_clear (&v);
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_gcd.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c
index 269be79..762cb23 100644
--- a/libtommath/bn_mp_get_int.c
+++ b/libtommath/bn_mp_get_int.c
@@ -39,7 +39,3 @@ unsigned long mp_get_int(mp_int * a)
return res & 0xFFFFFFFFUL;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_get_int.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_grow.c b/libtommath/bn_mp_grow.c
index e77c774..b5b2407 100644
--- a/libtommath/bn_mp_grow.c
+++ b/libtommath/bn_mp_grow.c
@@ -51,7 +51,3 @@ int mp_grow (mp_int * a, int size)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_grow.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_init.c b/libtommath/bn_mp_init.c
index c866e89..ddb2d07 100644
--- a/libtommath/bn_mp_init.c
+++ b/libtommath/bn_mp_init.c
@@ -40,7 +40,3 @@ int mp_init (mp_int * a)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_init.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_init_copy.c b/libtommath/bn_mp_init_copy.c
index 2e1c207..2410a9f 100644
--- a/libtommath/bn_mp_init_copy.c
+++ b/libtommath/bn_mp_init_copy.c
@@ -26,7 +26,3 @@ int mp_init_copy (mp_int * a, mp_int * b)
return mp_copy (b, a);
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_init_copy.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_init_multi.c b/libtommath/bn_mp_init_multi.c
index 70148b8..44e3fe6 100644
--- a/libtommath/bn_mp_init_multi.c
+++ b/libtommath/bn_mp_init_multi.c
@@ -53,7 +53,3 @@ int mp_init_multi(mp_int *mp, ...)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_init_multi.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_init_set.c b/libtommath/bn_mp_init_set.c
index cdf1249..dc08867 100644
--- a/libtommath/bn_mp_init_set.c
+++ b/libtommath/bn_mp_init_set.c
@@ -26,7 +26,3 @@ int mp_init_set (mp_int * a, mp_digit b)
return err;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_init_set.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_init_set_int.c b/libtommath/bn_mp_init_set_int.c
index a4e87d5..56b27e0 100644
--- a/libtommath/bn_mp_init_set_int.c
+++ b/libtommath/bn_mp_init_set_int.c
@@ -25,7 +25,3 @@ int mp_init_set_int (mp_int * a, unsigned long b)
return mp_set_int(a, b);
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_init_set_int.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_init_size.c b/libtommath/bn_mp_init_size.c
index 4433b16..8ed2c2a 100644
--- a/libtommath/bn_mp_init_size.c
+++ b/libtommath/bn_mp_init_size.c
@@ -42,7 +42,3 @@ int mp_init_size (mp_int * a, int size)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_init_size.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_invmod.c b/libtommath/bn_mp_invmod.c
index 09e71cd..fdb6c88 100644
--- a/libtommath/bn_mp_invmod.c
+++ b/libtommath/bn_mp_invmod.c
@@ -37,7 +37,3 @@ int mp_invmod (mp_int * a, mp_int * b, mp_int * c)
return MP_VAL;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_invmod.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_invmod_slow.c b/libtommath/bn_mp_invmod_slow.c
index ff9cc96..e079819 100644
--- a/libtommath/bn_mp_invmod_slow.c
+++ b/libtommath/bn_mp_invmod_slow.c
@@ -169,7 +169,3 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL);
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_invmod_slow.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c
index 01f07b3..926b449 100644
--- a/libtommath/bn_mp_is_square.c
+++ b/libtommath/bn_mp_is_square.c
@@ -103,7 +103,3 @@ ERR:mp_clear(&t);
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_is_square.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_jacobi.c b/libtommath/bn_mp_jacobi.c
index cb7713d..1644698 100644
--- a/libtommath/bn_mp_jacobi.c
+++ b/libtommath/bn_mp_jacobi.c
@@ -99,7 +99,3 @@ LBL_A1:mp_clear (&a1);
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_jacobi.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_karatsuba_mul.c b/libtommath/bn_mp_karatsuba_mul.c
index 53187dd..0d62b9b 100644
--- a/libtommath/bn_mp_karatsuba_mul.c
+++ b/libtommath/bn_mp_karatsuba_mul.c
@@ -161,7 +161,3 @@ ERR:
return err;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_karatsuba_mul.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_karatsuba_sqr.c b/libtommath/bn_mp_karatsuba_sqr.c
index 7f1f253..829405a 100644
--- a/libtommath/bn_mp_karatsuba_sqr.c
+++ b/libtommath/bn_mp_karatsuba_sqr.c
@@ -115,7 +115,3 @@ ERR:
return err;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_karatsuba_sqr.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_lcm.c b/libtommath/bn_mp_lcm.c
index 72a5beb..1d53921 100644
--- a/libtommath/bn_mp_lcm.c
+++ b/libtommath/bn_mp_lcm.c
@@ -54,7 +54,3 @@ LBL_T:
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_lcm.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_lshd.c b/libtommath/bn_mp_lshd.c
index 84dfa81..ce1e63b 100644
--- a/libtommath/bn_mp_lshd.c
+++ b/libtommath/bn_mp_lshd.c
@@ -61,7 +61,3 @@ int mp_lshd (mp_int * a, int b)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_lshd.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c
index 16d9d76..98e155e 100644
--- a/libtommath/bn_mp_mod.c
+++ b/libtommath/bn_mp_mod.c
@@ -42,7 +42,3 @@ mp_mod (mp_int * a, mp_int * b, mp_int * c)
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_mod.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_mod_2d.c b/libtommath/bn_mp_mod_2d.c
index 2ab7e33..0170f65 100644
--- a/libtommath/bn_mp_mod_2d.c
+++ b/libtommath/bn_mp_mod_2d.c
@@ -17,7 +17,7 @@
/* calc a value mod 2**b */
int
-mp_mod_2d (mp_int * a, int b, mp_int * c)
+mp_mod_2d (const mp_int * a, int b, mp_int * c)
{
int x, res;
@@ -49,7 +49,3 @@ mp_mod_2d (mp_int * a, int b, mp_int * c)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_mod_2d.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_mod_d.c b/libtommath/bn_mp_mod_d.c
index 91dcbe1..f642ee8 100644
--- a/libtommath/bn_mp_mod_d.c
+++ b/libtommath/bn_mp_mod_d.c
@@ -21,7 +21,3 @@ mp_mod_d (mp_int * a, mp_digit b, mp_digit * c)
return mp_div_d(a, b, NULL, c);
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_mod_d.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_montgomery_calc_normalization.c b/libtommath/bn_mp_montgomery_calc_normalization.c
index 59dd8ea..0748762 100644
--- a/libtommath/bn_mp_montgomery_calc_normalization.c
+++ b/libtommath/bn_mp_montgomery_calc_normalization.c
@@ -53,7 +53,3 @@ int mp_montgomery_calc_normalization (mp_int * a, mp_int * b)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_montgomery_calc_normalization.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_montgomery_reduce.c b/libtommath/bn_mp_montgomery_reduce.c
index f9305d8..bc6abb8 100644
--- a/libtommath/bn_mp_montgomery_reduce.c
+++ b/libtommath/bn_mp_montgomery_reduce.c
@@ -112,7 +112,3 @@ mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_montgomery_reduce.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_montgomery_setup.c b/libtommath/bn_mp_montgomery_setup.c
index cea6778..b8e1887 100644
--- a/libtommath/bn_mp_montgomery_setup.c
+++ b/libtommath/bn_mp_montgomery_setup.c
@@ -48,12 +48,8 @@ mp_montgomery_setup (mp_int * n, mp_digit * rho)
#endif
/* rho = -1/m mod b */
- *rho = (((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK;
+ *rho = (unsigned long)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK;
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_montgomery_setup.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c
index 6506635..fc024be 100644
--- a/libtommath/bn_mp_mul.c
+++ b/libtommath/bn_mp_mul.c
@@ -60,7 +60,3 @@ int mp_mul (mp_int * a, mp_int * b, mp_int * c)
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_mul.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_mul_2.c b/libtommath/bn_mp_mul_2.c
index 96d5710..2ca6022 100644
--- a/libtommath/bn_mp_mul_2.c
+++ b/libtommath/bn_mp_mul_2.c
@@ -76,7 +76,3 @@ int mp_mul_2(mp_int * a, mp_int * b)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_mul_2.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_mul_2d.c b/libtommath/bn_mp_mul_2d.c
index 88fa080..4ac2e4e 100644
--- a/libtommath/bn_mp_mul_2d.c
+++ b/libtommath/bn_mp_mul_2d.c
@@ -16,7 +16,7 @@
*/
/* shift left by a certain bit count */
-int mp_mul_2d (mp_int * a, int b, mp_int * c)
+int mp_mul_2d (const mp_int * a, int b, mp_int * c)
{
mp_digit d;
int res;
@@ -79,7 +79,3 @@ int mp_mul_2d (mp_int * a, int b, mp_int * c)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_mul_2d.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c
index e86d6ab..ba45a0c 100644
--- a/libtommath/bn_mp_mul_d.c
+++ b/libtommath/bn_mp_mul_d.c
@@ -73,7 +73,3 @@ mp_mul_d (mp_int * a, mp_digit b, mp_int * c)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_mul_d.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_mulmod.c b/libtommath/bn_mp_mulmod.c
index d84c555..649b717 100644
--- a/libtommath/bn_mp_mulmod.c
+++ b/libtommath/bn_mp_mulmod.c
@@ -34,7 +34,3 @@ int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_mulmod.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_n_root.c b/libtommath/bn_mp_n_root.c
index 734d5ea..b2700a8 100644
--- a/libtommath/bn_mp_n_root.c
+++ b/libtommath/bn_mp_n_root.c
@@ -126,7 +126,3 @@ LBL_T1:mp_clear (&t1);
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_n_root.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_neg.c b/libtommath/bn_mp_neg.c
index 17e851a..07fb148 100644
--- a/libtommath/bn_mp_neg.c
+++ b/libtommath/bn_mp_neg.c
@@ -16,7 +16,7 @@
*/
/* b = -a */
-int mp_neg (mp_int * a, mp_int * b)
+int mp_neg (const mp_int * a, mp_int * b)
{
int res;
if (a != b) {
@@ -34,7 +34,3 @@ int mp_neg (mp_int * a, mp_int * b)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_neg.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_or.c b/libtommath/bn_mp_or.c
index 09df58c..aa5b1bd 100644
--- a/libtommath/bn_mp_or.c
+++ b/libtommath/bn_mp_or.c
@@ -44,7 +44,3 @@ int mp_or (mp_int * a, mp_int * b, mp_int * c)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_or.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_prime_fermat.c b/libtommath/bn_mp_prime_fermat.c
index f6edf9e..7b9b12e 100644
--- a/libtommath/bn_mp_prime_fermat.c
+++ b/libtommath/bn_mp_prime_fermat.c
@@ -56,7 +56,3 @@ LBL_T:mp_clear (&t);
return err;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_prime_fermat.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_prime_is_divisible.c b/libtommath/bn_mp_prime_is_divisible.c
index 897c11b..710c967 100644
--- a/libtommath/bn_mp_prime_is_divisible.c
+++ b/libtommath/bn_mp_prime_is_divisible.c
@@ -44,7 +44,3 @@ int mp_prime_is_divisible (mp_int * a, int *result)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_prime_is_divisible.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_prime_is_prime.c b/libtommath/bn_mp_prime_is_prime.c
index 135f1d9..ce225a3 100644
--- a/libtommath/bn_mp_prime_is_prime.c
+++ b/libtommath/bn_mp_prime_is_prime.c
@@ -77,7 +77,3 @@ LBL_B:mp_clear (&b);
return err;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_prime_is_prime.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_prime_miller_rabin.c b/libtommath/bn_mp_prime_miller_rabin.c
index f2d6c7f..c5185b8 100644
--- a/libtommath/bn_mp_prime_miller_rabin.c
+++ b/libtommath/bn_mp_prime_miller_rabin.c
@@ -97,7 +97,3 @@ LBL_N1:mp_clear (&n1);
return err;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_prime_miller_rabin.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_prime_next_prime.c b/libtommath/bn_mp_prime_next_prime.c
index a875260..2433e8c 100644
--- a/libtommath/bn_mp_prime_next_prime.c
+++ b/libtommath/bn_mp_prime_next_prime.c
@@ -143,7 +143,7 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style)
/* is this prime? */
for (x = 0; x < t; x++) {
- mp_set(&b, ltm_prime_tab[t]);
+ mp_set(&b, ltm_prime_tab[x]);
if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) {
goto LBL_ERR;
}
@@ -164,7 +164,3 @@ LBL_ERR:
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_prime_next_prime.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_prime_rabin_miller_trials.c b/libtommath/bn_mp_prime_rabin_miller_trials.c
index 30825a3..e57a43c 100644
--- a/libtommath/bn_mp_prime_rabin_miller_trials.c
+++ b/libtommath/bn_mp_prime_rabin_miller_trials.c
@@ -46,7 +46,3 @@ int mp_prime_rabin_miller_trials(int size)
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_prime_rabin_miller_trials.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_prime_random_ex.c b/libtommath/bn_mp_prime_random_ex.c
index baddd10..a37477e 100644
--- a/libtommath/bn_mp_prime_random_ex.c
+++ b/libtommath/bn_mp_prime_random_ex.c
@@ -119,7 +119,3 @@ error:
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_prime_random_ex.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_radix_size.c b/libtommath/bn_mp_radix_size.c
index 4aa407b..40c4d04 100644
--- a/libtommath/bn_mp_radix_size.c
+++ b/libtommath/bn_mp_radix_size.c
@@ -81,8 +81,3 @@ int mp_radix_size (mp_int * a, int radix, int *size)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_radix_size.c,v $ */
-/* Tom's revision is 1.4 */
-/* $Revision: 1.5 $ */
-/* $Date: 2006/12/01 00:31:32 $ */
diff --git a/libtommath/bn_mp_radix_smap.c b/libtommath/bn_mp_radix_smap.c
index 913acad..7aeb375 100644
--- a/libtommath/bn_mp_radix_smap.c
+++ b/libtommath/bn_mp_radix_smap.c
@@ -18,7 +18,3 @@
/* chars used in radix conversions */
const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_radix_smap.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_rand.c b/libtommath/bn_mp_rand.c
index 6de7447..17c1fbe 100644
--- a/libtommath/bn_mp_rand.c
+++ b/libtommath/bn_mp_rand.c
@@ -49,7 +49,3 @@ mp_rand (mp_int * a, int digits)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_rand.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_read_radix.c b/libtommath/bn_mp_read_radix.c
index 75859f8..4b92589 100644
--- a/libtommath/bn_mp_read_radix.c
+++ b/libtommath/bn_mp_read_radix.c
@@ -48,7 +48,7 @@ int mp_read_radix (mp_int * a, const char *str, int radix)
* this allows numbers like 1AB and 1ab to represent the same value
* [e.g. in hex]
*/
- ch = (char) ((radix < 36) ? toupper (*str) : *str);
+ ch = (char) ((radix < 36) ? toupper ((unsigned char) *str) : *str);
for (y = 0; y < 64; y++) {
if (ch == mp_s_rmap[y]) {
break;
@@ -86,9 +86,3 @@ int mp_read_radix (mp_int * a, const char *str, int radix)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_read_radix.c,v $ */
-/* Tom's revision is 1.4. */
-/* $Revision: 1.5 $ */
-/* $Date: 2006/12/01 00:31:32 $ */
-
diff --git a/libtommath/bn_mp_read_signed_bin.c b/libtommath/bn_mp_read_signed_bin.c
index ae9e6a8..3ee8556 100644
--- a/libtommath/bn_mp_read_signed_bin.c
+++ b/libtommath/bn_mp_read_signed_bin.c
@@ -35,7 +35,3 @@ int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_read_signed_bin.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_read_unsigned_bin.c b/libtommath/bn_mp_read_unsigned_bin.c
index b94265f..caf5be0 100644
--- a/libtommath/bn_mp_read_unsigned_bin.c
+++ b/libtommath/bn_mp_read_unsigned_bin.c
@@ -49,7 +49,3 @@ int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_read_unsigned_bin.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_reduce.c b/libtommath/bn_mp_reduce.c
index e4c8842..4375e4e 100644
--- a/libtommath/bn_mp_reduce.c
+++ b/libtommath/bn_mp_reduce.c
@@ -94,7 +94,3 @@ CLEANUP:
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_reduce.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_reduce_2k.c b/libtommath/bn_mp_reduce_2k.c
index 0bc9f36..428f2ff 100644
--- a/libtommath/bn_mp_reduce_2k.c
+++ b/libtommath/bn_mp_reduce_2k.c
@@ -55,7 +55,3 @@ ERR:
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_reduce_2k.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_reduce_2k_l.c b/libtommath/bn_mp_reduce_2k_l.c
index ff50948..8e52efa 100644
--- a/libtommath/bn_mp_reduce_2k_l.c
+++ b/libtommath/bn_mp_reduce_2k_l.c
@@ -56,7 +56,3 @@ ERR:
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_reduce_2k_l.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_reduce_2k_setup.c b/libtommath/bn_mp_reduce_2k_setup.c
index 2a97cd0..ac043f6 100644
--- a/libtommath/bn_mp_reduce_2k_setup.c
+++ b/libtommath/bn_mp_reduce_2k_setup.c
@@ -41,7 +41,3 @@ int mp_reduce_2k_setup(mp_int *a, mp_digit *d)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_reduce_2k_setup.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_reduce_2k_setup_l.c b/libtommath/bn_mp_reduce_2k_setup_l.c
index acff733..b59a1ed 100644
--- a/libtommath/bn_mp_reduce_2k_setup_l.c
+++ b/libtommath/bn_mp_reduce_2k_setup_l.c
@@ -38,7 +38,3 @@ ERR:
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_reduce_2k_setup_l.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_reduce_is_2k.c b/libtommath/bn_mp_reduce_is_2k.c
index e398e19..4655fcf 100644
--- a/libtommath/bn_mp_reduce_is_2k.c
+++ b/libtommath/bn_mp_reduce_is_2k.c
@@ -46,7 +46,3 @@ int mp_reduce_is_2k(mp_int *a)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_reduce_is_2k.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_reduce_is_2k_l.c b/libtommath/bn_mp_reduce_is_2k_l.c
index 82e972d..7b57865 100644
--- a/libtommath/bn_mp_reduce_is_2k_l.c
+++ b/libtommath/bn_mp_reduce_is_2k_l.c
@@ -38,7 +38,3 @@ int mp_reduce_is_2k_l(mp_int *a)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_reduce_is_2k_l.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_reduce_setup.c b/libtommath/bn_mp_reduce_setup.c
index 94bd26f..d8cefd9 100644
--- a/libtommath/bn_mp_reduce_setup.c
+++ b/libtommath/bn_mp_reduce_setup.c
@@ -28,7 +28,3 @@ int mp_reduce_setup (mp_int * a, mp_int * b)
return mp_div (a, b, a, NULL);
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_reduce_setup.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_rshd.c b/libtommath/bn_mp_rshd.c
index ebc8d5f..e6095b3 100644
--- a/libtommath/bn_mp_rshd.c
+++ b/libtommath/bn_mp_rshd.c
@@ -66,7 +66,3 @@ void mp_rshd (mp_int * a, int b)
a->used -= b;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_rshd.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_set.c b/libtommath/bn_mp_set.c
index 9cb64c7..c32fc42 100644
--- a/libtommath/bn_mp_set.c
+++ b/libtommath/bn_mp_set.c
@@ -23,7 +23,3 @@ void mp_set (mp_int * a, mp_digit b)
a->used = (a->dp[0] != 0) ? 1 : 0;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_set.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_set_int.c b/libtommath/bn_mp_set_int.c
index 106c4e2..b0fc344 100644
--- a/libtommath/bn_mp_set_int.c
+++ b/libtommath/bn_mp_set_int.c
@@ -42,7 +42,3 @@ int mp_set_int (mp_int * a, unsigned long b)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_set_int.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_shrink.c b/libtommath/bn_mp_shrink.c
index ddd72e3..bfdf93a 100644
--- a/libtommath/bn_mp_shrink.c
+++ b/libtommath/bn_mp_shrink.c
@@ -19,17 +19,18 @@
int mp_shrink (mp_int * a)
{
mp_digit *tmp;
- if (a->alloc != a->used && a->used > 0) {
- if ((tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * a->used)) == NULL) {
+ int used = 1;
+
+ if(a->used > 0)
+ used = a->used;
+
+ if (a->alloc != used) {
+ if ((tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * used)) == NULL) {
return MP_MEM;
}
a->dp = tmp;
- a->alloc = a->used;
+ a->alloc = used;
}
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_shrink.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_signed_bin_size.c b/libtommath/bn_mp_signed_bin_size.c
index 97fdb96..8f88e76 100644
--- a/libtommath/bn_mp_signed_bin_size.c
+++ b/libtommath/bn_mp_signed_bin_size.c
@@ -21,7 +21,3 @@ int mp_signed_bin_size (mp_int * a)
return 1 + mp_unsigned_bin_size (a);
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_signed_bin_size.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c
index 4e75bdb..3938537 100644
--- a/libtommath/bn_mp_sqr.c
+++ b/libtommath/bn_mp_sqr.c
@@ -52,7 +52,3 @@ if (a->used >= KARATSUBA_SQR_CUTOFF) {
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_sqr.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_sqrmod.c b/libtommath/bn_mp_sqrmod.c
index d0f0a79..6f90772 100644
--- a/libtommath/bn_mp_sqrmod.c
+++ b/libtommath/bn_mp_sqrmod.c
@@ -35,7 +35,3 @@ mp_sqrmod (mp_int * a, mp_int * b, mp_int * c)
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_sqrmod.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c
index aab357a..016b8ba 100644
--- a/libtommath/bn_mp_sqrt.c
+++ b/libtommath/bn_mp_sqrt.c
@@ -140,8 +140,3 @@ E2: mp_clear(&t1);
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_sqrt.c,v $ */
-/* Based on Tom's 1.3 */
-/* $Revision: 1.5.4.1 $ */
-/* $Date: 2008/10/05 21:25:23 $ */
diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c
index c0e2def..13cb43e 100644
--- a/libtommath/bn_mp_sub.c
+++ b/libtommath/bn_mp_sub.c
@@ -53,7 +53,3 @@ mp_sub (mp_int * a, mp_int * b, mp_int * c)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_sub.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c
index d979f35..b1e4e3f 100644
--- a/libtommath/bn_mp_sub_d.c
+++ b/libtommath/bn_mp_sub_d.c
@@ -87,7 +87,3 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int * c)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_sub_d.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_submod.c b/libtommath/bn_mp_submod.c
index 046e844..7461678 100644
--- a/libtommath/bn_mp_submod.c
+++ b/libtommath/bn_mp_submod.c
@@ -36,7 +36,3 @@ mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
return res;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_submod.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_to_signed_bin.c b/libtommath/bn_mp_to_signed_bin.c
index 066eb51..7871921 100644
--- a/libtommath/bn_mp_to_signed_bin.c
+++ b/libtommath/bn_mp_to_signed_bin.c
@@ -27,7 +27,3 @@ int mp_to_signed_bin (mp_int * a, unsigned char *b)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_to_signed_bin.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_to_signed_bin_n.c b/libtommath/bn_mp_to_signed_bin_n.c
index b1df632..8da9961 100644
--- a/libtommath/bn_mp_to_signed_bin_n.c
+++ b/libtommath/bn_mp_to_signed_bin_n.c
@@ -25,7 +25,3 @@ int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen)
return mp_to_signed_bin(a, b);
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_to_signed_bin_n.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_to_unsigned_bin.c b/libtommath/bn_mp_to_unsigned_bin.c
index d69de35..9496398 100644
--- a/libtommath/bn_mp_to_unsigned_bin.c
+++ b/libtommath/bn_mp_to_unsigned_bin.c
@@ -42,7 +42,3 @@ int mp_to_unsigned_bin (mp_int * a, unsigned char *b)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_to_unsigned_bin.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_to_unsigned_bin_n.c b/libtommath/bn_mp_to_unsigned_bin_n.c
index 5621960..4f2a31d 100644
--- a/libtommath/bn_mp_to_unsigned_bin_n.c
+++ b/libtommath/bn_mp_to_unsigned_bin_n.c
@@ -25,7 +25,3 @@ int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen)
return mp_to_unsigned_bin(a, b);
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_to_unsigned_bin_n.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_toom_mul.c b/libtommath/bn_mp_toom_mul.c
index 14d0705..9daefbd 100644
--- a/libtommath/bn_mp_toom_mul.c
+++ b/libtommath/bn_mp_toom_mul.c
@@ -278,7 +278,3 @@ ERR:
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_toom_mul.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c
index 14a235a..9e3f79c 100644
--- a/libtommath/bn_mp_toom_sqr.c
+++ b/libtommath/bn_mp_toom_sqr.c
@@ -220,7 +220,3 @@ ERR:
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_toom_sqr.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_toradix.c b/libtommath/bn_mp_toradix.c
index 1bd8819..132743e 100644
--- a/libtommath/bn_mp_toradix.c
+++ b/libtommath/bn_mp_toradix.c
@@ -69,7 +69,3 @@ int mp_toradix (mp_int * a, char *str, int radix)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_toradix.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_toradix_n.c b/libtommath/bn_mp_toradix_n.c
index 39d5101..dedce71 100644
--- a/libtommath/bn_mp_toradix_n.c
+++ b/libtommath/bn_mp_toradix_n.c
@@ -82,7 +82,3 @@ int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_toradix_n.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_unsigned_bin_size.c b/libtommath/bn_mp_unsigned_bin_size.c
index e79b91a..58c18fb 100644
--- a/libtommath/bn_mp_unsigned_bin_size.c
+++ b/libtommath/bn_mp_unsigned_bin_size.c
@@ -22,7 +22,3 @@ int mp_unsigned_bin_size (mp_int * a)
return (size / 8 + ((size & 7) != 0 ? 1 : 0));
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_unsigned_bin_size.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c
index bf40408..432f42e 100644
--- a/libtommath/bn_mp_xor.c
+++ b/libtommath/bn_mp_xor.c
@@ -45,7 +45,3 @@ mp_xor (mp_int * a, mp_int * b, mp_int * c)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_xor.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_mp_zero.c b/libtommath/bn_mp_zero.c
index 3cbd933..d697a60 100644
--- a/libtommath/bn_mp_zero.c
+++ b/libtommath/bn_mp_zero.c
@@ -30,7 +30,3 @@ void mp_zero (mp_int * a)
}
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_zero.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_prime_tab.c b/libtommath/bn_prime_tab.c
index 38cb592..c47c8bd 100644
--- a/libtommath/bn_prime_tab.c
+++ b/libtommath/bn_prime_tab.c
@@ -55,7 +55,3 @@ const mp_digit ltm_prime_tab[] = {
#endif
};
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_prime_tab.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_reverse.c b/libtommath/bn_reverse.c
index 3132f93..9d7fd29 100644
--- a/libtommath/bn_reverse.c
+++ b/libtommath/bn_reverse.c
@@ -33,7 +33,3 @@ bn_reverse (unsigned char *s, int len)
}
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_reverse.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c
index 7023300..7527bf8 100644
--- a/libtommath/bn_s_mp_add.c
+++ b/libtommath/bn_s_mp_add.c
@@ -103,7 +103,3 @@ s_mp_add (mp_int * a, mp_int * b, mp_int * c)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_s_mp_add.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_s_mp_exptmod.c b/libtommath/bn_s_mp_exptmod.c
index 7c6e304..ff6bd54 100644
--- a/libtommath/bn_s_mp_exptmod.c
+++ b/libtommath/bn_s_mp_exptmod.c
@@ -246,7 +246,3 @@ LBL_M:
return err;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_s_mp_exptmod.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_s_mp_mul_digs.c b/libtommath/bn_s_mp_mul_digs.c
index eb99e33..401f32e 100644
--- a/libtommath/bn_s_mp_mul_digs.c
+++ b/libtommath/bn_s_mp_mul_digs.c
@@ -84,7 +84,3 @@ int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_s_mp_mul_digs.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_s_mp_mul_high_digs.c b/libtommath/bn_s_mp_mul_high_digs.c
index 2ae9ee1..f4dca76 100644
--- a/libtommath/bn_s_mp_mul_high_digs.c
+++ b/libtommath/bn_s_mp_mul_high_digs.c
@@ -75,7 +75,3 @@ s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_s_mp_mul_high_digs.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c
index 0ae2869..464663f 100644
--- a/libtommath/bn_s_mp_sqr.c
+++ b/libtommath/bn_s_mp_sqr.c
@@ -78,7 +78,3 @@ int s_mp_sqr (mp_int * a, mp_int * b)
return MP_OKAY;
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_s_mp_sqr.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c
index 94375a0..328c9e5 100644
--- a/libtommath/bn_s_mp_sub.c
+++ b/libtommath/bn_s_mp_sub.c
@@ -83,7 +83,3 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_s_mp_sub.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
diff --git a/libtommath/bncore.c b/libtommath/bncore.c
index ac19aa6..eb95a2e 100644
--- a/libtommath/bncore.c
+++ b/libtommath/bncore.c
@@ -30,7 +30,3 @@ int KARATSUBA_MUL_CUTOFF = 80, /* Min. number of digits before Karatsub
TOOM_MUL_CUTOFF = 350, /* no optimal values of these are known yet so set em high */
TOOM_SQR_CUTOFF = 400;
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bncore.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2006/12/01 19:45:38 $ */
diff --git a/libtommath/changes.txt b/libtommath/changes.txt
index 9498d36..4fc0913 100644
--- a/libtommath/changes.txt
+++ b/libtommath/changes.txt
@@ -1,3 +1,17 @@
+July 23rd, 2010
+v0.42.0
+ -- Fix for mp_prime_next_prime() bug when checking generated prime
+ -- allow mp_shrink to shrink initialized, but empty MPI's
+ -- Added project and solution files for Visual Studio 2005 and Visual Studio 2008.
+
+March 10th, 2007
+v0.41 -- Wolfgang Ehrhardt suggested a quick fix to mp_div_d() which makes the detection of powers of two quicker.
+ -- [CRI] Added libtommath.dsp for Visual C++ users.
+
+December 24th, 2006
+v0.40 -- Updated makefile to properly support LIBNAME
+ -- Fixed bug in fast_s_mp_mul_high_digs() which overflowed (line 83), thanks Valgrind!
+
April 4th, 2006
v0.39 -- Jim Wigginton pointed out my Montgomery examples in figures 6.4 and 6.6 were off by one, k should be 9 not 8
-- Bruce Guenter suggested I use --tag=CC for libtool builds where the compiler may think it's C++.
diff --git a/libtommath/demo/demo.c b/libtommath/demo/demo.c
index 0555366..e1f8a5e 100644
--- a/libtommath/demo/demo.c
+++ b/libtommath/demo/demo.c
@@ -734,7 +734,3 @@ printf("compare no compare!\n"); exit(EXIT_FAILURE); }
}
return 0;
}
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/demo/demo.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2005/09/26 16:32:16 $ */
diff --git a/libtommath/demo/timing.c b/libtommath/demo/timing.c
index cf0f39c..bb3be52 100644
--- a/libtommath/demo/timing.c
+++ b/libtommath/demo/timing.c
@@ -313,7 +313,3 @@ int main(void)
return 0;
}
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/demo/timing.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2005/09/26 16:32:16 $ */
diff --git a/libtommath/etc/2kprime.c b/libtommath/etc/2kprime.c
index d8ea97c..67a2777 100644
--- a/libtommath/etc/2kprime.c
+++ b/libtommath/etc/2kprime.c
@@ -73,12 +73,3 @@ int main(void)
return 0;
}
-
-
-
-
-
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/etc/2kprime.c,v $ */
-/* $Revision: 1.1.1.2 $ */
-/* $Date: 2005/09/26 16:32:16 $ */
diff --git a/libtommath/etc/drprime.c b/libtommath/etc/drprime.c
index eec89ed..0d0fdb9 100644
--- a/libtommath/etc/drprime.c
+++ b/libtommath/etc/drprime.c
@@ -57,8 +57,3 @@ int main(void)
return 0;
}
-
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/etc/drprime.c,v $ */
-/* $Revision: 1.1.1.2 $ */
-/* $Date: 2005/09/26 16:32:16 $ */
diff --git a/libtommath/etc/drprimes.txt b/libtommath/etc/drprimes.txt
index 2c887ea..7c97f67 100644
--- a/libtommath/etc/drprimes.txt
+++ b/libtommath/etc/drprimes.txt
@@ -1,6 +1,9 @@
-280-bit prime:
-p == 1942668892225729070919461906823518906642406839052139521251812409738904285204940164839
+300-bit prime:
+p == 2037035976334486086268445688409378161051468393665936250636140449354381298610415201576637819
-532-bit prime:
-p == 14059105607947488696282932836518693308967803494693489478439861164411992439598399594747002144074658928593502845729752797260025831423419686528151609940203368691747
+540-bit prime:
+p == 3599131035634557106248430806148785487095757694641533306480604458089470064537190296255232548883112685719936728506816716098566612844395439751206810991770626477344739
+
+780-bit prime:
+p == 6359114106063703798370219984742410466332205126109989319225557147754704702203399726411277962562135973685197744935448875852478791860694279747355800678568677946181447581781401213133886609947027230004277244697462656003655947791725966271167
diff --git a/libtommath/etc/mersenne.c b/libtommath/etc/mersenne.c
index e4891c8..28ac834 100644
--- a/libtommath/etc/mersenne.c
+++ b/libtommath/etc/mersenne.c
@@ -138,7 +138,3 @@ main (void)
}
return 0;
}
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/etc/mersenne.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:28 $ */
diff --git a/libtommath/etc/mont.c b/libtommath/etc/mont.c
index c6a8e32..7839675 100644
--- a/libtommath/etc/mont.c
+++ b/libtommath/etc/mont.c
@@ -39,12 +39,3 @@ int main(void)
return 0;
}
-
-
-
-
-
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/etc/mont.c,v $ */
-/* $Revision: 1.1.1.2 $ */
-/* $Date: 2005/09/26 16:32:16 $ */
diff --git a/libtommath/etc/pprime.c b/libtommath/etc/pprime.c
index abb3c5a..955f19e 100644
--- a/libtommath/etc/pprime.c
+++ b/libtommath/etc/pprime.c
@@ -394,7 +394,3 @@ main (void)
return 0;
}
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/etc/pprime.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:28 $ */
diff --git a/libtommath/etc/tune.c b/libtommath/etc/tune.c
index 3088bdb..acb146f 100644
--- a/libtommath/etc/tune.c
+++ b/libtommath/etc/tune.c
@@ -136,7 +136,3 @@ main (void)
return 0;
}
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/etc/tune.c,v $ */
-/* $Revision: 1.1.1.4 $ */
-/* $Date: 2006/12/01 00:08:29 $ */
diff --git a/libtommath/logs/index.html b/libtommath/logs/index.html
index 2b65a0b..8c1ed9d 100644
--- a/libtommath/logs/index.html
+++ b/libtommath/logs/index.html
@@ -22,6 +22,3 @@
</body>
</html>
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/logs/index.html,v $ */
-/* $Revision: 1.1.1.2 $ */
-/* $Date: 2005/09/26 16:32:16 $ */
diff --git a/libtommath/makefile b/libtommath/makefile
index e08a888..70de306 100644
--- a/libtommath/makefile
+++ b/libtommath/makefile
@@ -3,7 +3,7 @@
#Tom St Denis
#version of library
-VERSION=0.39
+VERSION=0.42.0
CFLAGS += -I./ -Wall -W -Wshadow -Wsign-compare
@@ -40,12 +40,13 @@ else
USER=$(INSTALL_USER)
endif
-default: libtommath.a
-
#default files to install
ifndef LIBNAME
LIBNAME=libtommath.a
endif
+
+default: ${LIBNAME}
+
HEADERS=tommath.h tommath_class.h tommath_superclass.h
#LIBPATH-The directory for libtommath to be installed to.
diff --git a/libtommath/makefile.cygwin_dll b/libtommath/makefile.cygwin_dll
index dae65ae..85b10c7 100644
--- a/libtommath/makefile.cygwin_dll
+++ b/libtommath/makefile.cygwin_dll
@@ -49,7 +49,3 @@ windll: $(OBJECTS)
test: $(OBJECTS) windll
gcc $(CFLAGS) demo/demo.c libtommath.dll.a -Wl,--enable-auto-import -o test -s
cd mtest ; $(CC) -O3 -fomit-frame-pointer -funroll-loops mtest.c -o mtest -s
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/makefile.cygwin_dll,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2005/09/26 16:31:57 $ */
diff --git a/libtommath/makefile.shared b/libtommath/makefile.shared
index 8522d44..f17bbbd 100644
--- a/libtommath/makefile.shared
+++ b/libtommath/makefile.shared
@@ -1,7 +1,7 @@
#Makefile for GCC
#
#Tom St Denis
-VERSION=0:39
+VERSION=0:41
CC = libtool --mode=compile --tag=CC gcc
diff --git a/libtommath/mtest/logtab.h b/libtommath/mtest/logtab.h
index 4c8774c..addd3ab 100644
--- a/libtommath/mtest/logtab.h
+++ b/libtommath/mtest/logtab.h
@@ -17,8 +17,3 @@ const float s_logv_2[] = {
0.169293808, 0.168613099, 0.167948779, 0.167300179, /* 60 61 62 63 */
0.166666667
};
-
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/mtest/logtab.h,v $ */
-/* $Revision: 1.1.1.2 $ */
-/* $Date: 2005/09/26 16:32:17 $ */
diff --git a/libtommath/mtest/mpi-config.h b/libtommath/mtest/mpi-config.h
index e6ffbc4..a347263 100644
--- a/libtommath/mtest/mpi-config.h
+++ b/libtommath/mtest/mpi-config.h
@@ -1,5 +1,4 @@
/* Default configuration for MPI library */
-/* $Id: mpi-config.h,v 1.1.1.2 2005/09/26 16:32:17 kennykb Exp $ */
#ifndef MPI_CONFIG_H_
#define MPI_CONFIG_H_
@@ -84,7 +83,3 @@
/* crc==3287762869, version==2, Sat Feb 02 06:43:53 2002 */
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/mtest/mpi-config.h,v $ */
-/* $Revision: 1.1.1.2 $ */
-/* $Date: 2005/09/26 16:32:17 $ */
diff --git a/libtommath/mtest/mpi-types.h b/libtommath/mtest/mpi-types.h
index 96d5967..42ccfc3 100644
--- a/libtommath/mtest/mpi-types.h
+++ b/libtommath/mtest/mpi-types.h
@@ -13,8 +13,3 @@ typedef int mp_err;
#define MP_DIGIT_SIZE 2
#define DIGIT_FMT "%04X"
#define RADIX (MP_DIGIT_MAX+1)
-
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/mtest/mpi-types.h,v $ */
-/* $Revision: 1.1.1.2 $ */
-/* $Date: 2005/09/26 16:32:17 $ */
diff --git a/libtommath/mtest/mpi.c b/libtommath/mtest/mpi.c
index 1b6f114..4566e89 100644
--- a/libtommath/mtest/mpi.c
+++ b/libtommath/mtest/mpi.c
@@ -5,8 +5,6 @@
Copyright (C) 1998 Michael J. Fromberger, All Rights Reserved
Arbitrary precision integer arithmetic library
-
- $Id: mpi.c,v 1.1.1.2 2005/09/26 16:32:17 kennykb Exp $
*/
#include "mpi.h"
@@ -91,7 +89,7 @@ static unsigned int s_mp_defprec = MP_DEFPREC;
/* {{{ Constant strings */
/* Constant strings returned by mp_strerror() */
-static const char *mp_err_string[] = {
+static const char *const mp_err_string[] = {
"unknown result code", /* say what? */
"boolean true", /* MP_OKAY, MP_YES */
"boolean false", /* MP_NO */
@@ -3979,7 +3977,3 @@ int s_mp_outlen(int bits, int r)
/*------------------------------------------------------------------------*/
/* HERE THERE BE DRAGONS */
/* crc==4242132123, version==2, Sat Feb 02 06:43:52 2002 */
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/mtest/mpi.c,v $ */
-/* $Revision: 1.1.1.2 $ */
-/* $Date: 2005/09/26 16:32:17 $ */
diff --git a/libtommath/mtest/mpi.h b/libtommath/mtest/mpi.h
index 1bd0680..211421f 100644
--- a/libtommath/mtest/mpi.h
+++ b/libtommath/mtest/mpi.h
@@ -5,8 +5,6 @@
Copyright (C) 1998 Michael J. Fromberger, All Rights Reserved
Arbitrary precision integer arithmetic library
-
- $Id: mpi.h,v 1.1.1.2 2005/09/26 16:32:17 kennykb Exp $
*/
#ifndef _H_MPI_
@@ -225,7 +223,3 @@ int mp_char2value(char ch, int r);
const char *mp_strerror(mp_err ec);
#endif /* end _H_MPI_ */
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/mtest/mpi.h,v $ */
-/* $Revision: 1.1.1.2 $ */
-/* $Date: 2005/09/26 16:32:17 $ */
diff --git a/libtommath/mtest/mtest.c b/libtommath/mtest/mtest.c
index f18dc00..d46f456 100644
--- a/libtommath/mtest/mtest.c
+++ b/libtommath/mtest/mtest.c
@@ -302,7 +302,3 @@ int main(void)
fclose(rng);
return 0;
}
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/mtest/mtest.c,v $ */
-/* $Revision: 1.1.1.2 $ */
-/* $Date: 2005/09/26 16:32:17 $ */
diff --git a/libtommath/pre_gen/mpi.c b/libtommath/pre_gen/mpi.c
index 62ec029..d2224c0 100644
--- a/libtommath/pre_gen/mpi.c
+++ b/libtommath/pre_gen/mpi.c
@@ -43,10 +43,6 @@ char *mp_error_to_string(int code)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_error.c */
/* Start: bn_fast_mp_invmod.c */
@@ -195,10 +191,6 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL);
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_fast_mp_invmod.c */
/* Start: bn_fast_mp_montgomery_reduce.c */
@@ -371,10 +363,6 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_fast_mp_montgomery_reduce.c */
/* Start: bn_fast_s_mp_mul_digs.c */
@@ -482,10 +470,6 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_fast_s_mp_mul_digs.c */
/* Start: bn_fast_s_mp_mul_high_digs.c */
@@ -569,7 +553,7 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
register mp_digit *tmpc;
tmpc = c->dp + digs;
- for (ix = digs; ix <= pa; ix++) {
+ for (ix = digs; ix < pa; ix++) {
/* now extract the previous digit [below the carry] */
*tmpc++ = W[ix];
}
@@ -584,10 +568,6 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_fast_s_mp_mul_high_digs.c */
/* Start: bn_fast_s_mp_sqr.c */
@@ -702,10 +682,6 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_fast_s_mp_sqr.c */
/* Start: bn_mp_2expt.c */
@@ -754,10 +730,6 @@ mp_2expt (mp_int * a, int b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_2expt.c */
/* Start: bn_mp_abs.c */
@@ -801,10 +773,6 @@ mp_abs (mp_int * a, mp_int * b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_abs.c */
/* Start: bn_mp_add.c */
@@ -858,10 +826,6 @@ int mp_add (mp_int * a, mp_int * b, mp_int * c)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_add.c */
/* Start: bn_mp_add_d.c */
@@ -974,10 +938,6 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_add_d.c */
/* Start: bn_mp_addmod.c */
@@ -1019,10 +979,6 @@ mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_addmod.c */
/* Start: bn_mp_and.c */
@@ -1080,10 +1036,6 @@ mp_and (mp_int * a, mp_int * b, mp_int * c)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_and.c */
/* Start: bn_mp_clamp.c */
@@ -1128,10 +1080,6 @@ mp_clamp (mp_int * a)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_clamp.c */
/* Start: bn_mp_clear.c */
@@ -1176,10 +1124,6 @@ mp_clear (mp_int * a)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_clear.c */
/* Start: bn_mp_clear_multi.c */
@@ -1214,10 +1158,6 @@ void mp_clear_multi(mp_int *mp, ...)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_clear_multi.c */
/* Start: bn_mp_cmp.c */
@@ -1261,10 +1201,6 @@ mp_cmp (mp_int * a, mp_int * b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_cmp.c */
/* Start: bn_mp_cmp_d.c */
@@ -1309,10 +1245,6 @@ int mp_cmp_d(mp_int * a, mp_digit b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_cmp_d.c */
/* Start: bn_mp_cmp_mag.c */
@@ -1368,10 +1300,6 @@ int mp_cmp_mag (mp_int * a, mp_int * b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_cmp_mag.c */
/* Start: bn_mp_cnt_lsb.c */
@@ -1425,10 +1353,6 @@ int mp_cnt_lsb(mp_int *a)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_cnt_lsb.c */
/* Start: bn_mp_copy.c */
@@ -1497,10 +1421,6 @@ mp_copy (mp_int * a, mp_int * b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_copy.c */
/* Start: bn_mp_count_bits.c */
@@ -1546,10 +1466,6 @@ mp_count_bits (mp_int * a)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_count_bits.c */
/* Start: bn_mp_div.c */
@@ -1842,10 +1758,6 @@ LBL_Q:mp_clear (&q);
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_div.c */
/* Start: bn_mp_div_2.c */
@@ -1914,10 +1826,6 @@ int mp_div_2(mp_int * a, mp_int * b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_div_2.c */
/* Start: bn_mp_div_2d.c */
@@ -2015,10 +1923,6 @@ int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_div_2d.c */
/* Start: bn_mp_div_3.c */
@@ -2098,10 +2002,6 @@ mp_div_3 (mp_int * a, mp_int *c, mp_digit * d)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_div_3.c */
/* Start: bn_mp_div_d.c */
@@ -2126,7 +2026,12 @@ static int s_is_power_of_two(mp_digit b, int *p)
{
int x;
- for (x = 1; x < DIGIT_BIT; x++) {
+ /* fast return if no power of two */
+ if ((b==0) || (b & (b-1))) {
+ return 0;
+ }
+
+ for (x = 0; x < DIGIT_BIT; x++) {
if (b == (((mp_digit)1)<<x)) {
*p = x;
return 1;
@@ -2212,10 +2117,6 @@ int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_div_d.c */
/* Start: bn_mp_dr_is_modulus.c */
@@ -2259,10 +2160,6 @@ int mp_dr_is_modulus(mp_int *a)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_dr_is_modulus.c */
/* Start: bn_mp_dr_reduce.c */
@@ -2357,10 +2254,6 @@ top:
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_dr_reduce.c */
/* Start: bn_mp_dr_setup.c */
@@ -2393,10 +2286,6 @@ void mp_dr_setup(mp_int *a, mp_digit *d)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_dr_setup.c */
/* Start: bn_mp_exch.c */
@@ -2431,10 +2320,6 @@ mp_exch (mp_int * a, mp_int * b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_exch.c */
/* Start: bn_mp_expt_d.c */
@@ -2492,10 +2377,6 @@ int mp_expt_d (mp_int * a, mp_digit b, mp_int * c)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_expt_d.c */
/* Start: bn_mp_exptmod.c */
@@ -2608,10 +2489,6 @@ int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_exptmod.c */
/* Start: bn_mp_exptmod_fast.c */
@@ -2932,11 +2809,6 @@ LBL_M:
}
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_exptmod_fast.c */
/* Start: bn_mp_exteuclid.c */
@@ -3019,10 +2891,6 @@ _ERR: mp_clear_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_exteuclid.c */
/* Start: bn_mp_fread.c */
@@ -3090,10 +2958,6 @@ int mp_fread(mp_int *a, int radix, FILE *stream)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_fread.c */
/* Start: bn_mp_fwrite.c */
@@ -3146,10 +3010,6 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_fwrite.c */
/* Start: bn_mp_gcd.c */
@@ -3255,10 +3115,6 @@ LBL_U:mp_clear (&v);
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_gcd.c */
/* Start: bn_mp_get_int.c */
@@ -3304,10 +3160,6 @@ unsigned long mp_get_int(mp_int * a)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_get_int.c */
/* Start: bn_mp_grow.c */
@@ -3365,10 +3217,6 @@ int mp_grow (mp_int * a, int size)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_grow.c */
/* Start: bn_mp_init.c */
@@ -3415,10 +3263,6 @@ int mp_init (mp_int * a)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_init.c */
/* Start: bn_mp_init_copy.c */
@@ -3451,10 +3295,6 @@ int mp_init_copy (mp_int * a, mp_int * b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_init_copy.c */
/* Start: bn_mp_init_multi.c */
@@ -3514,10 +3354,6 @@ int mp_init_multi(mp_int *mp, ...)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_init_multi.c */
/* Start: bn_mp_init_set.c */
@@ -3550,10 +3386,6 @@ int mp_init_set (mp_int * a, mp_digit b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_init_set.c */
/* Start: bn_mp_init_set_int.c */
@@ -3585,10 +3417,6 @@ int mp_init_set_int (mp_int * a, unsigned long b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_init_set_int.c */
/* Start: bn_mp_init_size.c */
@@ -3637,10 +3465,6 @@ int mp_init_size (mp_int * a, int size)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_init_size.c */
/* Start: bn_mp_invmod.c */
@@ -3684,10 +3508,6 @@ int mp_invmod (mp_int * a, mp_int * b, mp_int * c)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_invmod.c */
/* Start: bn_mp_invmod_slow.c */
@@ -3863,10 +3683,6 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL);
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_invmod_slow.c */
/* Start: bn_mp_is_square.c */
@@ -3976,10 +3792,6 @@ ERR:mp_clear(&t);
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_is_square.c */
/* Start: bn_mp_jacobi.c */
@@ -4085,10 +3897,6 @@ LBL_A1:mp_clear (&a1);
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_jacobi.c */
/* Start: bn_mp_karatsuba_mul.c */
@@ -4256,10 +4064,6 @@ ERR:
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_karatsuba_mul.c */
/* Start: bn_mp_karatsuba_sqr.c */
@@ -4381,10 +4185,6 @@ ERR:
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_karatsuba_sqr.c */
/* Start: bn_mp_lcm.c */
@@ -4445,10 +4245,6 @@ LBL_T:
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_lcm.c */
/* Start: bn_mp_lshd.c */
@@ -4516,10 +4312,6 @@ int mp_lshd (mp_int * a, int b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_lshd.c */
/* Start: bn_mp_mod.c */
@@ -4568,10 +4360,6 @@ mp_mod (mp_int * a, mp_int * b, mp_int * c)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_mod.c */
/* Start: bn_mp_mod_2d.c */
@@ -4627,10 +4415,6 @@ mp_mod_2d (mp_int * a, int b, mp_int * c)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_mod_2d.c */
/* Start: bn_mp_mod_d.c */
@@ -4658,10 +4442,6 @@ mp_mod_d (mp_int * a, mp_digit b, mp_digit * c)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_mod_d.c */
/* Start: bn_mp_montgomery_calc_normalization.c */
@@ -4721,10 +4501,6 @@ int mp_montgomery_calc_normalization (mp_int * a, mp_int * b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_montgomery_calc_normalization.c */
/* Start: bn_mp_montgomery_reduce.c */
@@ -4843,10 +4619,6 @@ mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_montgomery_reduce.c */
/* Start: bn_mp_montgomery_setup.c */
@@ -4900,16 +4672,12 @@ mp_montgomery_setup (mp_int * n, mp_digit * rho)
#endif
/* rho = -1/m mod b */
- *rho = (((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK;
+ *rho = (unsigned long)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK;
return MP_OKAY;
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_montgomery_setup.c */
/* Start: bn_mp_mul.c */
@@ -4976,10 +4744,6 @@ int mp_mul (mp_int * a, mp_int * b, mp_int * c)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_mul.c */
/* Start: bn_mp_mul_2.c */
@@ -5062,10 +4826,6 @@ int mp_mul_2(mp_int * a, mp_int * b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_mul_2.c */
/* Start: bn_mp_mul_2d.c */
@@ -5151,10 +4911,6 @@ int mp_mul_2d (mp_int * a, int b, mp_int * c)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_mul_2d.c */
/* Start: bn_mp_mul_d.c */
@@ -5234,10 +4990,6 @@ mp_mul_d (mp_int * a, mp_digit b, mp_int * c)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_mul_d.c */
/* Start: bn_mp_mulmod.c */
@@ -5278,10 +5030,6 @@ int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_mulmod.c */
/* Start: bn_mp_n_root.c */
@@ -5414,10 +5162,6 @@ LBL_T1:mp_clear (&t1);
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_n_root.c */
/* Start: bn_mp_neg.c */
@@ -5458,10 +5202,6 @@ int mp_neg (mp_int * a, mp_int * b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_neg.c */
/* Start: bn_mp_or.c */
@@ -5512,10 +5252,6 @@ int mp_or (mp_int * a, mp_int * b, mp_int * c)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_or.c */
/* Start: bn_mp_prime_fermat.c */
@@ -5578,10 +5314,6 @@ LBL_T:mp_clear (&t);
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_prime_fermat.c */
/* Start: bn_mp_prime_is_divisible.c */
@@ -5632,10 +5364,6 @@ int mp_prime_is_divisible (mp_int * a, int *result)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_prime_is_divisible.c */
/* Start: bn_mp_prime_is_prime.c */
@@ -5719,10 +5447,6 @@ LBL_B:mp_clear (&b);
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_prime_is_prime.c */
/* Start: bn_mp_prime_miller_rabin.c */
@@ -5826,10 +5550,6 @@ LBL_N1:mp_clear (&n1);
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_prime_miller_rabin.c */
/* Start: bn_mp_prime_next_prime.c */
@@ -5978,7 +5698,7 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style)
/* is this prime? */
for (x = 0; x < t; x++) {
- mp_set(&b, ltm_prime_tab[t]);
+ mp_set(&b, ltm_prime_tab[x]);
if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) {
goto LBL_ERR;
}
@@ -6000,10 +5720,6 @@ LBL_ERR:
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_prime_next_prime.c */
/* Start: bn_mp_prime_rabin_miller_trials.c */
@@ -6056,10 +5772,6 @@ int mp_prime_rabin_miller_trials(int size)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_prime_rabin_miller_trials.c */
/* Start: bn_mp_prime_random_ex.c */
@@ -6185,10 +5897,6 @@ error:
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_prime_random_ex.c */
/* Start: bn_mp_radix_size.c */
@@ -6267,10 +5975,6 @@ int mp_radix_size (mp_int * a, int radix, int *size)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_radix_size.c */
/* Start: bn_mp_radix_smap.c */
@@ -6295,10 +5999,6 @@ int mp_radix_size (mp_int * a, int radix, int *size)
const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_radix_smap.c */
/* Start: bn_mp_rand.c */
@@ -6354,10 +6054,6 @@ mp_rand (mp_int * a, int digits)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_rand.c */
/* Start: bn_mp_read_radix.c */
@@ -6443,10 +6139,6 @@ int mp_read_radix (mp_int * a, const char *str, int radix)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_read_radix.c */
/* Start: bn_mp_read_signed_bin.c */
@@ -6488,10 +6180,6 @@ int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_read_signed_bin.c */
/* Start: bn_mp_read_unsigned_bin.c */
@@ -6547,10 +6235,6 @@ int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_read_unsigned_bin.c */
/* Start: bn_mp_reduce.c */
@@ -6651,10 +6335,6 @@ CLEANUP:
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_reduce.c */
/* Start: bn_mp_reduce_2k.c */
@@ -6716,10 +6396,6 @@ ERR:
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_reduce_2k.c */
/* Start: bn_mp_reduce_2k_l.c */
@@ -6782,10 +6458,6 @@ ERR:
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_reduce_2k_l.c */
/* Start: bn_mp_reduce_2k_setup.c */
@@ -6833,10 +6505,6 @@ int mp_reduce_2k_setup(mp_int *a, mp_digit *d)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_reduce_2k_setup.c */
/* Start: bn_mp_reduce_2k_setup_l.c */
@@ -6881,10 +6549,6 @@ ERR:
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_reduce_2k_setup_l.c */
/* Start: bn_mp_reduce_is_2k.c */
@@ -6937,10 +6601,6 @@ int mp_reduce_is_2k(mp_int *a)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_reduce_is_2k.c */
/* Start: bn_mp_reduce_is_2k_l.c */
@@ -6985,10 +6645,6 @@ int mp_reduce_is_2k_l(mp_int *a)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_reduce_is_2k_l.c */
/* Start: bn_mp_reduce_setup.c */
@@ -7023,10 +6679,6 @@ int mp_reduce_setup (mp_int * a, mp_int * b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_reduce_setup.c */
/* Start: bn_mp_rshd.c */
@@ -7099,10 +6751,6 @@ void mp_rshd (mp_int * a, int b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_rshd.c */
/* Start: bn_mp_set.c */
@@ -7132,10 +6780,6 @@ void mp_set (mp_int * a, mp_digit b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_set.c */
/* Start: bn_mp_set_int.c */
@@ -7184,10 +6828,6 @@ int mp_set_int (mp_int * a, unsigned long b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_set_int.c */
/* Start: bn_mp_shrink.c */
@@ -7212,21 +6852,22 @@ int mp_set_int (mp_int * a, unsigned long b)
int mp_shrink (mp_int * a)
{
mp_digit *tmp;
- if (a->alloc != a->used && a->used > 0) {
- if ((tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * a->used)) == NULL) {
+ int used = 1;
+
+ if(a->used > 0)
+ used = a->used;
+
+ if (a->alloc != used) {
+ if ((tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * used)) == NULL) {
return MP_MEM;
}
a->dp = tmp;
- a->alloc = a->used;
+ a->alloc = used;
}
return MP_OKAY;
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_shrink.c */
/* Start: bn_mp_signed_bin_size.c */
@@ -7254,10 +6895,6 @@ int mp_signed_bin_size (mp_int * a)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_signed_bin_size.c */
/* Start: bn_mp_sqr.c */
@@ -7316,10 +6953,6 @@ if (a->used >= KARATSUBA_SQR_CUTOFF) {
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_sqr.c */
/* Start: bn_mp_sqrmod.c */
@@ -7361,14 +6994,11 @@ mp_sqrmod (mp_int * a, mp_int * b, mp_int * c)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_sqrmod.c */
/* Start: bn_mp_sqrt.c */
#include <tommath.h>
+
#ifdef BN_MP_SQRT_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
@@ -7446,10 +7076,6 @@ E2: mp_clear(&t1);
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_sqrt.c */
/* Start: bn_mp_sub.c */
@@ -7509,10 +7135,6 @@ mp_sub (mp_int * a, mp_int * b, mp_int * c)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_sub.c */
/* Start: bn_mp_sub_d.c */
@@ -7606,10 +7228,6 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int * c)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_sub_d.c */
/* Start: bn_mp_submod.c */
@@ -7652,10 +7270,6 @@ mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_submod.c */
/* Start: bn_mp_to_signed_bin.c */
@@ -7689,10 +7303,6 @@ int mp_to_signed_bin (mp_int * a, unsigned char *b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_to_signed_bin.c */
/* Start: bn_mp_to_signed_bin_n.c */
@@ -7724,10 +7334,6 @@ int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_to_signed_bin_n.c */
/* Start: bn_mp_to_unsigned_bin.c */
@@ -7776,10 +7382,6 @@ int mp_to_unsigned_bin (mp_int * a, unsigned char *b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_to_unsigned_bin.c */
/* Start: bn_mp_to_unsigned_bin_n.c */
@@ -7811,10 +7413,6 @@ int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_to_unsigned_bin_n.c */
/* Start: bn_mp_toom_mul.c */
@@ -8099,10 +7697,6 @@ ERR:
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_toom_mul.c */
/* Start: bn_mp_toom_sqr.c */
@@ -8329,10 +7923,6 @@ ERR:
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_toom_sqr.c */
/* Start: bn_mp_toradix.c */
@@ -8408,10 +7998,6 @@ int mp_toradix (mp_int * a, char *str, int radix)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_toradix.c */
/* Start: bn_mp_toradix_n.c */
@@ -8500,10 +8086,6 @@ int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_toradix_n.c */
/* Start: bn_mp_unsigned_bin_size.c */
@@ -8532,10 +8114,6 @@ int mp_unsigned_bin_size (mp_int * a)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_unsigned_bin_size.c */
/* Start: bn_mp_xor.c */
@@ -8587,10 +8165,6 @@ mp_xor (mp_int * a, mp_int * b, mp_int * c)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_xor.c */
/* Start: bn_mp_zero.c */
@@ -8627,10 +8201,6 @@ void mp_zero (mp_int * a)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_mp_zero.c */
/* Start: bn_prime_tab.c */
@@ -8692,10 +8262,6 @@ const mp_digit ltm_prime_tab[] = {
};
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_prime_tab.c */
/* Start: bn_reverse.c */
@@ -8735,10 +8301,6 @@ bn_reverse (unsigned char *s, int len)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_reverse.c */
/* Start: bn_s_mp_add.c */
@@ -8848,10 +8410,6 @@ s_mp_add (mp_int * a, mp_int * b, mp_int * c)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_s_mp_add.c */
/* Start: bn_s_mp_exptmod.c */
@@ -9104,10 +8662,6 @@ LBL_M:
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_s_mp_exptmod.c */
/* Start: bn_s_mp_mul_digs.c */
@@ -9198,10 +8752,6 @@ int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_s_mp_mul_digs.c */
/* Start: bn_s_mp_mul_high_digs.c */
@@ -9283,10 +8833,6 @@ s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_s_mp_mul_high_digs.c */
/* Start: bn_s_mp_sqr.c */
@@ -9371,10 +8917,6 @@ int s_mp_sqr (mp_int * a, mp_int * b)
}
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_s_mp_sqr.c */
/* Start: bn_s_mp_sub.c */
@@ -9464,10 +9006,6 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bn_s_mp_sub.c */
/* Start: bncore.c */
@@ -9504,10 +9042,6 @@ int KARATSUBA_MUL_CUTOFF = 80, /* Min. number of digits before Karatsub
TOOM_SQR_CUTOFF = 400;
#endif
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/pre_gen/mpi.c,v $ */
-/* $Revision: 1.1.1.5 $ */
-/* $Date: 2006/12/01 00:08:34 $ */
-
/* End: bncore.c */
diff --git a/libtommath/tommath.h b/libtommath/tommath.h
index 82d9814..4b3a76f 100644
--- a/libtommath/tommath.h
+++ b/libtommath/tommath.h
@@ -24,11 +24,11 @@
#include <tommath_class.h>
#ifndef MIN
- #define MIN(x,y) ((x)<(y)?(x):(y))
+# define MIN(x,y) ((x)<(y)?(x):(y))
#endif
#ifndef MAX
- #define MAX(x,y) ((x)>(y)?(x):(y))
+# define MAX(x,y) ((x)>(y)?(x):(y))
#endif
#ifdef __cplusplus
@@ -47,9 +47,9 @@ extern "C" {
/* detect 64-bit mode if possible */
#if defined(__x86_64__)
- #if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT))
- #define MP_64BIT
- #endif
+# if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT))
+# define MP_64BIT
+# endif
#endif
/* some default configurations.
@@ -76,19 +76,19 @@ extern "C" {
typedef unsigned long mp_digit;
typedef unsigned long mp_word __attribute__ ((mode(TI)));
- #define DIGIT_BIT 60
+# define DIGIT_BIT 60
#else
/* this is the default case, 28-bit digits */
/* this is to make porting into LibTomCrypt easier :-) */
#ifndef CRYPT
- #if defined(_MSC_VER) || defined(__BORLANDC__)
+# if defined(_MSC_VER) || defined(__BORLANDC__)
typedef unsigned __int64 ulong64;
typedef signed __int64 long64;
- #else
+# else
typedef unsigned long long ulong64;
typedef signed long long long64;
- #endif
+# endif
#endif
typedef unsigned long mp_digit;
@@ -96,35 +96,35 @@ extern "C" {
#ifdef MP_31BIT
/* this is an extension that uses 31-bit digits */
- #define DIGIT_BIT 31
+# define DIGIT_BIT 31
#else
/* default case is 28-bit digits, defines MP_28BIT as a handy macro to test */
- #define DIGIT_BIT 28
- #define MP_28BIT
+# define DIGIT_BIT 28
+# define MP_28BIT
#endif
#endif
/* define heap macros */
#ifndef CRYPT
/* default to libc stuff */
- #ifndef XMALLOC
- #define XMALLOC malloc
- #define XFREE free
- #define XREALLOC realloc
- #define XCALLOC calloc
- #else
+# ifndef XMALLOC
+# define XMALLOC malloc
+# define XFREE free
+# define XREALLOC realloc
+# define XCALLOC calloc
+# else
/* prototypes for our heap functions */
extern void *XMALLOC(size_t n);
extern void *XREALLOC(void *p, size_t n);
extern void *XCALLOC(size_t n, size_t s);
extern void XFREE(void *p);
- #endif
+# endif
#endif
/* otherwise the bits per digit is calculated automatically from the size of a mp_digit */
#ifndef DIGIT_BIT
- #define DIGIT_BIT ((int)((CHAR_BIT * sizeof(mp_digit) - 1))) /* bits per digit */
+# define DIGIT_BIT ((int)((CHAR_BIT * sizeof(mp_digit) - 1))) /* bits per digit */
#endif
#define MP_DIGIT_BIT DIGIT_BIT
@@ -165,11 +165,11 @@ extern int KARATSUBA_MUL_CUTOFF,
/* 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
+# ifndef MP_LOW_MEM
+# define MP_PREC 32 /* default digits of precision */
+# else
+# define MP_PREC 8 /* default digits of precision */
+# endif
#endif
/* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */
@@ -241,7 +241,7 @@ int mp_init_set (mp_int * a, mp_digit b);
int mp_init_set_int (mp_int * a, unsigned long b);
/* copy, b = a */
-int mp_copy(mp_int *a, mp_int *b);
+int mp_copy(const mp_int *a, mp_int *b);
/* inits and copies, a = b */
int mp_init_copy(mp_int *a, mp_int *b);
@@ -258,19 +258,19 @@ void mp_rshd(mp_int *a, int b);
int mp_lshd(mp_int *a, int b);
/* c = a / 2**b */
-int mp_div_2d(mp_int *a, int b, mp_int *c, mp_int *d);
+int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d);
/* b = a/2 */
int mp_div_2(mp_int *a, mp_int *b);
/* c = a * 2**b */
-int mp_mul_2d(mp_int *a, int b, mp_int *c);
+int mp_mul_2d(const mp_int *a, int b, mp_int *c);
/* b = a*2 */
int mp_mul_2(mp_int *a, mp_int *b);
/* c = a mod 2**d */
-int mp_mod_2d(mp_int *a, int b, mp_int *c);
+int mp_mod_2d(const mp_int *a, int b, mp_int *c);
/* computes a = 2**b */
int mp_2expt(mp_int *a, int b);
@@ -296,16 +296,16 @@ int mp_and(mp_int *a, mp_int *b, mp_int *c);
/* ---> Basic arithmetic <--- */
/* b = -a */
-int mp_neg(mp_int *a, mp_int *b);
+int mp_neg(const mp_int *a, mp_int *b);
/* b = |a| */
int mp_abs(mp_int *a, mp_int *b);
/* compare a to b */
-int mp_cmp(mp_int *a, mp_int *b);
+int mp_cmp(const mp_int *a, const mp_int *b);
/* compare |a| to |b| */
-int mp_cmp_mag(mp_int *a, mp_int *b);
+int mp_cmp_mag(const mp_int *a, const mp_int *b);
/* c = a + b */
int mp_add(mp_int *a, mp_int *b, mp_int *c);
@@ -328,7 +328,7 @@ int mp_mod(mp_int *a, mp_int *b, mp_int *c);
/* ---> single digit functions <--- */
/* compare against a single digit */
-int mp_cmp_d(mp_int *a, mp_digit b);
+int mp_cmp_d(const mp_int *a, mp_digit b);
/* c = a + b */
int mp_add_d(mp_int *a, mp_digit b, mp_int *c);
@@ -447,9 +447,9 @@ int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d);
/* number of primes */
#ifdef MP_8BIT
- #define PRIME_SIZE 31
+# define PRIME_SIZE 31
#else
- #define PRIME_SIZE 256
+# define PRIME_SIZE 256
#endif
/* table of first PRIME_SIZE primes */
@@ -517,7 +517,7 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style);
int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat);
/* ---> radix conversion <--- */
-int mp_count_bits(mp_int *a);
+int mp_count_bits(const mp_int *a);
int mp_unsigned_bin_size(mp_int *a);
int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c);
@@ -573,13 +573,7 @@ void bn_reverse(unsigned char *s, int len);
extern const char *mp_s_rmap;
#ifdef __cplusplus
- }
+}
#endif
#endif
-
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/tommath.h,v $ */
-/* Based on Tom's version 1.8 */
-/* $Revision: 1.4 $ */
-/* $Date: 2006/12/01 00:31:32 $ */
diff --git a/libtommath/tommath_class.h b/libtommath/tommath_class.h
index 649e823..b9cc902 100644
--- a/libtommath/tommath_class.h
+++ b/libtommath/tommath_class.h
@@ -993,7 +993,3 @@
#else
#define LTM_LAST
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/tommath_class.h,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2006/12/01 19:45:39 $ */
diff --git a/libtommath/tommath_superclass.h b/libtommath/tommath_superclass.h
index ffbb8e1..e3926df 100644
--- a/libtommath/tommath_superclass.h
+++ b/libtommath/tommath_superclass.h
@@ -70,7 +70,3 @@
#endif
#endif
-
-/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/tommath_superclass.h,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2005/09/26 18:27:14 $ */