Skip to content

Commit

Permalink
[tvla] Change default value for general-tast
Browse files Browse the repository at this point in the history
At the moment the default value of the `--general-test` parameter
is `True`. This argument cannot be changed to `False` via command
line, but only through the yaml configuration file.
Since we don't use configuaration files for TVLA in the CI, it is
currently impossible to add tests for aes-specific TVLA.
To enable adding these tests, this commit changes the default value
to `False` and adds `--general-test` to CI commands where needed.

Signed-off-by: Vladimir Rozic <[email protected]>
  • Loading branch information
vrozic committed Sep 22, 2023
1 parent de2ab37 commit 0028fb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cw/tvla.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ def run_tvla(ctx: typer.Context):
default_number_of_steps = 1
default_ttest_step_file = None
default_plot_figures = False
default_general_test = True
default_general_test = False
default_mode = "aes"
default_update_cfg_file = False

Expand Down
10 changes: 6 additions & 4 deletions test/tvla_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def ttest_compare_results(expected, received, delta) -> bool:
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',
'--mode', 'kmac', '--save-to-disk-ttest', '--general-test',
'--number-of-steps', '10', 'run-tvla'])).run()
expected_path = TestDataPath('tvla_general/ttest-step-golden-kmac.npy.npz')
expected_file = np.load(str(expected_path))
Expand All @@ -61,7 +61,7 @@ def test_general_kmac_nonleaking_project():
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',
'--mode', 'aes', '--save-to-disk-ttest', '--general-test',
'--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))
Expand All @@ -76,14 +76,16 @@ def test_general_aes_nonleaking_project():
def test_general_leaking_histogram():
hist_path = TestDataPath('tvla_general/kmac_hist_leaking.npz')
tvla = TvlaCmd(Args(['--input-histogram-file', str(hist_path),
'--mode', 'kmac', '--save-to-disk-ttest', 'run-tvla'])).run()
'--mode', 'kmac', '--save-to-disk-ttest', '--general-test',
'run-tvla'])).run()
assert ttest_significant(np.load('tmp/ttest.npy')), (
f"{tvla} did not find significant leakage, which is unexpected")


def test_general_nonleaking_histogram():
hist_path = TestDataPath('tvla_general/kmac_hist_nonleaking.npz')
tvla = TvlaCmd(Args(['--input-histogram-file', str(hist_path),
'--mode', 'kmac', '--save-to-disk-ttest', 'run-tvla'])).run()
'--mode', 'kmac', '--save-to-disk-ttest', '--general-test',
'run-tvla'])).run()
assert not ttest_significant(np.load('tmp/ttest.npy')), (
f"{tvla} did find significant leakage, which is unexpected")

0 comments on commit 0028fb1

Please sign in to comment.