Skip to content

Commit

Permalink
[fi] Add Ibex tests
Browse files Browse the repository at this point in the history
This commit adds the following FI tests:

- ibex.fi.address_translation
- ibex.fi.address_translation_config
- ibex.fi.char.csr_write
- ibex.fi.char.csr_read

The device code is located in lowRISC/opentitan#22269 and the
binary was compiled from lowRISC/opentitan@5968e0b

Signed-off-by: Pascal Nasahl <[email protected]>
  • Loading branch information
nasahlpa committed Apr 5, 2024
1 parent c48d264 commit a41f7e3
Show file tree
Hide file tree
Showing 19 changed files with 374 additions and 53 deletions.
51 changes: 51 additions & 0 deletions fault_injection/configs/chip_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
target:
target_type: chip
fw_bin: "../objs/sca_ujson_chip_signed.img"
output_len_bytes: 16
target_clk_mult: 1
target_freq: 100000000
baudrate: 115200
protocol: "ujson"
port: "/dev/ttyUSB1"
usb_serial: "205F355C3236"
fisetup:
fi_gear: "dummy"
fi_type: "voltage_glitch"
# Parameter generation.
parameter_generation: "random"
# Number of randomized iterations for the parameter sweep.
# For parameter_generation: "random", this is the number of iterations.
# For parameter_generation: "deterministic", this is the number of iterations
# per fixed parameter.
num_iterations: 100
# Voltage glitch width in ns.
glitch_voltage_min: 2.7
glitch_voltage_max: 3.3
glitch_voltage_step: 0.05
# Voltage glitch width in ns.
glitch_width_min: 5
glitch_width_max: 150
glitch_width_step: 3
# Range for trigger delay in ns.
trigger_delay_min: 0
trigger_delay_max: 500
trigger_step: 10
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: "otbn_char_unrolled_reg_op_loop"
expected_result: '{"loop_counter":100,"err_status":0,"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
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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: "ibex_address_translation"
expected_result: '{"result":0,"err_status":0,"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
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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: "ibex_address_translation_config"
expected_result: '{"result":0,"err_status":0,"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
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ fiproject:
plot_y_axis_legend: "[cycles]"
test:
which_test: "ibex_char_conditional_branch"
expected_result: '{"result1":10001,"result2":0,"err_status":0}'
expected_result: '{"result1":10001,"result2":0,"err_status":0,"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
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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: "ibex_char_csr_read"
expected_result: '{"result":0,"err_status":0,"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
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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: "ibex_char_csr_write"
expected_result: '{"result":0,"err_status":0,"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
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ fiproject:
plot_y_axis_legend: "[cycles]"
test:
which_test: "ibex_char_flash_read"
expected_result: '{"result":0,"err_status":0}'
expected_result: '{"result":0,"err_status":0,"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
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ fiproject:
plot_y_axis_legend: "[cycles]"
test:
which_test: "ibex_char_flash_write"
expected_result: '{"result":0,"err_status":0}'
expected_result: '{"result":0,"err_status":0,"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

Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ fiproject:
plot_y_axis_legend: "[cycles]"
test:
which_test: "ibex_char_register_file"
expected_result: '{"result":0,"err_status":0}'
expected_result: '{"result":0,"err_status":0,"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
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ fiproject:
plot_y_axis_legend: "[cycles]"
test:
which_test: "ibex_char_register_file_read"
expected_result: '{"result":0,"err_status":0}'
expected_result: '{"result":0,"err_status":0,"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
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ fiproject:
plot_y_axis_legend: "[cycles]"
test:
which_test: "ibex_char_sram_read"
expected_result: '{"result":0,"err_status":0}'
expected_result: '{"result":0,"err_status":0,"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
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ fiproject:
plot_y_axis_legend: "[cycles]"
test:
which_test: "ibex_char_sram_write"
expected_result: '{"result":0,"err_status":0}'
expected_result: '{"result":0,"err_status":0,"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
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ fiproject:
plot_y_axis_legend: "[cycles]"
test:
which_test: "ibex_char_unconditional_branch"
expected_result: '{"result":100,"err_status":0}'
expected_result: '{"result":100,"err_status":0,"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
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ fiproject:
plot_y_axis_legend: "[cycles]"
test:
which_test: "otbn_key_sideload"
expected_result: '{"result":0,"err_status":0}'
expected_result: '{"result":0,"err_status":0,"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
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ fiproject:
plot_y_axis_legend: "[cycles]"
test:
which_test: "otbn_load_integrity"
expected_result: '{"result":0,"err_status":0}'
expected_result: '{"result":0,"err_status":0,"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 a41f7e3

Please sign in to comment.