From a2fcccb79a1a148b3409d26c5ea95c637af7b7b1 Mon Sep 17 00:00:00 2001 From: J08nY Date: Wed, 23 Sep 2020 20:22:10 +0200 Subject: Update std-curves module and fix its parsing. --- pyecsca/ec/params.py | 9 ++++++--- pyecsca/ec/std | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pyecsca/ec/params.py b/pyecsca/ec/params.py index abe716a..d938333 100644 --- a/pyecsca/ec/params.py +++ b/pyecsca/ec/params.py @@ -81,8 +81,11 @@ def get_params(category: str, name: str, coords: str, infty: bool = True) -> Dom break else: raise ValueError("Curve {} not found in category {}.".format(name, category)) + if curve["field"]["type"] == "Binary": raise ValueError("Binary field curves are currently not supported.") + if curve["field"]["type"] == "Extension": + raise ValueError("Extension field curves are currently not supported.") # Get model and param names model: CurveModel @@ -103,7 +106,7 @@ def get_params(category: str, name: str, coords: str, infty: bool = True) -> Dom param_names = ["a", "d"] else: raise ValueError("Unknown curve model.") - params = {name: Mod(int(curve["params"][name], 16), field) for name in param_names} + params = {name: Mod(int(curve["params"][name]["raw"], 16), field) for name in param_names} # Check coordinate model name and assumptions coord_model: CoordinateModel @@ -140,8 +143,8 @@ def get_params(category: str, name: str, coords: str, infty: bool = True) -> Dom infinity_coords[coordinate] = value infinity = Point(coord_model, **infinity_coords) elliptic_curve = EllipticCurve(model, coord_model, field, infinity, params) # type: ignore[arg-type] - affine = Point(AffineCoordinateModel(model), x=Mod(int(curve["generator"]["x"], 16), field), - y=Mod(int(curve["generator"]["y"], 16), field)) + affine = Point(AffineCoordinateModel(model), x=Mod(int(curve["generator"]["x"]["raw"], 16), field), + y=Mod(int(curve["generator"]["y"]["raw"], 16), field)) if not isinstance(coord_model, AffineCoordinateModel): generator = affine.to_model(coord_model, elliptic_curve) else: diff --git a/pyecsca/ec/std b/pyecsca/ec/std index 1d6b91f..d94f7b9 160000 --- a/pyecsca/ec/std +++ b/pyecsca/ec/std @@ -1 +1 @@ -Subproject commit 1d6b91fba61c791b5371b003800f3849d5aaae23 +Subproject commit d94f7b9e38af8318eda186e6d7acabea57b6d856 -- cgit v1.3.1