Commit 1221b5e12aa569bd32bbb202e4417f516452b961

Karel Miko 2018-12-02T21:42:31

fix #131 - msvc warning: result of 32-bit shift implicitly converted to 64 bits

diff --git a/bn_s_mp_exptmod.c b/bn_s_mp_exptmod.c
index f84da21..52a6422 100644
--- a/bn_s_mp_exptmod.c
+++ b/bn_s_mp_exptmod.c
@@ -99,19 +99,19 @@ int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, i
    /* 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_MU;
    }
 
    for (x = 0; x < (winsize - 1); x++) {
       /* square it */
-      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_MU;
       }
 
       /* reduce modulo P */
-      if ((err = redux(&M[1 << (winsize - 1)], P, &mu)) != MP_OKAY) {
+      if ((err = redux(&M[(size_t)1 << (winsize - 1)], P, &mu)) != MP_OKAY) {
          goto LBL_MU;
       }
    }