summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_exptmod_fast.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2019-02-14 20:05:11 (GMT)
committerdgp <dgp@users.sourceforge.net>2019-02-14 20:05:11 (GMT)
commita475e0b1ee3d2716a524c722064a7e3e404d3e38 (patch)
tree41d255a37c3dbe955fb413564812575b6bdd4c13 /libtommath/bn_mp_exptmod_fast.c
parentcc6faa155b3ac525cab5b017159361b62c4a9c6a (diff)
parent5fd6fc8ae4d88e17f66c93e521c89fba72b77fd4 (diff)
downloadtcl-a475e0b1ee3d2716a524c722064a7e3e404d3e38.zip
tcl-a475e0b1ee3d2716a524c722064a7e3e404d3e38.tar.gz
tcl-a475e0b1ee3d2716a524c722064a7e3e404d3e38.tar.bz2
merge 8.7
Diffstat (limited to 'libtommath/bn_mp_exptmod_fast.c')
-rw-r--r--libtommath/bn_mp_exptmod_fast.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c
index 0d01e38..4de9c5f 100644
--- a/libtommath/bn_mp_exptmod_fast.c
+++ b/libtommath/bn_mp_exptmod_fast.c
@@ -9,8 +9,7 @@
* Michael Fromberger but has been written from scratch with
* additional optimizations in place.
*
- * The library is free for all purposes without any express
- * guarantee it works.
+ * SPDX-License-Identifier: Unlicense
*/
/* computes Y == G**X mod P, HAC pp.616, Algorithm 14.85
@@ -165,15 +164,15 @@ int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y
}
/* compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times */
- if ((err = mp_copy(&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) {
+ if ((err = mp_copy(&M[1], &M[(size_t)1 << (winsize - 1)])) != MP_OKAY) {
goto LBL_RES;
}
for (x = 0; x < (winsize - 1); x++) {
- if ((err = mp_sqr(&M[1 << (winsize - 1)], &M[1 << (winsize - 1)])) != MP_OKAY) {
+ if ((err = mp_sqr(&M[(size_t)1 << (winsize - 1)], &M[(size_t)1 << (winsize - 1)])) != MP_OKAY) {
goto LBL_RES;
}
- if ((err = redux(&M[1 << (winsize - 1)], P, mp)) != MP_OKAY) {
+ if ((err = redux(&M[(size_t)1 << (winsize - 1)], P, mp)) != MP_OKAY) {
goto LBL_RES;
}
}