aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJ08nY2023-02-13 00:01:57 +0100
committerJ08nY2023-02-13 00:01:57 +0100
commit73a7e677725e6f328ab2fc0e08d7fa0499c0eff7 (patch)
tree7c0433b03a035e4fa74c1226a77fe01730d65e84
parent88edf0ca2efa0062e2c766f83c0b297987875c9e (diff)
downloadpyecsca-73a7e677725e6f328ab2fc0e08d7fa0499c0eff7.tar.gz
pyecsca-73a7e677725e6f328ab2fc0e08d7fa0499c0eff7.tar.zst
pyecsca-73a7e677725e6f328ab2fc0e08d7fa0499c0eff7.zip
Only validate assumptions if there are any.
-rw-r--r--pyecsca/ec/formula.py3
-rw-r--r--pyecsca/ec/mod.py5
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