Skip to content

Commit

Permalink
[ci] Add TVLA AES check to CI
Browse files Browse the repository at this point in the history
This PR runs TVLA for AES and publishes the TVLA figure as an
artifact.

Signed-off-by: Pascal Nasahl <[email protected]>
  • Loading branch information
nasahlpa committed Oct 13, 2023
1 parent 1159f4a commit f15765e
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 8 deletions.
12 changes: 11 additions & 1 deletion ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,14 @@ jobs:
displayName: "Upload plot of captured AES traces."
- publish: ./ci/ci_projects/opentitan_simple_aes.zip
artifact: project_traces_aes
displayName: "Upload project of captured AES traces."
displayName: "Upload project of captured AES traces."
- bash: |
set -e
pushd ci
./ci_check_tvla_aes.sh
popd
displayName: "Check AES TVLA"
continueOnError: True
- publish: ./ci/tmp/figures
artifact: tvla_figure
displayName: "Upload figure of AES TVLA."
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
device:
fpga_bitstream: ../cw/objs/lowrisc_systems_chip_earlgrey_cw310_0.1.bit
fpga_bitstream: ../../cw/objs/lowrisc_systems_chip_earlgrey_cw310_0.1.bit
force_program_bitstream: True
fw_bin: ../cw/objs/aes_serial_fpga_cw310.bin
fw_bin: ../../cw/objs/aes_serial_fpga_cw310.bin
pll_frequency: 100000000
baudrate: 115200
capture:
Expand All @@ -22,11 +22,11 @@ capture:
batch_prng_seed: 0
scope_gain: 31.5
num_traces: 100
project_name: ci_projects/opentitan_simple_aes
project_name: ../ci_projects/opentitan_simple_aes
waverunner_ip: 192.168.1.228
project_export: True
project_export_filename: ci_projects/opentitan_simple_aes.zip
project_export_filename: ../ci_projects/opentitan_simple_aes.zip
plot_capture:
show: True
num_traces: 100
trace_image_filename: ci_projects/sample_traces_aes.html
trace_image_filename: ../ci_projects/sample_traces_aes.html
16 changes: 16 additions & 0 deletions ci/cfg/ci_tvla_cfg_aes_specific_byte0_rnd0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
project_file: ../ci_projects/opentitan_simple_aes
trace_file: null
trace_start: null
trace_end: null
leakage_file: null
save_to_disk: null
save_to_disk_ttest: null
round_select: 0
byte_select: 0
input_histogram_file: null
output_histogram_file: null
number_of_steps: 1
ttest_step_file: null
plot_figures: true
general_test: false
mode: aes
2 changes: 1 addition & 1 deletion ci/ci_capture_aes_fvsr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-License-Identifier: Apache-2.0

# Simple script to test AES fvsr-key capture
../cw/capture.py --cfg-file ci_capture_aes_cw310.yaml capture aes-fvsr-key-batch
../cw/capture.py --cfg-file cfg/ci_capture_aes_cw310.yaml capture aes-fvsr-key-batch
if [ -d "./ci_projects/opentitan_simple_aes_data" ];
then
echo "Directory ./ci_projects/opentitan_simple_aes_data exists"
Expand Down
2 changes: 1 addition & 1 deletion ci/ci_check_aes_traces.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ARGS="--force-program-bitstream"
for test in ${!aes_test_list[@]}; do
echo Testing ${test} on CW310 - `date`
NUM_TRACES=${aes_test_list[${test}]}
../cw/capture.py --cfg-file ci_capture_aes_cw310.yaml capture ${test} \
../cw/capture.py --cfg-file cfg/ci_capture_aes_cw310.yaml capture ${test} \
--num-traces ${NUM_TRACES} ${ARGS} &>> "tmp/test_capture.log"

mv ./ci_projects/sample_traces_${MODE}.html tmp/${test}_traces.html
Expand Down
25 changes: 25 additions & 0 deletions ci/ci_check_tvla_aes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

# Simple script to test AES capture.
mkdir -p tmp

# AES
MODE="aes"
BOARD=cw310
declare -A aes_test_list
aes_test_list["aes-random"]=10000

ARGS="--force-program-bitstream"
for test in ${!aes_test_list[@]}; do
echo Testing ${test} on CW310 - `date`
NUM_TRACES=${aes_test_list[${test}]}
../cw/capture.py --cfg-file cfg/ci_capture_aes_cw310.yaml capture ${test} \
--num-traces ${NUM_TRACES} ${ARGS} &>> "tmp/test_tvla.log"
../cw/tvla.py ./tvla.py --cfg-file cfg/ci_tvla_cfg_aes_specific_byte0_rnd0.yaml \
run-tvla &>> "tmp/test_tvla.log"
ARGS=""
done

0 comments on commit f15765e

Please sign in to comment.