From 19e240e6f8107ebe8bed4d36820c9d5d8fe1576b Mon Sep 17 00:00:00 2001 From: J08nY Date: Thu, 5 Oct 2023 20:03:29 +0200 Subject: Free ws data at the end. --- pyecsca/codegen/templates/mult.c | 4 ++-- pyecsca/codegen/templates/mult_sliding_w.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pyecsca/codegen/templates/mult.c b/pyecsca/codegen/templates/mult.c index f7169e6..e580dfc 100644 --- a/pyecsca/codegen/templates/mult.c +++ b/pyecsca/codegen/templates/mult.c @@ -33,11 +33,11 @@ {%- elif isinstance(scalarmult, SlidingWindowMultiplier) -%} - {% include "mult_sliding_w.c" %} {# TODO #} + {% include "mult_sliding_w.c" %} {%- elif isinstance(scalarmult, FixedWindowLTRMultiplier) -%} - {% include "mult_fixed_w.c" %} {# TODO #} + {% include "mult_fixed_w.c" %} {%- endif %} diff --git a/pyecsca/codegen/templates/mult_sliding_w.c b/pyecsca/codegen/templates/mult_sliding_w.c index 1b670e9..5c9bb6c 100644 --- a/pyecsca/codegen/templates/mult_sliding_w.c +++ b/pyecsca/codegen/templates/mult_sliding_w.c @@ -32,13 +32,14 @@ static void scalar_mult_inner(bn_t *scalar, point_t *point, curve_t *curve, poin point_accumulate(q, points[(val - 1) / 2], curve, q); } } - free(ws->data); - free(ws); {%- if "scl" in scalarmult.formulas %} point_scl(q, curve, q); {%- endif %} point_set(q, out); + + free(ws->data); + free(ws); for (long i = 0; i < {{ 2 ** (scalarmult.width - 1) }}; i++) { point_free(points[i]); } -- cgit v1.3.1