Skip to content

Commit

Permalink
[fi] Add AES and KMAC handlers
Browse files Browse the repository at this point in the history
This commit adds the handlers for the following tests:
- crypto_fi_aes_key
- crypto_fi_aes_plaintext
- crypto_fi_aes_encrypt
- crypto_fi_aes_ciphertext
- crypto_fi_kmac_key
- crypto_fi_kmac_absorb
- crypto_fi_kmac_squeeze

The device PR is located in lowRISC/opentitan#22505

Signed-off-by: Pascal Nasahl <[email protected]>
  • Loading branch information
nasahlpa committed Apr 19, 2024
1 parent 5158c0a commit d21f716
Show file tree
Hide file tree
Showing 7 changed files with 534 additions and 12 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/fpga.yml
Original file line number Diff line number Diff line change
Expand Up @@ -337,3 +337,14 @@ jobs:
with:
name: fi_plot_otbn_cw310
path: ./ci/projects/otbn_fi_cw310.html

- name: Dummy VCC glitching on AES
working-directory: ci
run: |
../fault_injection/fi_crypto.py -c cfg/ci_crypto_aes_vcc_dummy_cw310.yaml -p projects/aes_fi_cw310
- name: Upload FI AES CW310 plot
uses: actions/upload-artifact@v4
with:
name: fi_plot_aes_cw310
path: ./ci/projects/aes_fi_cw310.html
10 changes: 10 additions & 0 deletions ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,13 @@ jobs:
- publish: ./ci/projects/otbn_fi_cw310.html
artifact: fi_plot_otbn_cw310
displayName: "Upload FI OTBN CW310 plot"
- bash: |
set -e
pushd ci
mkdir -p projects
../fault_injection/fi_crypto.py -c cfg/ci_crypto_aes_vcc_dummy_cw310.yaml -p projects/aes_fi_cw310
popd
displayName: "Dummy VCC glitching on AES"
- publish: ./ci/projects/aes_fi_cw310.html
artifact: fi_plot_aes_cw310
displayName: "Upload FI AES CW310 plot"
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
target:
target_type: chip
fw_bin: "../objs/sca_ujson_chip_signed.img"
target_type: cw310
fpga_bitstream: "../objs/lowrisc_systems_chip_earlgrey_cw310_0.1.bit"
force_program_bitstream: False
fw_bin: "../objs/sca_ujson_fpga_cw310.bin"
output_len_bytes: 16
target_clk_mult: 1
target_freq: 100000000
target_clk_mult: 0.24
target_freq: 24000000
baudrate: 115200
protocol: "ujson"
port: "/dev/ttyUSB1"
usb_serial: "205F355C3236"
port: "/dev/ttyACM_CW310_1"
# Trigger source.
# hw: Precise, hardware-generated trigger - FPGA only.
# sw: Fully software-controlled trigger.
trigger: "hw"
fisetup:
fi_gear: "dummy"
fi_type: "voltage_glitch"
Expand Down Expand Up @@ -36,14 +41,14 @@ fiproject:
project_mem_threshold: 10000
# Store FI plot.
show_plot: True
num_plots: 10
plot_x_axis: "trigger_delay"
plot_x_axis_legend: "[cycles]"
num_plots: 100
plot_x_axis: "glitch_voltage"
plot_x_axis_legend: "[V]"
plot_y_axis: "glitch_width"
plot_y_axis_legend: "[cycles]"
plot_y_axis_legend: "[ns]"
test:
which_test: "otbn_char_unrolled_reg_op_loop"
expected_result: '{"loop_counter":100,"err_status":0,"alerts":0}'
which_test: "crypto_fi_aes_encrypt"
expected_result: '{"ciphertext":[141,145,88,155,234,129,16,92,221,12,69,21,69,208,99,12],"alerts":0}'
# Set to true if the test should ignore alerts returned by the test. As the
# alert handler on the device could sometime fire alerts that are not
# related to the FI, ignoring is by default set to true. A manual analysis
Expand Down
47 changes: 47 additions & 0 deletions fault_injection/configs/pen.global_fi.crypto.aes.cw310.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
target:
target_type: cw310
fpga_bitstream: "../objs/lowrisc_systems_chip_earlgrey_cw310_0.1.bit"
force_program_bitstream: False
fw_bin: "../objs/sca_ujson_fpga_cw310.bin"
output_len_bytes: 16
target_clk_mult: 0.24
target_freq: 24000000
baudrate: 115200
protocol: "ujson"
port: "/dev/ttyACM4"
fisetup:
fi_gear: "husky"
fi_type: "voltage_glitch"
parameter_generation: "random"
# Voltage glitch width in cycles.
glitch_width_min: 5
glitch_width_max: 150
glitch_width_step: 3
# Range for trigger delay in cycles.
trigger_delay_min: 0
trigger_delay_max: 500
trigger_step: 10
# Number of iterations for the parameter sweep.
num_iterations: 100
fiproject:
# Project database type and memory threshold.
project_db: "ot_fi_project"
project_mem_threshold: 10000
# Store FI plot.
show_plot: True
num_plots: 10
plot_x_axis: "trigger_delay"
plot_x_axis_legend: "[cycles]"
plot_y_axis: "glitch_width"
plot_y_axis_legend: "[cycles]"
test:
# which_test: "crypto_fi_aes_key"
# which_test: "crypto_fi_aes_plaintext"
which_test: "crypto_fi_aes_encrypt"
# which_test: "crypto_fi_aes_ciphertext"
expected_result: '{"ciphertext":[141,145,88,155,234,129,16,92,221,12,69,21,69,208,99,12],"alerts":0}'
# Set to true if the test should ignore alerts returned by the test. As the
# alert handler on the device could sometime fire alerts that are not
# related to the FI, ignoring is by default set to true. A manual analysis
# still can be performed as the alerts are stored in the database.
ignore_alerts: True
46 changes: 46 additions & 0 deletions fault_injection/configs/pen.global_fi.crypto.kmac.cw310.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
target:
target_type: cw310
fpga_bitstream: "../objs/lowrisc_systems_chip_earlgrey_cw310_0.1.bit"
force_program_bitstream: False
fw_bin: "../objs/sca_ujson_fpga_cw310.bin"
output_len_bytes: 16
target_clk_mult: 0.24
target_freq: 24000000
baudrate: 115200
protocol: "ujson"
port: "/dev/ttyACM4"
fisetup:
fi_gear: "husky"
fi_type: "voltage_glitch"
parameter_generation: "random"
# Voltage glitch width in cycles.
glitch_width_min: 5
glitch_width_max: 150
glitch_width_step: 3
# Range for trigger delay in cycles.
trigger_delay_min: 0
trigger_delay_max: 500
trigger_step: 10
# Number of iterations for the parameter sweep.
num_iterations: 100
fiproject:
# Project database type and memory threshold.
project_db: "ot_fi_project"
project_mem_threshold: 10000
# Store FI plot.
show_plot: True
num_plots: 10
plot_x_axis: "trigger_delay"
plot_x_axis_legend: "[cycles]"
plot_y_axis: "glitch_width"
plot_y_axis_legend: "[cycles]"
test:
# which_test: "crypto_fi_kmac_key"
which_test: "crypto_fi_kmac_absorb"
# which_test: "crypto_fi_kmac_squeeze"
expected_result: '{"ciphertext":[184,34,91,108,231,47,251,27],"alerts":0}'
# Set to true if the test should ignore alerts returned by the test. As the
# alert handler on the device could sometime fire alerts that are not
# related to the FI, ignoring is by default set to true. A manual analysis
# still can be performed as the alerts are stored in the database.
ignore_alerts: True
Loading

0 comments on commit d21f716

Please sign in to comment.