aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ08nY2018-12-18 18:46:16 +0100
committerJ08nY2019-03-21 11:00:14 +0100
commit4a85ffa34d0f8ab8595c6b60f9248ed1b51bf62d (patch)
tree3d281e67ef64209a78cd1e17f66b818b7079bf33
parent70636c48d6177b50cb6237c2649b3e36d04eaaf4 (diff)
downloadpyecsca-4a85ffa34d0f8ab8595c6b60f9248ed1b51bf62d.tar.gz
pyecsca-4a85ffa34d0f8ab8595c6b60f9248ed1b51bf62d.tar.zst
pyecsca-4a85ffa34d0f8ab8595c6b60f9248ed1b51bf62d.zip
-rw-r--r--pyecsca/ec/coordinates.py26
-rw-r--r--pyecsca/ec/efd/edwards/inverted/negation/neg3
-rw-r--r--pyecsca/ec/efd/edwards/inverted/negation/neg.op33
-rw-r--r--pyecsca/ec/efd/edwards/projective/negation/neg3
-rw-r--r--pyecsca/ec/efd/edwards/projective/negation/neg.op33
-rw-r--r--pyecsca/ec/efd/shortw/jacobian-0/negation/neg3
-rw-r--r--pyecsca/ec/efd/shortw/jacobian-0/negation/neg.op33
-rw-r--r--pyecsca/ec/efd/shortw/jacobian-3/negation/neg3
-rw-r--r--pyecsca/ec/efd/shortw/jacobian-3/negation/neg.op33
-rw-r--r--pyecsca/ec/efd/shortw/jacobian/negation/neg3
-rw-r--r--pyecsca/ec/efd/shortw/jacobian/negation/neg.op34
-rw-r--r--pyecsca/ec/efd/shortw/modified/negation/neg4
-rw-r--r--pyecsca/ec/efd/shortw/modified/negation/neg.op34
-rw-r--r--pyecsca/ec/efd/shortw/projective-1/negation/neg3
-rw-r--r--pyecsca/ec/efd/shortw/projective-1/negation/neg.op33
-rw-r--r--pyecsca/ec/efd/shortw/projective-3/negation/neg3
-rw-r--r--pyecsca/ec/efd/shortw/projective-3/negation/neg.op33
-rw-r--r--pyecsca/ec/efd/shortw/projective/negation/neg3
-rw-r--r--pyecsca/ec/efd/shortw/projective/negation/neg.op33
-rw-r--r--pyecsca/ec/efd/shortw/w12-0/negation/neg3
-rw-r--r--pyecsca/ec/efd/shortw/w12-0/negation/neg.op33
-rw-r--r--pyecsca/ec/efd/shortw/xyzz-3/negation/neg4
-rw-r--r--pyecsca/ec/efd/shortw/xyzz-3/negation/neg.op34
-rw-r--r--pyecsca/ec/efd/shortw/xyzz/negation/neg4
-rw-r--r--pyecsca/ec/efd/shortw/xyzz/negation/neg.op34
-rw-r--r--pyecsca/ec/efd/twisted/extended-1/negation/neg4
-rw-r--r--pyecsca/ec/efd/twisted/extended-1/negation/neg.op34
-rw-r--r--pyecsca/ec/efd/twisted/extended/negation/neg4
-rw-r--r--pyecsca/ec/efd/twisted/extended/negation/neg.op34
-rw-r--r--pyecsca/ec/efd/twisted/inverted/negation/neg3
-rw-r--r--pyecsca/ec/efd/twisted/inverted/negation/neg.op33
-rw-r--r--pyecsca/ec/efd/twisted/projective/negation/neg3
-rw-r--r--pyecsca/ec/efd/twisted/projective/negation/neg.op33
-rw-r--r--pyecsca/ec/formula.py5
34 files changed, 123 insertions, 15 deletions
diff --git a/pyecsca/ec/coordinates.py b/pyecsca/ec/coordinates.py
index e8f4710..a5840a3 100644
--- a/pyecsca/ec/coordinates.py
+++ b/pyecsca/ec/coordinates.py
@@ -3,7 +3,7 @@ from pkg_resources import resource_listdir, resource_isdir, resource_stream
from typing import List, Any, MutableMapping
from .formula import (Formula, AdditionFormula, DoublingFormula, TriplingFormula,
- DifferentialAdditionFormula, LadderFormula, ScalingFormula)
+ DifferentialAdditionFormula, LadderFormula, ScalingFormula, NegationFormula)
class CoordinateModel(object):
@@ -64,20 +64,16 @@ class EFDCoordinateModel(CoordinateModel):
for fname in resource_listdir(__name__, dir_path):
if fname.endswith(".op3"):
continue
- if formula_type == "addition":
- cls = AdditionFormula
- elif formula_type == "doubling":
- cls = DoublingFormula
- elif formula_type == "tripling":
- cls = TriplingFormula
- elif formula_type == "diffadd":
- cls = DifferentialAdditionFormula
- elif formula_type == "ladder":
- cls = LadderFormula
- elif formula_type == "scaling":
- cls = ScalingFormula
- else:
- cls = Formula
+ formula_types = {
+ "addition": AdditionFormula,
+ "doubling": DoublingFormula,
+ "tripling": TriplingFormula,
+ "diffadd": DifferentialAdditionFormula,
+ "ladder": LadderFormula,
+ "scaling": ScalingFormula,
+ "negation": NegationFormula
+ }
+ cls = formula_types.get(formula_type, Formula)
self.formulas[fname] = cls(dir_path + "/" + fname, fname, self)
def __read_coordinates_file(self, file_path):
diff --git a/pyecsca/ec/efd/edwards/inverted/negation/neg b/pyecsca/ec/efd/edwards/inverted/negation/neg
new file mode 100644
index 0000000..7363b22
--- /dev/null
+++ b/pyecsca/ec/efd/edwards/inverted/negation/neg
@@ -0,0 +1,3 @@
+compute X3 = -X1
+compute Y3 = Y1
+compute Z3 = Z1
diff --git a/pyecsca/ec/efd/edwards/inverted/negation/neg.op3 b/pyecsca/ec/efd/edwards/inverted/negation/neg.op3
new file mode 100644
index 0000000..36cb8c8
--- /dev/null
+++ b/pyecsca/ec/efd/edwards/inverted/negation/neg.op3
@@ -0,0 +1,3 @@
+X3 = -X1
+Y3 = Y1
+Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/edwards/projective/negation/neg b/pyecsca/ec/efd/edwards/projective/negation/neg
new file mode 100644
index 0000000..7363b22
--- /dev/null
+++ b/pyecsca/ec/efd/edwards/projective/negation/neg
@@ -0,0 +1,3 @@
+compute X3 = -X1
+compute Y3 = Y1
+compute Z3 = Z1
diff --git a/pyecsca/ec/efd/edwards/projective/negation/neg.op3 b/pyecsca/ec/efd/edwards/projective/negation/neg.op3
new file mode 100644
index 0000000..36cb8c8
--- /dev/null
+++ b/pyecsca/ec/efd/edwards/projective/negation/neg.op3
@@ -0,0 +1,3 @@
+X3 = -X1
+Y3 = Y1
+Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/jacobian-0/negation/neg b/pyecsca/ec/efd/shortw/jacobian-0/negation/neg
new file mode 100644
index 0000000..32352f0
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/jacobian-0/negation/neg
@@ -0,0 +1,3 @@
+compute X3 = X1
+compute Y3 = -Y1
+compute Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/jacobian-0/negation/neg.op3 b/pyecsca/ec/efd/shortw/jacobian-0/negation/neg.op3
new file mode 100644
index 0000000..cce5d21
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/jacobian-0/negation/neg.op3
@@ -0,0 +1,3 @@
+X3 = X1
+Y3 = -Y1
+Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/jacobian-3/negation/neg b/pyecsca/ec/efd/shortw/jacobian-3/negation/neg
new file mode 100644
index 0000000..32352f0
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/jacobian-3/negation/neg
@@ -0,0 +1,3 @@
+compute X3 = X1
+compute Y3 = -Y1
+compute Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/jacobian-3/negation/neg.op3 b/pyecsca/ec/efd/shortw/jacobian-3/negation/neg.op3
new file mode 100644
index 0000000..cce5d21
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/jacobian-3/negation/neg.op3
@@ -0,0 +1,3 @@
+X3 = X1
+Y3 = -Y1
+Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/jacobian/negation/neg b/pyecsca/ec/efd/shortw/jacobian/negation/neg
new file mode 100644
index 0000000..32352f0
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/jacobian/negation/neg
@@ -0,0 +1,3 @@
+compute X3 = X1
+compute Y3 = -Y1
+compute Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/jacobian/negation/neg.op3 b/pyecsca/ec/efd/shortw/jacobian/negation/neg.op3
new file mode 100644
index 0000000..a0d0b56
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/jacobian/negation/neg.op3
@@ -0,0 +1,4 @@
+X3 = X1
+Y3 = -Y1
+Z3 = Z1
+T3 = T1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/modified/negation/neg b/pyecsca/ec/efd/shortw/modified/negation/neg
new file mode 100644
index 0000000..3fa5633
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/modified/negation/neg
@@ -0,0 +1,4 @@
+compute X3 = X1
+compute Y3 = -Y1
+compute Z3 = Z1
+compute T3 = T1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/modified/negation/neg.op3 b/pyecsca/ec/efd/shortw/modified/negation/neg.op3
new file mode 100644
index 0000000..8cf3a56
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/modified/negation/neg.op3
@@ -0,0 +1,4 @@
+X3 = X1
+Y3 = -Y1
+Z3 = Z1
+T3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/projective-1/negation/neg b/pyecsca/ec/efd/shortw/projective-1/negation/neg
new file mode 100644
index 0000000..32352f0
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/projective-1/negation/neg
@@ -0,0 +1,3 @@
+compute X3 = X1
+compute Y3 = -Y1
+compute Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/projective-1/negation/neg.op3 b/pyecsca/ec/efd/shortw/projective-1/negation/neg.op3
new file mode 100644
index 0000000..cce5d21
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/projective-1/negation/neg.op3
@@ -0,0 +1,3 @@
+X3 = X1
+Y3 = -Y1
+Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/projective-3/negation/neg b/pyecsca/ec/efd/shortw/projective-3/negation/neg
new file mode 100644
index 0000000..32352f0
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/projective-3/negation/neg
@@ -0,0 +1,3 @@
+compute X3 = X1
+compute Y3 = -Y1
+compute Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/projective-3/negation/neg.op3 b/pyecsca/ec/efd/shortw/projective-3/negation/neg.op3
new file mode 100644
index 0000000..cce5d21
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/projective-3/negation/neg.op3
@@ -0,0 +1,3 @@
+X3 = X1
+Y3 = -Y1
+Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/projective/negation/neg b/pyecsca/ec/efd/shortw/projective/negation/neg
new file mode 100644
index 0000000..32352f0
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/projective/negation/neg
@@ -0,0 +1,3 @@
+compute X3 = X1
+compute Y3 = -Y1
+compute Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/projective/negation/neg.op3 b/pyecsca/ec/efd/shortw/projective/negation/neg.op3
new file mode 100644
index 0000000..cce5d21
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/projective/negation/neg.op3
@@ -0,0 +1,3 @@
+X3 = X1
+Y3 = -Y1
+Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/w12-0/negation/neg b/pyecsca/ec/efd/shortw/w12-0/negation/neg
new file mode 100644
index 0000000..32352f0
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/w12-0/negation/neg
@@ -0,0 +1,3 @@
+compute X3 = X1
+compute Y3 = -Y1
+compute Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/w12-0/negation/neg.op3 b/pyecsca/ec/efd/shortw/w12-0/negation/neg.op3
new file mode 100644
index 0000000..cce5d21
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/w12-0/negation/neg.op3
@@ -0,0 +1,3 @@
+X3 = X1
+Y3 = -Y1
+Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/xyzz-3/negation/neg b/pyecsca/ec/efd/shortw/xyzz-3/negation/neg
new file mode 100644
index 0000000..fb1dcd5
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/xyzz-3/negation/neg
@@ -0,0 +1,4 @@
+compute X3 = X1
+compute Y3 = -Y1
+compute ZZ3 = ZZ1
+compute ZZZ3 = ZZZ1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/xyzz-3/negation/neg.op3 b/pyecsca/ec/efd/shortw/xyzz-3/negation/neg.op3
new file mode 100644
index 0000000..12c129b
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/xyzz-3/negation/neg.op3
@@ -0,0 +1,4 @@
+X3 = X1
+Y3 = -Y1
+ZZ3 = ZZ1
+ZZZ3 = ZZZ1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/xyzz/negation/neg b/pyecsca/ec/efd/shortw/xyzz/negation/neg
new file mode 100644
index 0000000..99b94a8
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/xyzz/negation/neg
@@ -0,0 +1,4 @@
+compute X3 = X1
+compute Y3 = -Y1
+compute ZZ3 = Z1
+compute ZZZ3 = ZZZ1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/shortw/xyzz/negation/neg.op3 b/pyecsca/ec/efd/shortw/xyzz/negation/neg.op3
new file mode 100644
index 0000000..12c129b
--- /dev/null
+++ b/pyecsca/ec/efd/shortw/xyzz/negation/neg.op3
@@ -0,0 +1,4 @@
+X3 = X1
+Y3 = -Y1
+ZZ3 = ZZ1
+ZZZ3 = ZZZ1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/twisted/extended-1/negation/neg b/pyecsca/ec/efd/twisted/extended-1/negation/neg
new file mode 100644
index 0000000..600f95e
--- /dev/null
+++ b/pyecsca/ec/efd/twisted/extended-1/negation/neg
@@ -0,0 +1,4 @@
+compute X3 = -X1
+compute Y3 = Y1
+compute Z3 = Z1
+compute T3 = -T1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/twisted/extended-1/negation/neg.op3 b/pyecsca/ec/efd/twisted/extended-1/negation/neg.op3
new file mode 100644
index 0000000..7e7a4c1
--- /dev/null
+++ b/pyecsca/ec/efd/twisted/extended-1/negation/neg.op3
@@ -0,0 +1,4 @@
+X3 = -X1
+Y3 = Y1
+Z3 = Z1
+T3 = -T1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/twisted/extended/negation/neg b/pyecsca/ec/efd/twisted/extended/negation/neg
new file mode 100644
index 0000000..600f95e
--- /dev/null
+++ b/pyecsca/ec/efd/twisted/extended/negation/neg
@@ -0,0 +1,4 @@
+compute X3 = -X1
+compute Y3 = Y1
+compute Z3 = Z1
+compute T3 = -T1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/twisted/extended/negation/neg.op3 b/pyecsca/ec/efd/twisted/extended/negation/neg.op3
new file mode 100644
index 0000000..7e7a4c1
--- /dev/null
+++ b/pyecsca/ec/efd/twisted/extended/negation/neg.op3
@@ -0,0 +1,4 @@
+X3 = -X1
+Y3 = Y1
+Z3 = Z1
+T3 = -T1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/twisted/inverted/negation/neg b/pyecsca/ec/efd/twisted/inverted/negation/neg
new file mode 100644
index 0000000..b0e7acd
--- /dev/null
+++ b/pyecsca/ec/efd/twisted/inverted/negation/neg
@@ -0,0 +1,3 @@
+compute X3 = -X1
+compute Y3 = Y1
+compute Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/twisted/inverted/negation/neg.op3 b/pyecsca/ec/efd/twisted/inverted/negation/neg.op3
new file mode 100644
index 0000000..36cb8c8
--- /dev/null
+++ b/pyecsca/ec/efd/twisted/inverted/negation/neg.op3
@@ -0,0 +1,3 @@
+X3 = -X1
+Y3 = Y1
+Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/twisted/projective/negation/neg b/pyecsca/ec/efd/twisted/projective/negation/neg
new file mode 100644
index 0000000..b0e7acd
--- /dev/null
+++ b/pyecsca/ec/efd/twisted/projective/negation/neg
@@ -0,0 +1,3 @@
+compute X3 = -X1
+compute Y3 = Y1
+compute Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/efd/twisted/projective/negation/neg.op3 b/pyecsca/ec/efd/twisted/projective/negation/neg.op3
new file mode 100644
index 0000000..36cb8c8
--- /dev/null
+++ b/pyecsca/ec/efd/twisted/projective/negation/neg.op3
@@ -0,0 +1,3 @@
+X3 = -X1
+Y3 = Y1
+Z3 = Z1 \ No newline at end of file
diff --git a/pyecsca/ec/formula.py b/pyecsca/ec/formula.py
index 897a44b..5b6f028 100644
--- a/pyecsca/ec/formula.py
+++ b/pyecsca/ec/formula.py
@@ -68,6 +68,11 @@ class TriplingFormula(Formula):
_outputs = 1
+class NegationFormula(Formula):
+ _inputs = 1
+ _outputs = 1
+
+
class ScalingFormula(Formula):
_inputs = 1
_outputs = 1