Permalink
Browse files

added libtommath-0.14

  • Loading branch information...
1 parent b66471f commit 82f4858291901582b7975bd46c349860c6ee1858 Tom St Denis committed with sjaeckel Mar 13, 2003
Showing with 601 additions and 419 deletions.
  1. BIN bn.pdf
  2. +104 −99 bn.tex
  3. +1 −1 bn_fast_mp_invmod.c
  4. +10 −6 bn_fast_mp_montgomery_reduce.c
  5. +1 −1 bn_fast_s_mp_mul_digs.c
  6. +1 −1 bn_fast_s_mp_mul_high_digs.c
  7. +1 −1 bn_fast_s_mp_sqr.c
  8. +1 −1 bn_mp_2expt.c
  9. +1 −1 bn_mp_abs.c
  10. +1 −1 bn_mp_add.c
  11. +1 −1 bn_mp_add_d.c
  12. +1 −1 bn_mp_addmod.c
  13. +1 −1 bn_mp_and.c
  14. +1 −1 bn_mp_clamp.c
  15. +1 −1 bn_mp_clear.c
  16. +1 −1 bn_mp_cmp.c
  17. +1 −1 bn_mp_cmp_d.c
  18. +1 −1 bn_mp_cmp_mag.c
  19. +1 −1 bn_mp_copy.c
  20. +1 −1 bn_mp_count_bits.c
  21. +1 −1 bn_mp_div.c
  22. +2 −1 bn_mp_div_2.c
  23. +4 −2 bn_mp_div_2d.c
  24. +1 −1 bn_mp_div_d.c
  25. +1 −1 bn_mp_exch.c
  26. +1 −1 bn_mp_expt_d.c
  27. +1 −1 bn_mp_exptmod.c
  28. +1 −1 bn_mp_exptmod_fast.c
  29. +1 −1 bn_mp_gcd.c
  30. +1 −1 bn_mp_grow.c
  31. +1 −1 bn_mp_init.c
  32. +1 −1 bn_mp_init_copy.c
  33. +1 −1 bn_mp_init_size.c
  34. +1 −1 bn_mp_invmod.c
  35. +1 −1 bn_mp_jacobi.c
  36. +32 −19 bn_mp_karatsuba_mul.c
  37. +22 −14 bn_mp_karatsuba_sqr.c
  38. +1 −1 bn_mp_lcm.c
  39. +25 −10 bn_mp_lshd.c
  40. +1 −1 bn_mp_mod.c
  41. +1 −1 bn_mp_mod_2d.c
  42. +1 −1 bn_mp_mod_d.c
  43. +1 −1 bn_mp_montgomery_calc_normalization.c
  44. +1 −1 bn_mp_montgomery_reduce.c
  45. +19 −26 bn_mp_montgomery_setup.c
  46. +1 −1 bn_mp_mul.c
  47. +7 −1 bn_mp_mul_2.c
  48. +6 −4 bn_mp_mul_2d.c
  49. +1 −1 bn_mp_mul_d.c
  50. +1 −1 bn_mp_mulmod.c
  51. +1 −1 bn_mp_n_root.c
  52. +1 −1 bn_mp_neg.c
  53. +1 −1 bn_mp_or.c
  54. +1 −1 bn_mp_rand.c
  55. +1 −1 bn_mp_read_signed_bin.c
  56. +1 −1 bn_mp_read_unsigned_bin.c
  57. +1 −1 bn_mp_reduce.c
  58. +28 −9 bn_mp_rshd.c
  59. +1 −1 bn_mp_set.c
  60. +1 −1 bn_mp_set_int.c
  61. +1 −1 bn_mp_shrink.c
  62. +1 −1 bn_mp_signed_bin_size.c
  63. +1 −1 bn_mp_sqr.c
  64. +1 −1 bn_mp_sqrmod.c
  65. +1 −1 bn_mp_sub.c
  66. +1 −1 bn_mp_sub_d.c
  67. +1 −1 bn_mp_submod.c
  68. +1 −1 bn_mp_to_signed_bin.c
  69. +1 −1 bn_mp_to_unsigned_bin.c
  70. +1 −1 bn_mp_unsigned_bin_size.c
  71. +1 −1 bn_mp_xor.c
  72. +1 −1 bn_mp_zero.c
  73. +1 −1 bn_radix.c
  74. +1 −1 bn_reverse.c
  75. +7 −1 bn_s_mp_add.c
  76. +1 −1 bn_s_mp_mul_digs.c
  77. +1 −1 bn_s_mp_mul_high_digs.c
  78. +1 −1 bn_s_mp_sqr.c
  79. +1 −1 bn_s_mp_sub.c
  80. +7 −4 bncore.c
  81. +13 −0 changes.txt
  82. +85 −31 demo/demo.c
  83. +1 −1 etc/makefile
  84. +14 −0 etc/makefile.msvc
  85. +9 −9 etc/mersenne.c
  86. +10 −10 etc/pprime.c
  87. +78 −22 etc/tune.c
  88. +2 −2 makefile
  89. +26 −0 makefile.msvc
  90. +23 −4 mtest/mtest.c
  91. +0 −36 timings.txt
  92. +0 −36 timings2.txt
  93. +0 −5 timings3.txt
  94. +1 −1 tommath.h
View
BIN bn.pdf
Binary file not shown.
View
203 bn.tex

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
@@ -100,14 +100,18 @@ fast_mp_montgomery_reduce (mp_int * a, mp_int * m, mp_digit mp)
W[ix + 1] += W[ix] >> ((mp_word) DIGIT_BIT);
}
- /* nox fix rest of carries */
- for (++ix; ix <= m->used * 2 + 1; ix++) {
- W[ix] += (W[ix - 1] >> ((mp_word) DIGIT_BIT));
- }
{
register mp_digit *tmpa;
- register mp_word *_W;
+ register mp_word *_W, *_W1;
+
+ /* nox fix rest of carries */
+ _W1 = W + ix;
+ _W = W + ++ix;
+
+ for (; ix <= m->used * 2 + 1; ix++) {
+ *_W++ += *_W1++ >> ((mp_word) DIGIT_BIT);
+ }
/* copy out, A = A/b^n
*
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
@@ -46,6 +46,7 @@ mp_div_2 (mp_int * a, mp_int * b)
*tmpb++ = 0;
}
}
+ b->sign = a->sign;
mp_clamp (b);
return MP_OKAY;
}
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
@@ -51,7 +51,9 @@ mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d)
}
/* shift by as many digits in the bit count */
- mp_rshd (c, b / DIGIT_BIT);
+ if (b >= DIGIT_BIT) {
+ mp_rshd (c, b / DIGIT_BIT);
+ }
/* shift any bit count < DIGIT_BIT */
D = (mp_digit) (b % DIGIT_BIT);
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
View
@@ -10,7 +10,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@iahu.ca, http://libtommath.iahu.ca
+ * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
*/
#include <tommath.h>
Oops, something went wrong.

0 comments on commit 82f4858

Please sign in to comment.