@@ -100770,7 +100770,7 @@ static void sp_256_proj_point_dbl_n_8(sp_point_256* p, int i,
100770100770 sp_digit* x;
100771100771 sp_digit* y;
100772100772 sp_digit* z;
100773- volatile int n = i;
100773+ volatile int n = i - 1 ;
100774100774
100775100775 x = p->x;
100776100776 y = p->y;
@@ -100782,9 +100782,9 @@ static void sp_256_proj_point_dbl_n_8(sp_point_256* p, int i,
100782100782 sp_256_mont_sqr_8(w, z, p256_mod, p256_mp_mod);
100783100783 sp_256_mont_sqr_8(w, w, p256_mod, p256_mp_mod);
100784100784#ifndef WOLFSSL_SP_SMALL
100785- while (-- n > 0)
100785+ while (n > 0)
100786100786#else
100787- while (-- n >= 0)
100787+ while (n >= 0)
100788100788#endif
100789100789 {
100790100790 /* A = 3*(X^2 - W) */
@@ -100815,6 +100815,7 @@ static void sp_256_proj_point_dbl_n_8(sp_point_256* p, int i,
100815100815 /* y = 2*A*(B - X) - Y^4 */
100816100816 sp_256_mont_mul_8(y, b, a, p256_mod, p256_mp_mod);
100817100817 sp_256_mont_sub_8(y, y, t1, p256_mod);
100818+ n = n - 1;
100818100819 }
100819100820#ifndef WOLFSSL_SP_SMALL
100820100821 /* A = 3*(X^2 - W) */
@@ -111184,7 +111185,7 @@ static void sp_384_proj_point_dbl_n_12(sp_point_384* p, int i,
111184111185 sp_digit* x;
111185111186 sp_digit* y;
111186111187 sp_digit* z;
111187- volatile int n = i;
111188+ volatile int n = i - 1 ;
111188111189
111189111190 x = p->x;
111190111191 y = p->y;
@@ -111196,9 +111197,9 @@ static void sp_384_proj_point_dbl_n_12(sp_point_384* p, int i,
111196111197 sp_384_mont_sqr_12(w, z, p384_mod, p384_mp_mod);
111197111198 sp_384_mont_sqr_12(w, w, p384_mod, p384_mp_mod);
111198111199#ifndef WOLFSSL_SP_SMALL
111199- while (-- n > 0)
111200+ while (n > 0)
111200111201#else
111201- while (-- n >= 0)
111202+ while (n >= 0)
111202111203#endif
111203111204 {
111204111205 /* A = 3*(X^2 - W) */
@@ -111229,6 +111230,7 @@ static void sp_384_proj_point_dbl_n_12(sp_point_384* p, int i,
111229111230 /* y = 2*A*(B - X) - Y^4 */
111230111231 sp_384_mont_mul_12(y, b, a, p384_mod, p384_mp_mod);
111231111232 sp_384_mont_sub_12(y, y, t1, p384_mod);
111233+ n = n - 1;
111232111234 }
111233111235#ifndef WOLFSSL_SP_SMALL
111234111236 /* A = 3*(X^2 - W) */
@@ -124383,7 +124385,7 @@ static void sp_521_proj_point_dbl_n_17(sp_point_521* p, int i,
124383124385 sp_digit* x;
124384124386 sp_digit* y;
124385124387 sp_digit* z;
124386- volatile int n = i;
124388+ volatile int n = i - 1 ;
124387124389
124388124390 x = p->x;
124389124391 y = p->y;
@@ -124395,9 +124397,9 @@ static void sp_521_proj_point_dbl_n_17(sp_point_521* p, int i,
124395124397 sp_521_mont_sqr_17(w, z, p521_mod, p521_mp_mod);
124396124398 sp_521_mont_sqr_17(w, w, p521_mod, p521_mp_mod);
124397124399#ifndef WOLFSSL_SP_SMALL
124398- while (-- n > 0)
124400+ while (n > 0)
124399124401#else
124400- while (-- n >= 0)
124402+ while (n >= 0)
124401124403#endif
124402124404 {
124403124405 /* A = 3*(X^2 - W) */
@@ -124428,6 +124430,7 @@ static void sp_521_proj_point_dbl_n_17(sp_point_521* p, int i,
124428124430 /* y = 2*A*(B - X) - Y^4 */
124429124431 sp_521_mont_mul_17(y, b, a, p521_mod, p521_mp_mod);
124430124432 sp_521_mont_sub_17(y, y, t1, p521_mod);
124433+ n = n - 1;
124431124434 }
124432124435#ifndef WOLFSSL_SP_SMALL
124433124436 /* A = 3*(X^2 - W) */
@@ -208692,7 +208695,7 @@ static void sp_1024_proj_point_dbl_n_32(sp_point_1024* p, int i,
208692208695 sp_digit* x;
208693208696 sp_digit* y;
208694208697 sp_digit* z;
208695- volatile int n = i;
208698+ volatile int n = i - 1 ;
208696208699
208697208700 x = p->x;
208698208701 y = p->y;
@@ -208704,9 +208707,9 @@ static void sp_1024_proj_point_dbl_n_32(sp_point_1024* p, int i,
208704208707 sp_1024_mont_sqr_32(w, z, p1024_mod, p1024_mp_mod);
208705208708 sp_1024_mont_sqr_32(w, w, p1024_mod, p1024_mp_mod);
208706208709#ifndef WOLFSSL_SP_SMALL
208707- while (-- n > 0)
208710+ while (n > 0)
208708208711#else
208709- while (-- n >= 0)
208712+ while (n >= 0)
208710208713#endif
208711208714 {
208712208715 /* A = 3*(X^2 - W) */
@@ -208737,6 +208740,7 @@ static void sp_1024_proj_point_dbl_n_32(sp_point_1024* p, int i,
208737208740 /* y = 2*A*(B - X) - Y^4 */
208738208741 sp_1024_mont_mul_32(y, b, a, p1024_mod, p1024_mp_mod);
208739208742 sp_1024_mont_sub_32(y, y, t1, p1024_mod);
208743+ n = n - 1;
208740208744 }
208741208745#ifndef WOLFSSL_SP_SMALL
208742208746 /* A = 3*(X^2 - W) */
0 commit comments