added libtommath-0.40

This commit is contained in:
Tom St Denis 2006-12-24 16:12:36 +00:00 committed by Steffen Jaeckel
parent f0b91a572e
commit 3aba4eacc6
14 changed files with 4382 additions and 191 deletions

130
bn.ind
View File

@ -1,82 +1,82 @@
\begin{theindex}
\item mp\_add, \hyperpage{29}
\item mp\_add\_d, \hyperpage{52}
\item mp\_and, \hyperpage{29}
\item mp\_clear, \hyperpage{11}
\item mp\_clear\_multi, \hyperpage{12}
\item mp\_cmp, \hyperpage{24}
\item mp\_cmp\_d, \hyperpage{25}
\item mp\_add, \hyperpage{31}
\item mp\_add\_d, \hyperpage{56}
\item mp\_and, \hyperpage{31}
\item mp\_clear, \hyperpage{12}
\item mp\_clear\_multi, \hyperpage{13}
\item mp\_cmp, \hyperpage{25}
\item mp\_cmp\_d, \hyperpage{26}
\item mp\_cmp\_mag, \hyperpage{23}
\item mp\_div, \hyperpage{30}
\item mp\_div\_2, \hyperpage{26}
\item mp\_div\_2d, \hyperpage{28}
\item mp\_div\_d, \hyperpage{52}
\item mp\_dr\_reduce, \hyperpage{40}
\item mp\_dr\_setup, \hyperpage{40}
\item MP\_EQ, \hyperpage{22}
\item mp\_error\_to\_string, \hyperpage{10}
\item mp\_expt\_d, \hyperpage{43}
\item mp\_exptmod, \hyperpage{43}
\item mp\_exteuclid, \hyperpage{51}
\item mp\_gcd, \hyperpage{51}
\item mp\_div, \hyperpage{32}
\item mp\_div\_2, \hyperpage{28}
\item mp\_div\_2d, \hyperpage{30}
\item mp\_div\_d, \hyperpage{56}
\item mp\_dr\_reduce, \hyperpage{45}
\item mp\_dr\_setup, \hyperpage{45}
\item MP\_EQ, \hyperpage{23}
\item mp\_error\_to\_string, \hyperpage{9}
\item mp\_expt\_d, \hyperpage{47}
\item mp\_exptmod, \hyperpage{47}
\item mp\_exteuclid, \hyperpage{55}
\item mp\_gcd, \hyperpage{55}
\item mp\_get\_int, \hyperpage{20}
\item mp\_grow, \hyperpage{16}
\item MP\_GT, \hyperpage{22}
\item mp\_grow, \hyperpage{17}
\item MP\_GT, \hyperpage{23}
\item mp\_init, \hyperpage{11}
\item mp\_init\_copy, \hyperpage{13}
\item mp\_init\_multi, \hyperpage{12}
\item mp\_init\_copy, \hyperpage{14}
\item mp\_init\_multi, \hyperpage{13}
\item mp\_init\_set, \hyperpage{21}
\item mp\_init\_set\_int, \hyperpage{21}
\item mp\_init\_size, \hyperpage{14}
\item mp\_init\_size, \hyperpage{15}
\item mp\_int, \hyperpage{10}
\item mp\_invmod, \hyperpage{52}
\item mp\_jacobi, \hyperpage{52}
\item mp\_lcm, \hyperpage{51}
\item mp\_lshd, \hyperpage{28}
\item MP\_LT, \hyperpage{22}
\item mp\_invmod, \hyperpage{56}
\item mp\_jacobi, \hyperpage{56}
\item mp\_lcm, \hyperpage{56}
\item mp\_lshd, \hyperpage{30}
\item MP\_LT, \hyperpage{23}
\item MP\_MEM, \hyperpage{9}
\item mp\_mod, \hyperpage{35}
\item mp\_mod\_d, \hyperpage{52}
\item mp\_montgomery\_calc\_normalization, \hyperpage{38}
\item mp\_montgomery\_reduce, \hyperpage{37}
\item mp\_montgomery\_setup, \hyperpage{37}
\item mp\_mul, \hyperpage{31}
\item mp\_mul\_2, \hyperpage{26}
\item mp\_mul\_2d, \hyperpage{28}
\item mp\_mul\_d, \hyperpage{52}
\item mp\_n\_root, \hyperpage{44}
\item mp\_neg, \hyperpage{29}
\item mp\_mod, \hyperpage{39}
\item mp\_mod\_d, \hyperpage{56}
\item mp\_montgomery\_calc\_normalization, \hyperpage{42}
\item mp\_montgomery\_reduce, \hyperpage{42}
\item mp\_montgomery\_setup, \hyperpage{42}
\item mp\_mul, \hyperpage{33}
\item mp\_mul\_2, \hyperpage{28}
\item mp\_mul\_2d, \hyperpage{29}
\item mp\_mul\_d, \hyperpage{56}
\item mp\_n\_root, \hyperpage{48}
\item mp\_neg, \hyperpage{31, 32}
\item MP\_NO, \hyperpage{9}
\item MP\_OKAY, \hyperpage{9}
\item mp\_or, \hyperpage{29}
\item mp\_prime\_fermat, \hyperpage{45}
\item mp\_prime\_is\_divisible, \hyperpage{45}
\item mp\_prime\_is\_prime, \hyperpage{46}
\item mp\_prime\_miller\_rabin, \hyperpage{45}
\item mp\_prime\_next\_prime, \hyperpage{46}
\item mp\_prime\_rabin\_miller\_trials, \hyperpage{46}
\item mp\_prime\_random, \hyperpage{47}
\item mp\_prime\_random\_ex, \hyperpage{47}
\item mp\_radix\_size, \hyperpage{49}
\item mp\_read\_radix, \hyperpage{49}
\item mp\_read\_unsigned\_bin, \hyperpage{50}
\item mp\_reduce, \hyperpage{36}
\item mp\_reduce\_2k, \hyperpage{41}
\item mp\_reduce\_2k\_setup, \hyperpage{41}
\item mp\_reduce\_setup, \hyperpage{36}
\item mp\_rshd, \hyperpage{28}
\item mp\_or, \hyperpage{31}
\item mp\_prime\_fermat, \hyperpage{49}
\item mp\_prime\_is\_divisible, \hyperpage{49}
\item mp\_prime\_is\_prime, \hyperpage{51}
\item mp\_prime\_miller\_rabin, \hyperpage{50}
\item mp\_prime\_next\_prime, \hyperpage{51}
\item mp\_prime\_rabin\_miller\_trials, \hyperpage{50}
\item mp\_prime\_random, \hyperpage{51}
\item mp\_prime\_random\_ex, \hyperpage{52}
\item mp\_radix\_size, \hyperpage{53}
\item mp\_read\_radix, \hyperpage{53}
\item mp\_read\_unsigned\_bin, \hyperpage{54}
\item mp\_reduce, \hyperpage{40}
\item mp\_reduce\_2k, \hyperpage{46}
\item mp\_reduce\_2k\_setup, \hyperpage{46}
\item mp\_reduce\_setup, \hyperpage{40}
\item mp\_rshd, \hyperpage{30}
\item mp\_set, \hyperpage{19}
\item mp\_set\_int, \hyperpage{20}
\item mp\_shrink, \hyperpage{15}
\item mp\_sqr, \hyperpage{33}
\item mp\_sub, \hyperpage{29}
\item mp\_sub\_d, \hyperpage{52}
\item mp\_to\_unsigned\_bin, \hyperpage{50}
\item mp\_toradix, \hyperpage{49}
\item mp\_unsigned\_bin\_size, \hyperpage{50}
\item mp\_shrink, \hyperpage{16}
\item mp\_sqr, \hyperpage{35}
\item mp\_sub, \hyperpage{31}
\item mp\_sub\_d, \hyperpage{56}
\item mp\_to\_unsigned\_bin, \hyperpage{54}
\item mp\_toradix, \hyperpage{53}
\item mp\_unsigned\_bin\_size, \hyperpage{54}
\item MP\_VAL, \hyperpage{9}
\item mp\_xor, \hyperpage{29}
\item mp\_xor, \hyperpage{31}
\item MP\_YES, \hyperpage{9}
\end{theindex}

