diff options
| author | J08nY | 2020-07-10 18:00:50 +0200 |
|---|---|---|
| committer | J08nY | 2020-07-10 18:00:50 +0200 |
| commit | a10e4c4339c11d5ff6b438569e3af96c1beae3e5 (patch) | |
| tree | 1800fc81f632a6f4ff1e02facde0d19714df46e0 | |
| parent | 2c6f3b41192bb06e4b8018d029af7f9980ef3cbc (diff) | |
| download | pyecsca-a10e4c4339c11d5ff6b438569e3af96c1beae3e5.tar.gz pyecsca-a10e4c4339c11d5ff6b438569e3af96c1beae3e5.tar.zst pyecsca-a10e4c4339c11d5ff6b438569e3af96c1beae3e5.zip | |
Fixes for scalarmult.
| -rw-r--r-- | pyecsca/ec/mult.py | 2 | ||||
| -rw-r--r-- | pyecsca/ec/point.py | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/pyecsca/ec/mult.py b/pyecsca/ec/mult.py index bfaa962..7a8e23e 100644 --- a/pyecsca/ec/mult.py +++ b/pyecsca/ec/mult.py @@ -241,7 +241,7 @@ class LadderMultiplier(ScalarMultiplier): complete: bool = True, short_circuit: bool = True): super().__init__(short_circuit=short_circuit, ladd=ladd, dbl=dbl, scl=scl) self.complete = complete - if not complete and dbl is None: + if (not complete or short_circuit) and dbl is None: raise ValueError def multiply(self, scalar: int) -> Point: diff --git a/pyecsca/ec/point.py b/pyecsca/ec/point.py index a77332f..4484626 100644 --- a/pyecsca/ec/point.py +++ b/pyecsca/ec/point.py @@ -63,7 +63,13 @@ class Point(object): result = {} locals = {**self.coords} for op in ops: - locals[op.result] = op(**locals) + try: + locals[op.result] = op(**locals) + except NameError as e: + if op.result in affine_model.variables: + raise e + else: + continue if op.result in affine_model.variables: result[op.result] = locals[op.result] return action.exit(Point(affine_model, **result)) |
