diff options
| author | J08nY | 2023-02-17 17:21:27 +0100 |
|---|---|---|
| committer | J08nY | 2023-02-17 17:21:27 +0100 |
| commit | 6cbb129e1f7dfa4d4ca248f2f246781433a4fc4d (patch) | |
| tree | 8e6aed52e85b1075526ed2fcce0c9da422d07f83 /pyecsca/sca/target | |
| parent | 9efa088d462899c94afd06fbad25003c403a6cee (diff) | |
| download | pyecsca-6cbb129e1f7dfa4d4ca248f2f246781433a4fc4d.tar.gz pyecsca-6cbb129e1f7dfa4d4ca248f2f246781433a4fc4d.tar.zst pyecsca-6cbb129e1f7dfa4d4ca248f2f246781433a4fc4d.zip | |
Diffstat (limited to 'pyecsca/sca/target')
| -rw-r--r-- | pyecsca/sca/target/__init__.py | 18 | ||||
| -rw-r--r-- | pyecsca/sca/target/ectester.py | 20 |
2 files changed, 27 insertions, 11 deletions
diff --git a/pyecsca/sca/target/__init__.py b/pyecsca/sca/target/__init__.py index f1555dd..bc9a54d 100644 --- a/pyecsca/sca/target/__init__.py +++ b/pyecsca/sca/target/__init__.py @@ -7,8 +7,9 @@ from .simpleserial import * from .binary import * from .flash import * -has_chipwhisperer = False -has_pyscard = False +has_chipwhisperer: bool = False +has_pyscard: bool = False +has_leia: bool = False try: import chipwhisperer @@ -24,9 +25,20 @@ try: except ImportError: # pragma: no cover pass +try: + import smartleia + + has_leia = True +except ImportError: # pragma: no cover + pass + +from .ectester import ECTesterTarget # noqa + if has_pyscard: from .PCSC import * - from .ectester import ECTesterTarget + +if has_leia: + from .leia import * if has_chipwhisperer: from .chipwhisperer import * diff --git a/pyecsca/sca/target/ectester.py b/pyecsca/sca/target/ectester.py index 74c4a95..f1a3639 100644 --- a/pyecsca/sca/target/ectester.py +++ b/pyecsca/sca/target/ectester.py @@ -10,8 +10,7 @@ from typing import Optional, Mapping, List, Union from public import public from .ISO7816 import CommandAPDU, ResponseAPDU, ISO7816, ISO7816Target, CardProtocol, CardConnectionException -from .leia import LEIATarget -from .PCSC import PCSCTarget +from . import has_leia, has_pyscard from ...ec.model import ShortWeierstrassModel from ...ec.params import DomainParameters from ...ec.point import Point @@ -985,11 +984,16 @@ class ECTesterTarget(ISO7816Target, ABC): # pragma: no cover return RunModeResponse(resp) -@public -class ECTesterTargetPCSC(ECTesterTarget, PCSCTarget): - pass +if has_pyscard: + from .PCSC import PCSCTarget + @public + class ECTesterTargetPCSC(ECTesterTarget, PCSCTarget): + pass -@public -class ECTesterTargetLEIA(ECTesterTarget, LEIATarget): - pass +if has_leia: + from .leia import LEIATarget + + @public + class ECTesterTargetLEIA(ECTesterTarget, LEIATarget): + pass |
