aboutsummaryrefslogtreecommitdiff
path: root/pyecsca/sca/re/base.py
blob: ca9b45439d34227e8c78632739c4a6fc9c24c0d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from abc import abstractmethod, ABC
from typing import Optional, Any, Set

from public import public

from pyecsca.sca.re.tree import Tree


@public
class RE(ABC):
    """A base class for Reverse-Engineering methods."""

    tree: Optional[Tree] = None
    """The RE tree (if any)."""
    configs: Set[Any]
    """The set of configurations to reverse-engineer."""

    def __init__(self, configs: Set[Any]):
        self.configs = configs

    @abstractmethod
    def build_tree(self, *args, **kwargs):
        """Build the RE tree."""
        pass

    @abstractmethod
    def run(self, *args, **kwargs):
        """Run the reverse-engineering (and obtain a result set of possible configurations)."""
        pass