diff options
Diffstat (limited to 'pyecsca/codegen/common.py')
| -rw-r--r-- | pyecsca/codegen/common.py | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/pyecsca/codegen/common.py b/pyecsca/codegen/common.py index 56ca261..ffe4710 100644 --- a/pyecsca/codegen/common.py +++ b/pyecsca/codegen/common.py @@ -1,5 +1,5 @@ from dataclasses import dataclass -from typing import Type, Optional +from typing import Type, Optional, MutableMapping, Any import click from public import public @@ -7,9 +7,21 @@ from pyecsca.ec.configuration import EnumDefine, Configuration from pyecsca.ec.coordinates import CoordinateModel from pyecsca.ec.model import (CurveModel, ShortWeierstrassModel, MontgomeryModel, EdwardsModel, TwistedEdwardsModel) -from pyecsca.ec.mult import (LTRMultiplier, RTLMultiplier, CoronMultiplier, - LadderMultiplier, SimpleLadderMultiplier, DifferentialLadderMultiplier, - WindowNAFMultiplier, BinaryNAFMultiplier) +from pyecsca.ec.mult import ( + LTRMultiplier, + RTLMultiplier, + CoronMultiplier, + LadderMultiplier, + SimpleLadderMultiplier, + DifferentialLadderMultiplier, + WindowNAFMultiplier, + BinaryNAFMultiplier, + SlidingWindowMultiplier, + FixedWindowLTRMultiplier, + FullPrecompMultiplier, + BGMWMultiplier, + CombMultiplier, +) @public @@ -28,44 +40,31 @@ class DeviceConfiguration(Configuration): """A device configuration that includes the platform and choices specific to the pyecsca-codegened implementations.""" platform: Platform + """The platform to build for.""" keygen: bool + """Whether the key-generation command is present.""" ecdh: bool + """Whether the ECDH command is present.""" ecdsa: bool + """Whether the ECDSA command is present.""" + defines: Optional[MutableMapping[str, Any]] = None + """Optional defines passed to the compilation.""" MULTIPLIERS = [ - { - "name": ("ltr", "LTRMultiplier"), - "class": LTRMultiplier - }, - { - "name": ("rtl", "RTLMultiplier"), - "class": RTLMultiplier - }, - { - "name": ("coron", "CoronMultiplier"), - "class": CoronMultiplier - }, - { - "name": ("ldr", "LadderMultiplier"), - "class": LadderMultiplier - }, - { - "name": ("simple-ldr", "SimpleLadderMultiplier"), - "class": SimpleLadderMultiplier - }, - { - "name": ("diff-ldr", "DifferentialLadderMultiplier"), - "class": DifferentialLadderMultiplier - }, - { - "name": ("naf", "bnaf", "BinaryNAFMultiplier"), - "class": BinaryNAFMultiplier - }, - { - "name": ("wnaf", "WindowNAFMultiplier"), - "class": WindowNAFMultiplier - } + {"name": ("ltr", "LTRMultiplier"), "class": LTRMultiplier}, + {"name": ("rtl", "RTLMultiplier"), "class": RTLMultiplier}, + {"name": ("coron", "CoronMultiplier"), "class": CoronMultiplier}, + {"name": ("ldr", "LadderMultiplier"), "class": LadderMultiplier}, + {"name": ("simple-ldr", "SimpleLadderMultiplier"), "class": SimpleLadderMultiplier}, + {"name": ("diff-ldr", "DifferentialLadderMultiplier"), "class": DifferentialLadderMultiplier}, + {"name": ("naf", "bnaf", "BinaryNAFMultiplier"), "class": BinaryNAFMultiplier}, + {"name": ("wnaf", "WindowNAFMultiplier"), "class": WindowNAFMultiplier}, + {"name": ("sliding", "SlidingWindowMultiplier"), "class": SlidingWindowMultiplier}, + {"name": ("fixed", "FixedWindowLTRMultiplier"), "class": FixedWindowLTRMultiplier}, + {"name": ("precomp", "FullPrecompMultiplier"), "class": FullPrecompMultiplier}, + {"name": ("bgmw", "BGMWMultiplier"), "class": BGMWMultiplier}, + {"name": ("comb", "CombMultiplier"), "class": CombMultiplier}, ] |