BIN
bn.pdf

Binary file not shown.

6
bn.tex
View File

@ -1,4 +1,4 @@
\documentclass[b5paper]{book}
\documentclass[synpaper]{book}
\usepackage{hyperref}
\usepackage{makeidx}
\usepackage{amssymb}
@ -49,8 +49,8 @@
\begin{document}
\frontmatter
\pagestyle{empty}
\title{LibTomMath User Manual \\ v0.39}
\author{Tom St Denis \\ tomstdenis@iahu.ca}
\title{LibTomMath User Manual \\ v0.40}
\author{Tom St Denis \\ tomstdenis@gmail.com}
\maketitle
This text, the library and the accompanying textbook are all hereby placed in the public domain. This book has been
formatted for B5 [176x250] paper using the \LaTeX{} {\em book} macro package.

View File

@ -78,7 +78,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];
}

View File

@ -48,7 +48,7 @@ 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;
}

View File

@ -82,7 +82,7 @@ while (<IN>) {
# scan till next end of comment, e.g. skip license
while (<SRC>) {
$text[$line++] = $_;
last if ($_ =~ /math\.libtomcrypt\.org/);
last if ($_ =~ /math\.libtomcrypt\.com/);
}
<SRC>;
}

View File

@ -1,3 +1,7 @@
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++.

View File

@ -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

View File

@ -3,7 +3,7 @@
#Tom St Denis
#version of library
VERSION=0.39
VERSION=0.40
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.

View File

@ -1,7 +1,7 @@
#Makefile for GCC
#
#Tom St Denis
VERSION=0:39
VERSION=0:40
CC = libtool --mode=compile --tag=CC gcc

Binary file not shown.

View File

@ -569,7 +569,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];
}
@ -4900,7 +4900,7 @@ 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;
}

Binary file not shown.

File diff suppressed because it is too large Load Diff