aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorJ08nY2023-11-14 13:35:58 +0100
committerJ08nY2023-11-14 13:35:58 +0100
commitf425d0ef1fcdad30ae7be544cb30304a71300133 (patch)
tree8406a01e6e5a074f46dbd25096e0b9826186916d /test
parent5a7146dbd0bd72011c158740b210b3f0c7b2f389 (diff)
downloadpyecsca-f425d0ef1fcdad30ae7be544cb30304a71300133.tar.gz
pyecsca-f425d0ef1fcdad30ae7be544cb30304a71300133.tar.zst
pyecsca-f425d0ef1fcdad30ae7be544cb30304a71300133.zip
Add NSS.
Diffstat (limited to 'test')
-rw-r--r--test/data/formulas/ladd-hacl-x255194
-rw-r--r--test/data/formulas/ladd-hacl-x25519.op318
-rw-r--r--test/sca/test_structural.py7
3 files changed, 29 insertions, 0 deletions
diff --git a/test/data/formulas/ladd-hacl-x25519 b/test/data/formulas/ladd-hacl-x25519
new file mode 100644
index 0000000..1dbe8cc
--- /dev/null
+++ b/test/data/formulas/ladd-hacl-x25519
@@ -0,0 +1,4 @@
+source HACL* https://github.com/hacl-star/hacl-star/blob/v0.3.0/specs/Spec.Curve25519.fst#L56
+parameter am24
+assume am24 = (a-2)/4
+coords xz
diff --git a/test/data/formulas/ladd-hacl-x25519.op3 b/test/data/formulas/ladd-hacl-x25519.op3
new file mode 100644
index 0000000..7893eb9
--- /dev/null
+++ b/test/data/formulas/ladd-hacl-x25519.op3
@@ -0,0 +1,18 @@
+a = X2 + Z2
+b = X2 - Z2
+c = X3 + Z3
+d = X3 - Z3
+da = d * a
+cb = c * b
+X3 = da + cb
+Z3 = da - cb
+aa = a^2
+bb = b^2
+X5 = X3^2
+Z3 = Z3^2
+e = aa - bb
+e121665 = e * am24
+aa_e121665 = aa + e121665
+X4 = aa * bb
+Z4 = e * aa_e121665
+Z5 = Z3 * X1
diff --git a/test/sca/test_structural.py b/test/sca/test_structural.py
index 0645972..099e348 100644
--- a/test/sca/test_structural.py
+++ b/test/sca/test_structural.py
@@ -185,6 +185,13 @@ def test_efd_formula_match():
("other", "Curve25519"),
LadderEFDFormula,
],
+ [
+ "ladd-hacl-x25519",
+ MontgomeryModel,
+ "xz",
+ ("other", "Curve25519"),
+ LadderEFDFormula,
+ ],
],
)
def test_formula_correctness(name, model, coords, param_spec, formula_type):