aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyecsca/ec/formula/base.py2
-rw-r--r--pyecsca/ec/mod/base.py9
-rw-r--r--pyecsca/ec/mod/flint.py2
-rw-r--r--pyecsca/ec/mod/gmp.py2
-rw-r--r--pyecsca/ec/mod/raw.py2
-rw-r--r--pyecsca/ec/mod/symbolic.py2
-rw-r--r--pyecsca/ec/mod/test.pyx11
-rwxr-xr-xtest/ec/perf_mod.py2
8 files changed, 10 insertions, 22 deletions
diff --git a/pyecsca/ec/formula/base.py b/pyecsca/ec/formula/base.py
index d27b881..41915d9 100644
--- a/pyecsca/ec/formula/base.py
+++ b/pyecsca/ec/formula/base.py
@@ -13,7 +13,7 @@ from sympy import FF, symbols, Poly
from pyecsca.ec.context import ResultAction
from pyecsca.ec import context
from pyecsca.ec.error import UnsatisfiedAssumptionError, raise_unsatisified_assumption
-from pyecsca.ec.mod import Mod, SymbolicMod, mod
+from pyecsca.ec.mod import Mod, mod, SymbolicMod
from pyecsca.ec.op import CodeOp, OpType
from pyecsca.misc.cfg import getconfig
from pyecsca.misc.cache import sympify
diff --git a/pyecsca/ec/mod/base.py b/pyecsca/ec/mod/base.py
index 7893096..7d21f27 100644
--- a/pyecsca/ec/mod/base.py
+++ b/pyecsca/ec/mod/base.py
@@ -259,7 +259,7 @@ class Mod:
with RandomModAction(n) as action:
return action.exit(mod(secrets.randbelow(n), n))
- def __pow__(self, n) -> "Mod":
+ def __pow__(self, n, _=None) -> "Mod":
return NotImplemented
def __str__(self):
@@ -272,11 +272,10 @@ class Undefined(Mod):
__slots__ = ("x", "n")
- def __new__(cls, *args, **kwargs):
- return object.__new__(cls)
-
def __init__(self):
super().__init__(None, None)
+ self.x = None
+ self.n = None
def __add__(self, other):
return NotImplemented
@@ -344,7 +343,7 @@ class Undefined(Mod):
def __hash__(self):
return hash("Undefined") + 1
- def __pow__(self, n):
+ def __pow__(self, n, _=None):
return NotImplemented
diff --git a/pyecsca/ec/mod/flint.py b/pyecsca/ec/mod/flint.py
index 47c3c04..d5fd432 100644
--- a/pyecsca/ec/mod/flint.py
+++ b/pyecsca/ec/mod/flint.py
@@ -208,7 +208,7 @@ if has_flint:
def __hash__(self):
return hash(("FlintMod", self.x, self.n))
- def __pow__(self, n) -> "FlintMod":
+ def __pow__(self, n, _=None) -> "FlintMod":
if type(n) not in (int, flint.fmpz):
raise TypeError
if n == 0:
diff --git a/pyecsca/ec/mod/gmp.py b/pyecsca/ec/mod/gmp.py
index cdeb3b0..87301c0 100644
--- a/pyecsca/ec/mod/gmp.py
+++ b/pyecsca/ec/mod/gmp.py
@@ -155,7 +155,7 @@ if has_gmp:
def __hash__(self):
return hash(("GMPMod", self.x, self.n))
- def __pow__(self, n) -> "GMPMod":
+ def __pow__(self, n, _=None) -> "GMPMod":
if type(n) not in (int, gmpy2.mpz):
raise TypeError
if n == 0:
diff --git a/pyecsca/ec/mod/raw.py b/pyecsca/ec/mod/raw.py
index 5f4c78c..90e0f9d 100644
--- a/pyecsca/ec/mod/raw.py
+++ b/pyecsca/ec/mod/raw.py
@@ -99,7 +99,7 @@ class RawMod(Mod):
def __hash__(self):
return hash(("RawMod", self.x, self.n))
- def __pow__(self, n) -> "RawMod":
+ def __pow__(self, n, _=None) -> "RawMod":
if type(n) is not int:
raise TypeError
if n == 0:
diff --git a/pyecsca/ec/mod/symbolic.py b/pyecsca/ec/mod/symbolic.py
index 0c8a4ba..57e7233 100644
--- a/pyecsca/ec/mod/symbolic.py
+++ b/pyecsca/ec/mod/symbolic.py
@@ -110,7 +110,7 @@ class SymbolicMod(Mod):
def __hash__(self):
return hash(("SymbolicMod", self.x, self.n))
- def __pow__(self, n) -> "SymbolicMod":
+ def __pow__(self, n, _=None) -> "SymbolicMod":
return self.__class__(pow(self.x, n), self.n)
diff --git a/pyecsca/ec/mod/test.pyx b/pyecsca/ec/mod/test.pyx
deleted file mode 100644
index b8c88d3..0000000
--- a/pyecsca/ec/mod/test.pyx
+++ /dev/null
@@ -1,11 +0,0 @@
-cdef class Test:
- def __init__(self):
- print("here")
-
-cdef class SubTest(Test):
- def __init__(self):
- print("sub init")
-
-cdef class OtherTest(Test):
- def __init__(self):
- print("other init")
diff --git a/test/ec/perf_mod.py b/test/ec/perf_mod.py
index 8a81126..a0d6577 100755
--- a/test/ec/perf_mod.py
+++ b/test/ec/perf_mod.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
import click
-from pyecsca.ec.mod import Mod, mod as make_mod
+from pyecsca.ec.mod.base import Mod, mod as make_mod
from pyecsca.ec.mod.gmp import has_gmp
from pyecsca.ec.mod.flint import has_flint
from pyecsca.misc.cfg import TemporaryConfig