diff options
| author | J08nY | 2020-03-09 12:44:03 +0100 |
|---|---|---|
| committer | J08nY | 2020-03-09 12:44:03 +0100 |
| commit | a7d3589c4ba3551ab614dfc9c931c5998fbf7fac (patch) | |
| tree | 7f09b68b16b461ee6fd47d366dfc3d8444cf513e /pyecsca/codegen/builder.py | |
| parent | 0fde32d49ca8bcba19a370125be99ad0c7572009 (diff) | |
| download | pyecsca-codegen-a7d3589c4ba3551ab614dfc9c931c5998fbf7fac.tar.gz pyecsca-codegen-a7d3589c4ba3551ab614dfc9c931c5998fbf7fac.tar.zst pyecsca-codegen-a7d3589c4ba3551ab614dfc9c931c5998fbf7fac.zip | |
Add inversion to config, change scalar mult command.
Diffstat (limited to 'pyecsca/codegen/builder.py')
| -rw-r--r-- | pyecsca/codegen/builder.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/pyecsca/codegen/builder.py b/pyecsca/codegen/builder.py index 54d4475..8ed7022 100644 --- a/pyecsca/codegen/builder.py +++ b/pyecsca/codegen/builder.py @@ -8,7 +8,8 @@ from typing import List, Optional, Tuple, Type, MutableMapping import click from public import public -from pyecsca.ec.configuration import Multiplication, Squaring, Reduction, HashType, RandomMod +from pyecsca.ec.configuration import (Multiplication, Squaring, Reduction, HashType, RandomMod, + Inversion) from pyecsca.ec.coordinates import CoordinateModel from pyecsca.ec.formula import Formula, AdditionFormula from pyecsca.ec.model import CurveModel @@ -108,6 +109,10 @@ def main(): type=click.Choice(Reduction.names()), callback=wrap_enum(Reduction), help="Modular reduction algorithm to use.") +@click.option("--inv", envvar="INV", default="GCD", show_default=True, + type=click.Choice(Inversion.names()), + callback=wrap_enum(Inversion), + help="Modular inversion algorithm to use.") @click.option("--keygen/--no-keygen", help="Whether to enable keygen.", is_flag=True, default=True, show_default=True) @click.option("--ecdh/--no-ecdh", help="Whether to enable ECDH.", is_flag=True, default=True, @@ -130,7 +135,7 @@ def main(): @click.argument("outdir") @click.pass_context @public -def build_impl(ctx, platform, hash, rand, mul, sqr, red, keygen, ecdh, ecdsa, strip, remove, +def build_impl(ctx, platform, hash, rand, mul, sqr, red, inv, keygen, ecdh, ecdsa, strip, remove, verbose, model, coords, formulas, scalarmult, outdir): """This command builds an ECC implementation. @@ -147,7 +152,7 @@ def build_impl(ctx, platform, hash, rand, mul, sqr, red, keygen, ecdh, ecdsa, st raise click.BadParameter("ECDSA needs an addition formula. None was supplied.") config = DeviceConfiguration(model, coords, formulas, scalarmult, hash, rand, mul, sqr, red, - platform, keygen, ecdh, ecdsa) + inv, platform, keygen, ecdh, ecdsa) dir, elf_file, hex_file = render(config) subprocess.run(["make"], cwd=dir, capture_output=not verbose) |
