Skip to content

Commit

Permalink
added libtommath-0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom St Denis authored and sjaeckel committed Jul 15, 2010
1 parent b66471f commit 82f4858
Show file tree
Hide file tree
Showing 94 changed files with 601 additions and 419 deletions.
Binary file modified bn.pdf
Binary file not shown.
203 changes: 104 additions & 99 deletions bn.tex

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bn_fast_mp_invmod.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
16 changes: 10 additions & 6 deletions bn_fast_mp_montgomery_reduce.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down Expand Up @@ -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); 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_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 /* copy out, A = A/b^n
* *
Expand Down
2 changes: 1 addition & 1 deletion bn_fast_s_mp_mul_digs.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_fast_s_mp_mul_high_digs.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_fast_s_mp_sqr.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_2expt.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_abs.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_add.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_add_d.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_addmod.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_and.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_clamp.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_clear.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_cmp.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_cmp_d.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_cmp_mag.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_copy.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_count_bits.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_div.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
3 changes: 2 additions & 1 deletion bn_mp_div_2.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down Expand Up @@ -46,6 +46,7 @@ mp_div_2 (mp_int * a, mp_int * b)
*tmpb++ = 0; *tmpb++ = 0;
} }
} }
b->sign = a->sign;
mp_clamp (b); mp_clamp (b);
return MP_OKAY; return MP_OKAY;
} }
6 changes: 4 additions & 2 deletions bn_mp_div_2d.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down Expand Up @@ -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 */ /* 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 */ /* shift any bit count < DIGIT_BIT */
D = (mp_digit) (b % DIGIT_BIT); D = (mp_digit) (b % DIGIT_BIT);
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_div_d.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_exch.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_expt_d.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_exptmod.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_exptmod_fast.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_gcd.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_grow.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_init.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_init_copy.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_init_size.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_invmod.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_jacobi.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The library is free for all purposes without any express * The library is free for all purposes without any express
* guarantee it works. * 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> #include <tommath.h>


Expand Down
Loading

0 comments on commit 82f4858

Please sign in to comment.