Skip to content

Commit

Permalink
[ci] Adds a CI test - opening KMAC project
Browse files Browse the repository at this point in the history
This test checks if the KMAC project can be succesfully opened by
the tvla analysis script.

Signed-off-by: Vladimir Rozic <[email protected]>
  • Loading branch information
vrozic committed Aug 1, 2023
1 parent 988009f commit 67c5152
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cw/tvla.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,8 @@ def run_tvla(ctx: typer.Context):
x_axis)
for i in range(0, num_samples, sample_step_ttest))
ttest_trace = np.concatenate((ttest_trace[:]), axis=3)
log.info("Saving T-test")
np.save('tmp/ttest.npy', ttest_trace)

# Building the t-test statistics vs. number of traces used. ttest_step has dimensions
# [num_orders, num_rnds, num_bytes, num_samples, num_steps], i.e., for every order,
Expand Down
3 changes: 3 additions & 0 deletions test/data/tvla_general/ci_opentitan_simple_kmac.cwp
Git LFS file not shown
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Trace Config]
format = native
numTraces = 50
numPoints = 3200
date = 2023-06-26 17:28:13
prefix = 2023.06.26-17.28.13_0
targetHW = unknown
targetSW = unknown
scopeName = unknown
scopeSampleRate = 0
scopeYUnits = 0
scopeXUnits = 0
notes = ""
8 changes: 8 additions & 0 deletions test/tvla_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ def ttest_significant(ttest_trace) -> bool:
return np.any(abs_max > threshold)


def test_general_nonleaking_project():
project_path = TestDataPath('tvla_general/ci_opentitan_simple_kmac.cwp')
tvla = TvlaCmd(Args(['--project-file', str(project_path),
'--mode', 'kmac', 'run-tvla'])).run()
assert not ttest_significant(np.load('tmp/ttest.npy')), (
f"{tvla} did find significant leakage, which is unexpected")


def test_general_leaking_histogram():
hist_path = TestDataPath('tvla_general/kmac_hist_leaking.npz')
tvla = TvlaCmd(Args(['--input-file', str(hist_path),
Expand Down

0 comments on commit 67c5152

Please sign in to comment.