forked from libtom/libtommath
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
2,149 additions
and
1,121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ | |
\begin{document} | ||
\frontmatter | ||
\pagestyle{empty} | ||
\title{LibTomMath User Manual \\ v0.34} | ||
\title{LibTomMath User Manual \\ v0.35} | ||
\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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,33 +15,14 @@ | |
* Tom St Denis, [email protected], http://math.libtomcrypt.org | ||
*/ | ||
|
||
/* fast squaring | ||
* | ||
* This is the comba method where the columns of the product | ||
* are computed first then the carries are computed. This | ||
* has the effect of making a very simple inner loop that | ||
* is executed the most | ||
* | ||
* W2 represents the outer products and W the inner. | ||
* | ||
* A further optimizations is made because the inner | ||
* products are of the form "A * B * 2". The *2 part does | ||
* not need to be computed until the end which is good | ||
* because 64-bit shifts are slow! | ||
* | ||
* Based on Algorithm 14.16 on pp.597 of HAC. | ||
* | ||
*/ | ||
/* the jist of squaring... | ||
you do like mult except the offset of the tmpx [one that starts closer to zero] | ||
can't equal the offset of tmpy. So basically you set up iy like before then you min it with | ||
(ty-tx) so that it never happens. You double all those you add in the inner loop | ||
* you do like mult except the offset of the tmpx [one that | ||
* starts closer to zero] can't equal the offset of tmpy. | ||
* So basically you set up iy like before then you min it with | ||
* (ty-tx) so that it never happens. You double all those | ||
* you add in the inner loop | ||
After that loop you do the squares and add them in. | ||
Remove W2 and don't memset W | ||
*/ | ||
|
||
int fast_s_mp_sqr (mp_int * a, mp_int * b) | ||
|
@@ -76,7 +57,7 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b) | |
tmpx = a->dp + tx; | ||
tmpy = a->dp + ty; | ||
|
||
/* this is the number of times the loop will iterrate, essentially its | ||
/* this is the number of times the loop will iterrate, essentially | ||
while (tx++ < a->used && ty-- >= 0) { ... } | ||
*/ | ||
iy = MIN(a->used-tx, ty+1); | ||
|
@@ -101,7 +82,7 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b) | |
} | ||
|
||
/* store it */ | ||
W[ix] = _W & MP_MASK; | ||
W[ix] = (mp_digit)(_W & MP_MASK); | ||
|
||
/* make next carry */ | ||
W1 = _W >> ((mp_word)DIGIT_BIT); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.