From 73a7e677725e6f328ab2fc0e08d7fa0499c0eff7 Mon Sep 17 00:00:00 2001 From: J08nY Date: Mon, 13 Feb 2023 00:01:57 +0100 Subject: Only validate assumptions if there are any. --- pyecsca/ec/formula.py | 3 ++- pyecsca/ec/mod.py | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyecsca/ec/formula.py b/pyecsca/ec/formula.py index 5f2c172..ec8f9c0 100644 --- a/pyecsca/ec/formula.py +++ b/pyecsca/ec/formula.py @@ -222,7 +222,8 @@ class Formula(ABC): self.__validate_params(field, params) self.__validate_points(field, points, params) - self.__validate_assumptions(field, params) + if self.assumptions: + self.__validate_assumptions(field, params) # Execute the actual formula. with FormulaAction(self, *points, **params) as action: for op in self.code: diff --git a/pyecsca/ec/mod.py b/pyecsca/ec/mod.py index 63fabe2..a43db53 100644 --- a/pyecsca/ec/mod.py +++ b/pyecsca/ec/mod.py @@ -116,9 +116,8 @@ def _check(func): def method(self, other): if type(self) is not type(other): other = self.__class__(other, self.n) - else: - if self.n != other.n: - raise ValueError + elif self.n != other.n: + raise ValueError return func(self, other) return method -- cgit v1.3.1