Package list libcryptx-perl / 0e7f2e1
libtommath update Karel Miko 2 years ago
2 changed file(s) with 9 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
164164 }
165165
166166 /* 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) {
168168 goto LBL_RES;
169169 }
170170
171171 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) {
176176 goto LBL_RES;
177177 }
178178 }
9898 /* compute the value at M[1<<(winsize-1)] by squaring
9999 * M[1] (winsize-1) times
100100 */
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) {
102102 goto LBL_MU;
103103 }
104104
105105 for (x = 0; x < (winsize - 1); x++) {
106106 /* 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) {
109109 goto LBL_MU;
110110 }
111111
112112 /* 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) {
114114 goto LBL_MU;
115115 }
116116 }