aboutsummaryrefslogtreecommitdiff
path: root/pyecsca/ec/context.py
diff options
context:
space:
mode:
authorJ08nY2019-04-23 23:24:55 +0200
committerJ08nY2019-04-23 23:24:55 +0200
commitf4bcb085cfc9ddac71fe8bb82e8f6719309b2637 (patch)
treeb07b30112fc2661f4fb5da7bfda30975e83077f9 /pyecsca/ec/context.py
parent28390ec1575e0af026be2bfea6fd0bca8f55c008 (diff)
downloadpyecsca-f4bcb085cfc9ddac71fe8bb82e8f6719309b2637.tar.gz
pyecsca-f4bcb085cfc9ddac71fe8bb82e8f6719309b2637.tar.zst
pyecsca-f4bcb085cfc9ddac71fe8bb82e8f6719309b2637.zip
Diffstat (limited to 'pyecsca/ec/context.py')
-rw-r--r--pyecsca/ec/context.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/pyecsca/ec/context.py b/pyecsca/ec/context.py
index 0c21942..48dcc1d 100644
--- a/pyecsca/ec/context.py
+++ b/pyecsca/ec/context.py
@@ -72,6 +72,9 @@ class Action(object):
self.roots[k] = self.intermediates[k]
self.output_points.append(point)
+ def __repr__(self):
+ return f"Action({self.formula}, {self.input_points}) = {self.output_points}"
+
@public
class Context(object):
@@ -86,11 +89,11 @@ class Context(object):
def _execute(self, formula: Formula, *points: Point, **params: Mod) -> Tuple[Point, ...]:
if len(points) != formula.num_inputs:
- raise ValueError
+ raise ValueError(f"Wrong number of inputs for {formula}.")
coords = {}
for i, point in enumerate(points):
if point.coordinate_model != formula.coordinate_model:
- raise ValueError
+ raise ValueError(f"Wrong coordinate model of point {point}.")
for coord, value in point.coords.items():
coords[coord + str(i + 1)] = value
locals = {**coords, **params}
@@ -106,8 +109,6 @@ class Context(object):
full_resulting = {}
for variable in formula.coordinate_model.variables:
full_variable = variable + ind
- if full_variable not in locals:
- continue
resulting[variable] = locals[full_variable]
full_resulting[full_variable] = locals[full_variable]
point = Point(formula.coordinate_model, **resulting)