Skip to content

Commit

Permalink
added libtommath-0.41
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 3aba4ea commit 333aebc
Show file tree
Hide file tree
Showing 129 changed files with 939 additions and 4,536 deletions.
Binary file modified bn.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion bn.tex
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
\begin{document}
\frontmatter
\pagestyle{empty}
\title{LibTomMath User Manual \\ v0.40}
\title{LibTomMath User Manual \\ v0.41}
\author{Tom St Denis \\ [email protected]}
\maketitle
This text, the library and the accompanying textbook are all hereby placed in the public domain. This book has been
Expand Down
2 changes: 1 addition & 1 deletion bn_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

static const struct {
Expand Down
2 changes: 1 addition & 1 deletion bn_fast_mp_invmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* computes the modular inverse via binary extended euclidean algorithm,
Expand Down
2 changes: 1 addition & 1 deletion bn_fast_mp_montgomery_reduce.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* computes xR**-1 == x (mod N) via Montgomery Reduction
Expand Down
2 changes: 1 addition & 1 deletion bn_fast_s_mp_mul_digs.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* Fast (comba) multiplier
Expand Down
2 changes: 1 addition & 1 deletion bn_fast_s_mp_mul_high_digs.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* this is a modified version of fast_s_mul_digs that only produces
Expand Down
2 changes: 1 addition & 1 deletion bn_fast_s_mp_sqr.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* the jist of squaring...
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_2expt.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* computes a = 2**b
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_abs.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* b = |a|
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_add.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* high level addition (handles signs) */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_add_d.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* single digit addition */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_addmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* d = a + b (mod c) */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_and.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* AND two ints together */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_clamp.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* trim unused digits
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_clear.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* clear one (frees) */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_clear_multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/
#include <stdarg.h>

Expand Down
2 changes: 1 addition & 1 deletion bn_mp_cmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* compare two ints (signed)*/
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_cmp_d.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* compare a digit */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_cmp_mag.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* compare maginitude of two ints (unsigned) */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_cnt_lsb.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

static const int lnz[16] = {
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* copy, b = a */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_count_bits.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* returns the number of bits in an int */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_div.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

#ifdef BN_MP_DIV_SMALL
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_div_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* b = a/2 */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_div_2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* shift right by a certain bit count (store quotient in c, optional remainder in d) */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_div_3.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* divide by three (based on routine from MPI and the GMP manual) */
Expand Down
9 changes: 7 additions & 2 deletions bn_mp_div_d.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

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;
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_dr_is_modulus.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* determines if a number is a valid DR modulus */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_dr_reduce.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* reduce "x" in place modulo "n" using the Diminished Radix algorithm.
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_dr_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* determines the setup value */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_exch.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* swap the elements of two integers, for cases where you can't simply swap the
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_expt_d.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* calculate c = a**b using a square-multiply algorithm */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_exptmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/


Expand Down
2 changes: 1 addition & 1 deletion bn_mp_exptmod_fast.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* computes Y == G**X mod P, HAC pp.616, Algorithm 14.85
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_exteuclid.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* Extended euclidean algorithm of (a, b) produces
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_fread.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* read a bigint from a file stream in ASCII */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_fwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

int mp_fwrite(mp_int *a, int radix, FILE *stream)
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_gcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* Greatest Common Divisor using the binary method */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_get_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* get the lower 32-bits of an mp_int */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_grow.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* grow as required */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* init a new mp_int */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_init_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/

/* creates "a" then copies b into it */
Expand Down
2 changes: 1 addition & 1 deletion bn_mp_init_multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://math.libtomcrypt.com
* Tom St Denis, [email protected], http://libtom.org
*/
#include <stdarg.h>

Expand Down
Loading

0 comments on commit 333aebc

Please sign in to comment.