aboutsummaryrefslogtreecommitdiffhomepage
path: root/pyecsca/codegen/templates/mult_sliding_w.c
diff options
context:
space:
mode:
Diffstat (limited to 'pyecsca/codegen/templates/mult_sliding_w.c')
-rw-r--r--pyecsca/codegen/templates/mult_sliding_w.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pyecsca/codegen/templates/mult_sliding_w.c b/pyecsca/codegen/templates/mult_sliding_w.c
index 347c313..19d6900 100644
--- a/pyecsca/codegen/templates/mult_sliding_w.c
+++ b/pyecsca/codegen/templates/mult_sliding_w.c
@@ -10,7 +10,9 @@ static void scalar_mult_inner(bn_t *scalar, point_t *point, curve_t *curve, poin
point_dbl(current, curve, dbl);
for (long i = 0; i < {{ 2 ** (scalarmult.width - 1) }}; i++) {
points[i] = point_copy(current);
- point_add(current, dbl, curve, current);
+ if (i + 1 < {{ 2 ** (scalarmult.width - 1) }}) {
+ point_add(current, dbl, curve, current);
+ }
}
point_free(current);
point_free(dbl);