Codebase list
libtommath update Karel Miko 5 years ago
2 changed file(s) with 9 addition(s) and 9 deletion(s).
 164 164 } 165 165 166 166 /* compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times */ 167 if ((err = mp_copy(&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { 167 if ((err = mp_copy(&M[1], &M[(size_t)1 << (winsize - 1)])) != MP_OKAY) { 168 168 goto LBL_RES; 169 169 } 170 170 171 171 for (x = 0; x < (winsize - 1); x++) { 172 if ((err = mp_sqr(&M[1 << (winsize - 1)], &M[1 << (winsize - 1)])) != MP_OKAY) { 173 goto LBL_RES; 174 } 175 if ((err = redux(&M[1 << (winsize - 1)], P, mp)) != MP_OKAY) { 172 if ((err = mp_sqr(&M[(size_t)1 << (winsize - 1)], &M[(size_t)1 << (winsize - 1)])) != MP_OKAY) { 173 goto LBL_RES; 174 } 175 if ((err = redux(&M[(size_t)1 << (winsize - 1)], P, mp)) != MP_OKAY) { 176 176 goto LBL_RES; 177 177 } 178 178 }
 98 98 /* compute the value at M[1<<(winsize-1)] by squaring 99 99 * M[1] (winsize-1) times 100 100 */ 101 if ((err = mp_copy(&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { 101 if ((err = mp_copy(&M[1], &M[(size_t)1 << (winsize - 1)])) != MP_OKAY) { 102 102 goto LBL_MU; 103 103 } 104 104 105 105 for (x = 0; x < (winsize - 1); x++) { 106 106 /* square it */ 107 if ((err = mp_sqr(&M[1 << (winsize - 1)], 108 &M[1 << (winsize - 1)])) != MP_OKAY) { 107 if ((err = mp_sqr(&M[(size_t)1 << (winsize - 1)], 108 &M[(size_t)1 << (winsize - 1)])) != MP_OKAY) { 109 109 goto LBL_MU; 110 110 } 111 111 112 112 /* reduce modulo P */ 113 if ((err = redux(&M[1 << (winsize - 1)], P, &mu)) != MP_OKAY) { 113 if ((err = redux(&M[(size_t)1 << (winsize - 1)], P, &mu)) != MP_OKAY) { 114 114 goto LBL_MU; 115 115 } 116 116 }