@@ -24382,7 +24382,7 @@ static int sp_256_mont_inv_order_4_nb(sp_ecc_ctx_t* sp_ctx, sp_digit* r, const s
2438224382 sp_256_mont_mul_order_4(t, t, a);
2438324383 }
2438424384 ctx->i--;
24385- ctx->state = (ctx->i == 0) ? 3 : 1 ;
24385+ ctx->state = (ctx->i >= 0) ? 1 : 3 ;
2438624386 break;
2438724387 case 3:
2438824388 XMEMCPY(r, t, sizeof(sp_digit) * 4U);
@@ -24605,7 +24605,7 @@ static int sp_256_mont_inv_order_avx2_4_nb(sp_ecc_ctx_t* sp_ctx, sp_digit* r, co
2460524605 sp_256_mont_mul_order_avx2_4(t, t, a);
2460624606 }
2460724607 ctx->i--;
24608- ctx->state = (ctx->i == 0) ? 3 : 1 ;
24608+ ctx->state = (ctx->i >= 0) ? 1 : 3 ;
2460924609 break;
2461024610 case 3:
2461124611 XMEMCPY(r, t, sizeof(sp_digit) * 4U);
@@ -48945,7 +48945,7 @@ static int sp_384_mont_inv_order_6_nb(sp_ecc_ctx_t* sp_ctx, sp_digit* r, const s
4894548945 sp_384_mont_mul_order_6(t, t, a);
4894648946 }
4894748947 ctx->i--;
48948- ctx->state = (ctx->i == 0) ? 3 : 1 ;
48948+ ctx->state = (ctx->i >= 0) ? 1 : 3 ;
4894948949 break;
4895048950 case 3:
4895148951 XMEMCPY(r, t, sizeof(sp_digit) * 6U);
@@ -49101,7 +49101,7 @@ static int sp_384_mont_inv_order_avx2_6_nb(sp_ecc_ctx_t* sp_ctx, sp_digit* r, co
4910149101 sp_384_mont_mul_order_avx2_6(t, t, a);
4910249102 }
4910349103 ctx->i--;
49104- ctx->state = (ctx->i == 0) ? 3 : 1 ;
49104+ ctx->state = (ctx->i >= 0) ? 1 : 3 ;
4910549105 break;
4910649106 case 3:
4910749107 XMEMCPY(r, t, sizeof(sp_digit) * 6U);
@@ -89615,7 +89615,7 @@ static int sp_521_mont_inv_order_9_nb(sp_ecc_ctx_t* sp_ctx, sp_digit* r, const s
8961589615 sp_521_mont_mul_order_9(t, t, a);
8961689616 }
8961789617 ctx->i--;
89618- ctx->state = (ctx->i == 0) ? 3 : 1 ;
89618+ ctx->state = (ctx->i >= 0) ? 1 : 3 ;
8961989619 break;
8962089620 case 3:
8962189621 XMEMCPY(r, t, sizeof(sp_digit) * 9U);
@@ -89784,7 +89784,7 @@ static int sp_521_mont_inv_order_avx2_9_nb(sp_ecc_ctx_t* sp_ctx, sp_digit* r, co
8978489784 sp_521_mont_mul_order_avx2_9(t, t, a);
8978589785 }
8978689786 ctx->i--;
89787- ctx->state = (ctx->i == 0) ? 3 : 1 ;
89787+ ctx->state = (ctx->i >= 0) ? 1 : 3 ;
8978889788 break;
8978989789 case 3:
8979089790 XMEMCPY(r, t, sizeof(sp_digit) * 9U);
0 commit comments