diff options
| author | Andrej Bátora | 2023-12-07 17:25:23 +0100 |
|---|---|---|
| committer | Andrej Bátora | 2023-12-07 17:27:01 +0100 |
| commit | b32cb5cb6105a165b8ddd0aa987019eafade5fec (patch) | |
| tree | 76a340045db6194ecc7d356937a7649981dc3736 /pyecsca/codegen | |
| parent | f7a1d8cac5aafe98b89bfdea7744206dd6db84f5 (diff) | |
| download | pyecsca-codegen-b32cb5cb6105a165b8ddd0aa987019eafade5fec.tar.gz pyecsca-codegen-b32cb5cb6105a165b8ddd0aa987019eafade5fec.tar.zst pyecsca-codegen-b32cb5cb6105a165b8ddd0aa987019eafade5fec.zip | |
added method for transforming trace to EmulatorTarget
Diffstat (limited to 'pyecsca/codegen')
| -rw-r--r-- | pyecsca/codegen/client.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pyecsca/codegen/client.py b/pyecsca/codegen/client.py index 989b47b..ae42277 100644 --- a/pyecsca/codegen/client.py +++ b/pyecsca/codegen/client.py @@ -8,6 +8,7 @@ from typing import Mapping, Union, Optional, Tuple import chipwhisperer as cw import click +import numpy as np from chipwhisperer.capture.api.programmers import STM32FProgrammer, XMEGAProgrammer from chipwhisperer.capture.targets import SimpleSerial from public import public @@ -18,6 +19,7 @@ from pyecsca.ec.params import DomainParameters, get_params from pyecsca.ec.point import Point, InfinityPoint from pyecsca.sca.target import (Target, SimpleSerialTarget, ChipWhispererTarget, BinaryTarget, Flashable, SimpleSerialMessage as SMessage) +from pyecsca.sca.trace import Trace from .common import wrap_enum, Platform, get_model, get_coords @@ -25,6 +27,7 @@ from rainbow.devices import rainbow_stm32f215 from rainbow import TraceConfig, Print + class Triggers(IntFlag): """ Actions that the implementation can trigger on. @@ -310,6 +313,12 @@ class EmulatorTarget(Target): self.__emulate(command, 'cmd_ecdsa_verify') return bool(int.from_bytes(self.result[0], 'big')) + def transform_trace(self) -> Trace: + temp_tr = [] + for sample in self.trace: + temp_tr.append(sample['register']) + return Trace(np.array(temp_tr)) + def set_strigger(self): pass |
