diff options
| author | J08nY | 2023-08-25 16:40:43 +0200 |
|---|---|---|
| committer | J08nY | 2023-08-25 16:40:43 +0200 |
| commit | 215181fae1b9ac27a2ed1ecfbc6d98d773536321 (patch) | |
| tree | 4df0a99574b7621158efc5d0809bfc80ba610b29 /pyecsca/ec/configuration.py | |
| parent | 5f4659aa9cef3f918d09777f4355d0bbc9206174 (diff) | |
| download | pyecsca-215181fae1b9ac27a2ed1ecfbc6d98d773536321.tar.gz pyecsca-215181fae1b9ac27a2ed1ecfbc6d98d773536321.tar.zst pyecsca-215181fae1b9ac27a2ed1ecfbc6d98d773536321.zip | |
Diffstat (limited to 'pyecsca/ec/configuration.py')
| -rw-r--r-- | pyecsca/ec/configuration.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pyecsca/ec/configuration.py b/pyecsca/ec/configuration.py index 79b7f4c..4d13c01 100644 --- a/pyecsca/ec/configuration.py +++ b/pyecsca/ec/configuration.py @@ -1,4 +1,5 @@ """Provides a way to work with and enumerate implementation configurations.""" +import warnings from dataclasses import dataclass from enum import Enum from itertools import product @@ -9,7 +10,6 @@ from typing import ( get_args, Generator, FrozenSet, - Any, ) from public import public @@ -200,13 +200,26 @@ def all_configurations(**kwargs) -> Generator[Configuration, Configuration, None required_type, bool ): options = [True, False] + elif get_origin(required_type) is None and issubclass( + required_type, Enum + ): + options = list(required_type) elif ( get_origin(required_type) is None and issubclass(required_type, int) and name == "width" ): + # TODO: More options possible! options = [3, 5] + elif ( + get_origin(required_type) is None + and issubclass(required_type, int) + and name == "m" + ): + # TODO: More options possible! + options = [5, 8] else: + warnings.warn(RuntimeWarning(f"Unknown scalarmult option range = {name}")) options = [] arg_options[name] = options keys = arg_options.keys() |
