aboutsummaryrefslogtreecommitdiff
path: root/pyecsca/ec/context.py
diff options
context:
space:
mode:
authorJ08nY2018-12-15 16:43:44 +0100
committerJ08nY2019-03-21 11:00:14 +0100
commitbec2c56a86ce1d0b2285aaed50726fbdba42d620 (patch)
tree65e4266481ed851a0f41367ecc8ba399de8f4240 /pyecsca/ec/context.py
parentba8212dbc9cee4c098838534c096486ad5bf759a (diff)
downloadpyecsca-bec2c56a86ce1d0b2285aaed50726fbdba42d620.tar.gz
pyecsca-bec2c56a86ce1d0b2285aaed50726fbdba42d620.tar.zst
pyecsca-bec2c56a86ce1d0b2285aaed50726fbdba42d620.zip
Diffstat (limited to 'pyecsca/ec/context.py')
-rw-r--r--pyecsca/ec/context.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/pyecsca/ec/context.py b/pyecsca/ec/context.py
index b4667cf..e691184 100644
--- a/pyecsca/ec/context.py
+++ b/pyecsca/ec/context.py
@@ -13,7 +13,9 @@ class Context(object):
self.intermediates = []
self.actions = []
- def execute(self, formula: Formula, *points: Point, **params: Mod) -> Point:
+ def execute(self, formula: Formula, *points: Point, **params: Mod) -> Tuple[Point, ...]:
+ if len(points) != formula.num_inputs:
+ raise ValueError
self.actions.append((formula, tuple(points)))
coords = {}
for i, point in enumerate(points):
@@ -29,7 +31,11 @@ class Context(object):
previous_locals = set(locals.keys())
for key in diff:
self.intermediates.append((key, locals[key]))
- resulting = {variable: locals[variable + "3"]
- for variable in formula.coordinate_model.variables
- if variable + "3" in locals}
- return Point(formula.coordinate_model, **resulting)
+ result = []
+ for i in range(formula.num_outputs):
+ ind = str(i + 3)
+ resulting = {variable: locals[variable + ind]
+ for variable in formula.coordinate_model.variables
+ if variable + ind in locals}
+ result.append(Point(formula.coordinate_model, **resulting))
+ return tuple(result)