diff options
| author | J08nY | 2023-09-26 11:46:38 +0200 |
|---|---|---|
| committer | J08nY | 2023-09-26 11:46:38 +0200 |
| commit | 2e97eae75817d6a002e2a8797102cfd149436736 (patch) | |
| tree | a329acf11f5fbe1094862b2fe67f6609764407b1 /test/sca | |
| parent | 7ecd77e790ac21c4afa3aba6241e96296bb616a2 (diff) | |
| download | pyecsca-2e97eae75817d6a002e2a8797102cfd149436736.tar.gz pyecsca-2e97eae75817d6a002e2a8797102cfd149436736.tar.zst pyecsca-2e97eae75817d6a002e2a8797102cfd149436736.zip | |
Add special cases to ZVP point construction.
Diffstat (limited to 'test/sca')
| -rw-r--r-- | test/sca/perf_zvp.py | 2 | ||||
| -rw-r--r-- | test/sca/test_zvp.py | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/test/sca/perf_zvp.py b/test/sca/perf_zvp.py index a329d59..ba8ee11 100644 --- a/test/sca/perf_zvp.py +++ b/test/sca/perf_zvp.py @@ -38,7 +38,7 @@ def main(profiler, mod, operations, directory): ) with Profiler(profiler, directory, f"zvp_p128_{operations}_{mod}"): for _ in range(operations): - zvp_points(poly, p128.curve, k) + zvp_points(poly, p128.curve, k, p128.order) if __name__ == "__main__": diff --git a/test/sca/test_zvp.py b/test/sca/test_zvp.py index 56266f6..e0e4cfe 100644 --- a/test/sca/test_zvp.py +++ b/test/sca/test_zvp.py @@ -131,7 +131,7 @@ def test_zvp(secp128r1, formula): unrolled = unroll_formula(formula, affine=True) # Try all intermediates, zvp_point should return empty set if ZVP points do not exist for poly in unrolled: - points = zvp_points(poly, secp128r1.curve, 5) + points = zvp_points(poly, secp128r1.curve, 5, secp128r1.order) assert isinstance(points, set) # If points are produced, try them all. @@ -150,7 +150,9 @@ def test_zvp(secp128r1, formula): ("y1 + y2", (54027047743185503031379008986257148598, 42633567686060343012155773792291852040), 4), ("x1 + x2", (285130337309757533508049972949147801522, 55463852278545391044040942536845640298), 3), ("x1*x2 + y1*y2", (155681799415564546404955983367992137717, 227436010604106449719780498844151836756), 5), - ("y1*y2 - x1*a - x2*a - 3*b", (169722400242675158455680894146658513260, 33263376472545436059176357032150610796), 4) + ("y1*y2 - x1*a - x2*a - 3*b", (169722400242675158455680894146658513260, 33263376472545436059176357032150610796), 4), + ("x1", (0, 594107526960909229279178399525926007), 3), + ("x2", (234937379492809870217296988280059595814, 101935882302108071650074851009662355573), 4), ]) def test_points(secp128r1, poly_str, point, k): pt = Point(AffineCoordinateModel(secp128r1.curve.model), @@ -158,5 +160,5 @@ def test_points(secp128r1, poly_str, point, k): y=Mod(point[1], secp128r1.curve.prime)) poly_expr = sympify(poly_str) poly = Poly(poly_expr, domain=FF(secp128r1.curve.prime)) - res = zvp_points(poly, secp128r1.curve, k) + res = zvp_points(poly, secp128r1.curve, k, secp128r1.order) assert pt in res |
