diff options
| author | J08nY | 2024-06-04 16:18:20 +0200 |
|---|---|---|
| committer | J08nY | 2024-06-04 16:18:20 +0200 |
| commit | 4eadcd6ad1e4cadcb8bb0b6da8d9c0b62f2a09f0 (patch) | |
| tree | 8bcb8c253f6b0560e077c1731fda86c0d602eae7 /pyecsca/sca | |
| parent | 46893603bc9ea7b238f160437e4863564bca2f70 (diff) | |
| download | pyecsca-4eadcd6ad1e4cadcb8bb0b6da8d9c0b62f2a09f0.tar.gz pyecsca-4eadcd6ad1e4cadcb8bb0b6da8d9c0b62f2a09f0.tar.zst pyecsca-4eadcd6ad1e4cadcb8bb0b6da8d9c0b62f2a09f0.zip | |
Diffstat (limited to 'pyecsca/sca')
| -rw-r--r-- | pyecsca/sca/attack/CPA.py | 2 | ||||
| -rw-r--r-- | pyecsca/sca/attack/DPA.py | 2 | ||||
| -rw-r--r-- | pyecsca/sca/target/leakage.py | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/pyecsca/sca/attack/CPA.py b/pyecsca/sca/attack/CPA.py index 77c9abb..6efa3b5 100644 --- a/pyecsca/sca/attack/CPA.py +++ b/pyecsca/sca/attack/CPA.py @@ -55,7 +55,7 @@ class CPA: action_index += 2 elif bit == "0": action_index += 1 - result = ctx.actions.get_by_index([0, action_index])[0] + result = ctx.actions.get_by_index([action_index]).action return result.output_points[0].X def compute_correlation_trace( diff --git a/pyecsca/sca/attack/DPA.py b/pyecsca/sca/attack/DPA.py index 661adc6..da4ae65 100644 --- a/pyecsca/sca/attack/DPA.py +++ b/pyecsca/sca/attack/DPA.py @@ -50,7 +50,7 @@ class DPA: action_index += 2 elif bit == "0": action_index += 1 - result = ctx.actions.get_by_index([0, action_index])[0] + result = ctx.actions.get_by_index([action_index]).action return result.output_points[0] def split_traces( diff --git a/pyecsca/sca/target/leakage.py b/pyecsca/sca/target/leakage.py index c832028..e8734fb 100644 --- a/pyecsca/sca/target/leakage.py +++ b/pyecsca/sca/target/leakage.py @@ -52,6 +52,8 @@ class LeakageTarget(Target): temp_trace.append(leak) temp_trace: list[int] = [] + if not context.actions: + raise ValueError("Empty context") context.actions.walk(callback) return Trace(np.array(temp_trace)) |
