aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ08nY2024-07-11 17:40:32 +0200
committerJ08nY2024-07-11 17:40:32 +0200
commit756bd9fe233a07be2824f2930ef7aca1f02e3791 (patch)
treeaa9a4766402daaeb609b93010a128e67b725386b
parent3a97444b54ce3c67661868f19962af2895fa0ee8 (diff)
downloadpyecsca-756bd9fe233a07be2824f2930ef7aca1f02e3791.tar.gz
pyecsca-756bd9fe233a07be2824f2930ef7aca1f02e3791.tar.zst
pyecsca-756bd9fe233a07be2824f2930ef7aca1f02e3791.zip
-rw-r--r--pyecsca/ec/key_generation.py2
-rw-r--r--pyecsca/ec/mod.py2
-rwxr-xr-xtest/ec/perf_formula.py4
-rwxr-xr-xtest/ec/perf_mod.py4
-rwxr-xr-xtest/ec/perf_mult.py4
5 files changed, 8 insertions, 8 deletions
diff --git a/pyecsca/ec/key_generation.py b/pyecsca/ec/key_generation.py
index 13bf6d8..c583160 100644
--- a/pyecsca/ec/key_generation.py
+++ b/pyecsca/ec/key_generation.py
@@ -54,7 +54,7 @@ class KeyGeneration:
"""
with KeygenAction(self.params) as action:
privkey = Mod.random(self.params.order)
- pubkey = self.mult.multiply(privkey.x)
+ pubkey = self.mult.multiply(int(privkey.x))
if self.affine:
pubkey = pubkey.to_affine()
return action.exit((privkey, pubkey))
diff --git a/pyecsca/ec/mod.py b/pyecsca/ec/mod.py
index 18c28d4..4657190 100644
--- a/pyecsca/ec/mod.py
+++ b/pyecsca/ec/mod.py
@@ -13,7 +13,7 @@ from functools import wraps, lru_cache
from typing import Type, Dict, Any, Tuple, Union
from public import public
-from sympy import Expr, FF
+from sympy import Expr
from pyecsca.ec.error import raise_non_invertible, raise_non_residue
from pyecsca.ec.context import ResultAction
diff --git a/test/ec/perf_formula.py b/test/ec/perf_formula.py
index 7adf369..7b845c9 100755
--- a/test/ec/perf_formula.py
+++ b/test/ec/perf_formula.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
import click
-from pyecsca.ec.mod import has_gmp
+from pyecsca.ec.mod import has_gmp, has_flint
from pyecsca.ec.params import get_params
from pyecsca.misc.cfg import TemporaryConfig
from test.utils import Profiler
@@ -13,7 +13,7 @@ from test.utils import Profiler
"-m",
"--mod",
type=click.Choice(("python", "gmp", "flint")),
- default="gmp" if has_gmp else "python",
+ default="flint" if has_flint else "gmp" if has_gmp else "python",
)
@click.option("-o", "--operations", type=click.INT, default=5000)
@click.option(
diff --git a/test/ec/perf_mod.py b/test/ec/perf_mod.py
index f77c6bb..793e431 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, has_gmp
+from pyecsca.ec.mod import Mod, has_gmp, has_flint
from pyecsca.misc.cfg import TemporaryConfig
from test.utils import Profiler
@@ -12,7 +12,7 @@ from test.utils import Profiler
"-m",
"--mod",
type=click.Choice(("python", "gmp", "flint")),
- default="gmp" if has_gmp else "python",
+ default="flint" if has_flint else "gmp" if has_gmp else "python",
)
@click.option("-o", "--operations", type=click.INT, default=100000)
@click.option(
diff --git a/test/ec/perf_mult.py b/test/ec/perf_mult.py
index 2038b57..3ed0cdd 100755
--- a/test/ec/perf_mult.py
+++ b/test/ec/perf_mult.py
@@ -4,7 +4,7 @@ from typing import cast
import click
from pyecsca.ec.formula import AdditionFormula, DoublingFormula
-from pyecsca.ec.mod import has_gmp
+from pyecsca.ec.mod import has_gmp, has_flint
from pyecsca.ec.mult import LTRMultiplier
from pyecsca.ec.params import get_params
from pyecsca.misc.cfg import TemporaryConfig
@@ -17,7 +17,7 @@ from test.utils import Profiler
"-m",
"--mod",
type=click.Choice(("python", "gmp", "flint")),
- default="gmp" if has_gmp else "python",
+ default="flint" if has_flint else "gmp" if has_gmp else "python",
)
@click.option("-o", "--operations", type=click.INT, default=50)
@click.option(