Skip to content

Commit

Permalink
[ci] Add CI test for trace filtering
Browse files Browse the repository at this point in the history
This commit adds a CI test that checks if the TVLA trace filtaring
(currently only enabled for aes-byte-specific analysis) works
properly.
Checked in project traces are artificially polluted in such way
that 90% of the traces are unusable. The test checks that at most
100 (out of 1000) traces are used by the TVLA.

Signed-off-by: Vladimir Rozic <[email protected]>
  • Loading branch information
vrozic authored and nasahlpa committed Oct 10, 2023
1 parent 871ff19 commit ec68581
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/data/tvla_aes_byte/ci_opentitan_simple_aes.cwp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[Trace Management]
tracefile0 = ci_opentitan_simple_aes_data/traces/config_2023.09.21-17.29.29_0.cfg
enabled0 = True
[ChipWhisperer]
[[General Settings]]
Project Name = Untitled
Project File Version = 1.00
Project Author = Unknown
Program Name = ChipWhisperer
Program Version = ""
sample_rate = 200000000
fpga_bitstream = objs/lowrisc_systems_chip_earlgrey_cw310_0.1.bit
force_program_bitstream = False
fw_bin = objs/aes_serial_fpga_cw310.bin
pll_frequency = 100000000
baudrate = 115200
key_len_bytes = 16
plain_text_len_bytes = 16
output_len_bytes = 16
num_samples = 1200
offset = -40
lfsr_seed = 3735928559
batch_prng_seed = 0
scope_gain = 31.5
num_traces = 1000
project_name = projects/opentitan_simple_aes
waverunner_ip = 192.168.1.228
datetime = "09/21/2023, 17:29:29"
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 = 1000
numPoints = 1200
date = 2023-09-21 17:29:29
prefix = 2023.09.21-17.29.29_0
targetHW = unknown
targetSW = unknown
scopeName = unknown
scopeSampleRate = 0
scopeYUnits = 0
scopeXUnits = 0
notes = ""
11 changes: 11 additions & 0 deletions test/tvla_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,14 @@ def test_general_nonleaking_histogram():
'run-tvla'])).run()
assert not ttest_significant(np.load('tmp/ttest.npy')), (
f"{tvla} did find significant leakage, which is unexpected")


def test_aes_byte_filtering():
project_path = TestDataPath('tvla_aes_byte/ci_opentitan_simple_aes.cwp')
tvla = TvlaCmd(Args(['--project-file', str(project_path),
'--mode', 'aes', '--round-select', '0',
'--byte-select', '0', '--save-to-disk', 'run-tvla'])).run()
received_file = np.load('tmp/traces.npy.npz')
traces_to_use = received_file['traces_to_use']
assert sum(traces_to_use) <= 100, (
f"{tvla} filtered less than 90 % of the input traces, which is unexpected.")

0 comments on commit ec68581

Please sign in to comment.