aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ08nY2020-09-23 20:22:10 +0200
committerJ08nY2020-09-23 20:22:10 +0200
commita2fcccb79a1a148b3409d26c5ea95c637af7b7b1 (patch)
tree8d9e731d2e57b11b79c75a274b5013bb07a088d5
parentfcdea31b2a6efb49357ef8b2e69212ec412feaa0 (diff)
downloadpyecsca-a2fcccb79a1a148b3409d26c5ea95c637af7b7b1.tar.gz
pyecsca-a2fcccb79a1a148b3409d26c5ea95c637af7b7b1.tar.bz2
pyecsca-a2fcccb79a1a148b3409d26c5ea95c637af7b7b1.zip
Update std-curves module and fix its parsing.
-rw-r--r--pyecsca/ec/params.py9
m---------pyecsca/ec/std0
2 files changed, 6 insertions, 3 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
-Subproject 1d6b91fba61c791b5371b003800f3849d5aaae2
+Subproject d94f7b9e38af8318eda186e6d7acabea57b6d85