diff options
| author | J08nY | 2025-11-30 18:02:02 +0100 |
|---|---|---|
| committer | J08nY | 2025-11-30 18:02:02 +0100 |
| commit | b602400a52ff42f64faf495a9e46dbb17c86a472 (patch) | |
| tree | fd40cfcc862115890e401f75398b99a7ccb04804 | |
| parent | e09d15a667a5cc0285319c17ce6de806b9681d06 (diff) | |
| download | pyecsca-codegen-b602400a52ff42f64faf495a9e46dbb17c86a472.tar.gz pyecsca-codegen-b602400a52ff42f64faf495a9e46dbb17c86a472.tar.zst pyecsca-codegen-b602400a52ff42f64faf495a9e46dbb17c86a472.zip | |
| -rw-r--r-- | .github/workflows/test.yml | 8 | ||||
| -rw-r--r-- | pyecsca/codegen/templates/mult_comb.c | 2 | ||||
| -rw-r--r-- | pyecsca/codegen/templates/mult_sliding_w.c | 4 | ||||
| -rw-r--r-- | pyecsca/codegen/templates/mult_wnaf.c | 4 | ||||
| -rw-r--r-- | test/test_equivalence.py | 4 |
5 files changed, 14 insertions, 8 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7285b84..ac9beee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,10 @@ name: Test -on: [push, pull_request] +on: + schedule: # Run every Monday at noon + - cron: '0 12 * * 1' + push: + pull_request: env: LLVM_CONFIG: /usr/bin/llvm-config-14 @@ -11,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] env: PYTHON: ${{ matrix.python-version }} steps: diff --git a/pyecsca/codegen/templates/mult_comb.c b/pyecsca/codegen/templates/mult_comb.c index 1fbb5a3..d656876 100644 --- a/pyecsca/codegen/templates/mult_comb.c +++ b/pyecsca/codegen/templates/mult_comb.c @@ -12,7 +12,7 @@ static void scalar_mult_inner(bn_t *scalar, point_t *point, curve_t *curve, poin point_t *current = point_copy(point); for (int i = 0; i < {{ scalarmult.width }}; i++) { base_points[i] = point_copy(current); - if (i != d - 1) { + if (i != {{ scalarmult.width }} - 1) { for (int j = 0; j < d; j++) { point_dbl(current, curve, current); } 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); diff --git a/pyecsca/codegen/templates/mult_wnaf.c b/pyecsca/codegen/templates/mult_wnaf.c index 569e78b..1d15f07 100644 --- a/pyecsca/codegen/templates/mult_wnaf.c +++ b/pyecsca/codegen/templates/mult_wnaf.c @@ -19,7 +19,9 @@ static void scalar_mult_inner(bn_t *scalar, point_t *point, curve_t *curve, poin points_neg[i] = point_copy(current); point_neg(points_neg[i], curve, points_neg[i]); {%- endif %} - point_add(current, dbl, curve, current); + if (i != {{ 2 ** (scalarmult.width - 2) }} - 1) { + point_add(current, dbl, curve, current); + } } point_free(current); point_free(dbl); diff --git a/test/test_equivalence.py b/test/test_equivalence.py index aaea7f6..5a48729 100644 --- a/test/test_equivalence.py +++ b/test/test_equivalence.py @@ -16,8 +16,6 @@ from pyecsca.sca.target.binary import BinaryTarget from pyecsca.codegen.client import ImplTarget from pyecsca.ec.context import DefaultContext, local, Node -from pyecsca.ec.mult import WindowBoothMultiplier - class GDBTarget(ImplTarget, BinaryTarget): def __init__(self, model: CurveModel, coords: CoordinateModel, **kwargs): @@ -50,7 +48,7 @@ class GDBTarget(ImplTarget, BinaryTarget): def disconnect(self): super().disconnect() if self.trace_file is not None: - #self.trace_file.close() + # self.trace_file.close() self.trace_file = None |
