Skip to content

Commit

Permalink
[ci] Add test for aes-general tvla
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Rozic <[email protected]>
  • Loading branch information
vrozic committed Sep 4, 2023
1 parent f1b7617 commit a51e48b
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 2 deletions.
3 changes: 3 additions & 0 deletions test/data/tvla_general/ci_opentitan_simple_aes_fvsr.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 = 5000
numPoints = 1200
date = 2023-08-17 18:15:28
prefix = 2023.08.17-18.15.28_0
targetHW = unknown
targetSW = unknown
scopeName = unknown
scopeSampleRate = 0
scopeYUnits = 0
scopeXUnits = 0
notes = ""
3 changes: 3 additions & 0 deletions test/data/tvla_general/ttest-step-golden-aes.npy.npz
Git LFS file not shown
19 changes: 17 additions & 2 deletions test/tvla_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ def ttest_compare_results(expected, received, delta) -> bool:
return nan_match and numbers_match


def test_general_nonleaking_project():
def test_general_kmac_nonleaking_project():
project_path = TestDataPath('tvla_general/ci_opentitan_simple_kmac.cwp')
tvla = TvlaCmd(Args(['--project-file', str(project_path),
'--mode', 'kmac', '--save-to-disk-ttest',
'--number-of-steps', '10', 'run-tvla'])).run()
expected_path = TestDataPath('tvla_general/ttest-step-golden.npy.npz')
expected_path = TestDataPath('tvla_general/ttest-step-golden-kmac.npy.npz')
expected_file = np.load(str(expected_path))
expected_trace = expected_file['ttest_step']
received_file = np.load('tmp/ttest-step.npy.npz')
Expand All @@ -58,6 +58,21 @@ def test_general_nonleaking_project():
f"{tvla} generated ttest_step values that don't match the expected ones")


def test_general_aes_nonleaking_project():
project_path = TestDataPath('tvla_general/ci_opentitan_simple_aes_fvsr.cwp')
tvla = TvlaCmd(Args(['--project-file', str(project_path),
'--mode', 'aes', '--save-to-disk-ttest',
'--number-of-steps', '10', 'run-tvla'])).run()
expected_path = TestDataPath('tvla_general/ttest-step-golden-aes.npy.npz')
expected_file = np.load(str(expected_path))
expected_trace = expected_file['ttest_step']
received_file = np.load('tmp/ttest-step.npy.npz')
received_trace = received_file['ttest_step']
delta = 0.001
assert ttest_compare_results(expected_trace, received_trace, delta), (
f"{tvla} generated ttest_step values that don't match the expected ones")


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

0 comments on commit a51e48b

Please sign in to comment.