aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/ec
diff options
context:
space:
mode:
authorJ08nY2018-12-13 19:05:20 +0100
committerJ08nY2019-03-21 11:00:14 +0100
commit251811d90066e561b99b6580838abc20eaaa2009 (patch)
treeb14acdf69f4bbb983de6478a13dfd3605ada1295 /test/ec
parent2b8e8c4e162e8902c93e1c5d4a18e4e7ceee52fa (diff)
downloadpyecsca-251811d90066e561b99b6580838abc20eaaa2009.tar.gz
pyecsca-251811d90066e561b99b6580838abc20eaaa2009.tar.zst
pyecsca-251811d90066e561b99b6580838abc20eaaa2009.zip
Fix basic scalar multiplier.
Diffstat (limited to 'test/ec')
-rw-r--r--test/ec/test_mult.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/test/ec/test_mult.py b/test/ec/test_mult.py
index 021a6a3..6fadec7 100644
--- a/test/ec/test_mult.py
+++ b/test/ec/test_mult.py
@@ -11,12 +11,15 @@ from pyecsca.ec.point import Point
class ScalarMultiplierTests(TestCase):
def test_rtl_simple(self):
- p = 11
+ p = 0xfffffffdffffffffffffffffffffffff
coords = ShortWeierstrassModel.coordinates["projective"]
- curve = EllipticCurve(ShortWeierstrassModel, coords, dict(a=5, b=7),
- Point(coords, X=Mod(0, p), Y=Mod(0, p), Z=Mod(1, p)))
+ curve = EllipticCurve(ShortWeierstrassModel, coords,
+ dict(a=0xfffffffdfffffffffffffffffffffffc,
+ b=0xe87579c11079f43dd824993c2cee5ed3),
+ Point(coords, X=Mod(0, p), Y=Mod(1, p), Z=Mod(0, p)))
with Context() as ctx:
- mult = RTLMultiplier(curve, coords.formulas["add-2002-bj"],
- coords.formulas["dbl-2007-bl"], ctx=ctx)
- result = mult.multiply(10, Point(coords, X=Mod(4, p), Y=Mod(3, p), Z=Mod(1, p)))
- print(ctx.intermediates)
+ mult = RTLMultiplier(curve, coords.formulas["add-1998-cmo"],
+ coords.formulas["dbl-1998-cmo"], coords.formulas["z"], ctx=ctx)
+ mult.multiply(10, Point(coords, X=Mod(0x161ff7528b899b2d0c28607ca52c5b86, p),
+ Y=Mod(0xcf5ac8395bafeb13c02da292dded7a83, p),
+ Z=Mod(1, p)))