summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_exptmod_fast.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-16 13:04:26 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-16 13:04:26 (GMT)
commit2adcff3e5ba6e09366ef4208ab81768803ba15bd (patch)
tree963ed4c25de0f3f0b60d2392c5fd0e7441e548e5 /libtommath/bn_mp_exptmod_fast.c
parentfac003f85aeba679d1cc6bea4eb8a84fc0ebd9f0 (diff)
downloadtcl-2adcff3e5ba6e09366ef4208ab81768803ba15bd.zip
tcl-2adcff3e5ba6e09366ef4208ab81768803ba15bd.tar.gz
tcl-2adcff3e5ba6e09366ef4208ab81768803ba15bd.tar.bz2
import libtommath 1.0
Diffstat (limited to 'libtommath/bn_mp_exptmod_fast.c')
-rw-r--r--libtommath/bn_mp_exptmod_fast.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c
index 60c7e2b..8d280bd 100644
--- a/libtommath/bn_mp_exptmod_fast.c
+++ b/libtommath/bn_mp_exptmod_fast.c
@@ -1,4 +1,4 @@
-#include <tommath.h>
+#include <tommath_private.h>
#ifdef BN_MP_EXPTMOD_FAST_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
+ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
/* computes Y == G**X mod P, HAC pp.616, Algorithm 14.85
@@ -96,8 +96,8 @@ int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode
/* automatically pick the comba one if available (saves quite a few calls/ifs) */
#ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C
- if (((P->used * 2 + 1) < MP_WARRAY) &&
- P->used < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) {
+ if ((((P->used * 2) + 1) < MP_WARRAY) &&
+ (P->used < (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) {
redux = fast_mp_montgomery_reduce;
} else
#endif
@@ -219,12 +219,12 @@ int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode
* in the exponent. Technically this opt is not required but it
* does lower the # of trivial squaring/reductions used
*/
- if (mode == 0 && y == 0) {
+ if ((mode == 0) && (y == 0)) {
continue;
}
/* if the bit is zero and mode == 1 then we square */
- if (mode == 1 && y == 0) {
+ if ((mode == 1) && (y == 0)) {
if ((err = mp_sqr (&res, &res)) != MP_OKAY) {
goto LBL_RES;
}
@@ -266,7 +266,7 @@ int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode
}
/* if bits remain then square/multiply */
- if (mode == 2 && bitcpy > 0) {
+ if ((mode == 2) && (bitcpy > 0)) {
/* square then multiply if the bit is set */
for (x = 0; x < bitcpy; x++) {
if ((err = mp_sqr (&res, &res)) != MP_OKAY) {
@@ -317,5 +317,5 @@ LBL_M:
/* $Source$ */
-/* $Revision: 0.41 $ */
-/* $Date: 2007-04-18 09:58:18 +0000 $ */
+/* $Revision$ */
+/* $Date$ */