Skip to content

Commit c4575d2

Browse files
committed
[fi] Command handlers for Ibex tests
This commit adds the command handlers and configs for the following Ibex FI penetration tests: - ibex.char.flash_read - ibex.char.flash_write - ibex.char.sram_read - ibex.char.sram_write - ibex.char.unconditional_branch - ibex.char.conditional_branch The device code is located in lowRISC/opentitan#22135 and the binary was compiled from lowRISC/opentitan@e5a0c2a using: ./bazelisk.sh build //sw/device/tests/crypto/cryptotest/firmware:firmware_fpga_cw310_test_rom Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
1 parent 679d99f commit c4575d2

8 files changed

Lines changed: 290 additions & 2 deletions
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
target:
2+
target_type: cw310
3+
fpga_bitstream: "../objs/lowrisc_systems_chip_earlgrey_cw310_0.1.bit"
4+
force_program_bitstream: False
5+
fw_bin: "../objs/sca_ujson_fpga_cw310.bin"
6+
output_len_bytes: 16
7+
target_clk_mult: 0.24
8+
target_freq: 24000000
9+
baudrate: 115200
10+
protocol: "ujson"
11+
port: "/dev/ttyACM4"
12+
fisetup:
13+
fi_gear: "husky"
14+
fi_type: "voltage_glitch"
15+
parameter_generation: "random"
16+
# Voltage glitch width in cycles.
17+
glitch_width_min: 5
18+
glitch_width_max: 150
19+
glitch_width_step: 3
20+
# Range for trigger delay in cycles.
21+
trigger_delay_min: 0
22+
trigger_delay_max: 500
23+
trigger_step: 10
24+
# Number of iterations for the parameter sweep.
25+
num_iterations: 100
26+
fiproject:
27+
# Project database type and memory threshold.
28+
project_db: "ot_fi_project"
29+
project_mem_threshold: 10000
30+
# Store FI plot.
31+
show_plot: True
32+
num_plots: 10
33+
plot_x_axis: "trigger_delay"
34+
plot_x_axis_legend: "[cycles]"
35+
plot_y_axis: "glitch_width"
36+
plot_y_axis_legend: "[cycles]"
37+
test:
38+
which_test: "ibex_char_conditional_branch"
39+
expected_result: '{"result1":10001,"result2":0,"err_status":0}'
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
target:
2+
target_type: cw310
3+
fpga_bitstream: "../objs/lowrisc_systems_chip_earlgrey_cw310_0.1.bit"
4+
force_program_bitstream: False
5+
fw_bin: "../objs/sca_ujson_fpga_cw310.bin"
6+
output_len_bytes: 16
7+
target_clk_mult: 0.24
8+
target_freq: 24000000
9+
baudrate: 115200
10+
protocol: "ujson"
11+
port: "/dev/ttyACM4"
12+
fisetup:
13+
fi_gear: "husky"
14+
fi_type: "voltage_glitch"
15+
parameter_generation: "random"
16+
# Voltage glitch width in cycles.
17+
glitch_width_min: 5
18+
glitch_width_max: 150
19+
glitch_width_step: 3
20+
# Range for trigger delay in cycles.
21+
trigger_delay_min: 0
22+
trigger_delay_max: 500
23+
trigger_step: 10
24+
# Number of iterations for the parameter sweep.
25+
num_iterations: 100
26+
fiproject:
27+
# Project database type and memory threshold.
28+
project_db: "ot_fi_project"
29+
project_mem_threshold: 10000
30+
# Store FI plot.
31+
show_plot: True
32+
num_plots: 10
33+
plot_x_axis: "trigger_delay"
34+
plot_x_axis_legend: "[cycles]"
35+
plot_y_axis: "glitch_width"
36+
plot_y_axis_legend: "[cycles]"
37+
test:
38+
which_test: "ibex_char_flash_read"
39+
expected_result: '{"result":0,"err_status":0}'
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
target:
2+
target_type: cw310
3+
fpga_bitstream: "../objs/lowrisc_systems_chip_earlgrey_cw310_0.1.bit"
4+
force_program_bitstream: False
5+
fw_bin: "../objs/sca_ujson_fpga_cw310.bin"
6+
output_len_bytes: 16
7+
target_clk_mult: 0.24
8+
target_freq: 24000000
9+
baudrate: 115200
10+
protocol: "ujson"
11+
port: "/dev/ttyACM4"
12+
fisetup:
13+
fi_gear: "husky"
14+
fi_type: "voltage_glitch"
15+
parameter_generation: "random"
16+
# Voltage glitch width in cycles.
17+
glitch_width_min: 5
18+
glitch_width_max: 150
19+
glitch_width_step: 3
20+
# Range for trigger delay in cycles.
21+
trigger_delay_min: 0
22+
trigger_delay_max: 500
23+
trigger_step: 10
24+
# Number of iterations for the parameter sweep.
25+
num_iterations: 100
26+
fiproject:
27+
# Project database type and memory threshold.
28+
project_db: "ot_fi_project"
29+
project_mem_threshold: 10000
30+
# Store FI plot.
31+
show_plot: True
32+
num_plots: 10
33+
plot_x_axis: "trigger_delay"
34+
plot_x_axis_legend: "[cycles]"
35+
plot_y_axis: "glitch_width"
36+
plot_y_axis_legend: "[cycles]"
37+
test:
38+
which_test: "ibex_char_flash_write"
39+
expected_result: '{"result":0,"err_status":0}'
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
target:
2+
target_type: cw310
3+
fpga_bitstream: "../objs/lowrisc_systems_chip_earlgrey_cw310_0.1.bit"
4+
force_program_bitstream: False
5+
fw_bin: "../objs/sca_ujson_fpga_cw310.bin"
6+
output_len_bytes: 16
7+
target_clk_mult: 0.24
8+
target_freq: 24000000
9+
baudrate: 115200
10+
protocol: "ujson"
11+
port: "/dev/ttyACM4"
12+
fisetup:
13+
fi_gear: "husky"
14+
fi_type: "voltage_glitch"
15+
parameter_generation: "random"
16+
# Voltage glitch width in cycles.
17+
glitch_width_min: 5
18+
glitch_width_max: 150
19+
glitch_width_step: 3
20+
# Range for trigger delay in cycles.
21+
trigger_delay_min: 0
22+
trigger_delay_max: 500
23+
trigger_step: 10
24+
# Number of iterations for the parameter sweep.
25+
num_iterations: 100
26+
fiproject:
27+
# Project database type and memory threshold.
28+
project_db: "ot_fi_project"
29+
project_mem_threshold: 10000
30+
# Store FI plot.
31+
show_plot: True
32+
num_plots: 10
33+
plot_x_axis: "trigger_delay"
34+
plot_x_axis_legend: "[cycles]"
35+
plot_y_axis: "glitch_width"
36+
plot_y_axis_legend: "[cycles]"
37+
test:
38+
which_test: "ibex_char_sram_read"
39+
expected_result: '{"result":0,"err_status":0}'
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
target:
2+
target_type: cw310
3+
fpga_bitstream: "../objs/lowrisc_systems_chip_earlgrey_cw310_0.1.bit"
4+
force_program_bitstream: False
5+
fw_bin: "../objs/sca_ujson_fpga_cw310.bin"
6+
output_len_bytes: 16
7+
target_clk_mult: 0.24
8+
target_freq: 24000000
9+
baudrate: 115200
10+
protocol: "ujson"
11+
port: "/dev/ttyACM4"
12+
fisetup:
13+
fi_gear: "husky"
14+
fi_type: "voltage_glitch"
15+
parameter_generation: "random"
16+
# Voltage glitch width in cycles.
17+
glitch_width_min: 5
18+
glitch_width_max: 150
19+
glitch_width_step: 3
20+
# Range for trigger delay in cycles.
21+
trigger_delay_min: 0
22+
trigger_delay_max: 500
23+
trigger_step: 10
24+
# Number of iterations for the parameter sweep.
25+
num_iterations: 100
26+
fiproject:
27+
# Project database type and memory threshold.
28+
project_db: "ot_fi_project"
29+
project_mem_threshold: 10000
30+
# Store FI plot.
31+
show_plot: True
32+
num_plots: 10
33+
plot_x_axis: "trigger_delay"
34+
plot_x_axis_legend: "[cycles]"
35+
plot_y_axis: "glitch_width"
36+
plot_y_axis_legend: "[cycles]"
37+
test:
38+
which_test: "ibex_char_sram_write"
39+
expected_result: '{"result":0,"err_status":0}'
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
target:
2+
target_type: cw310
3+
fpga_bitstream: "../objs/lowrisc_systems_chip_earlgrey_cw310_0.1.bit"
4+
force_program_bitstream: False
5+
fw_bin: "../objs/sca_ujson_fpga_cw310.bin"
6+
output_len_bytes: 16
7+
target_clk_mult: 0.24
8+
target_freq: 24000000
9+
baudrate: 115200
10+
protocol: "ujson"
11+
port: "/dev/ttyACM4"
12+
fisetup:
13+
fi_gear: "husky"
14+
fi_type: "voltage_glitch"
15+
parameter_generation: "random"
16+
# Voltage glitch width in cycles.
17+
glitch_width_min: 5
18+
glitch_width_max: 150
19+
glitch_width_step: 3
20+
# Range for trigger delay in cycles.
21+
trigger_delay_min: 0
22+
trigger_delay_max: 500
23+
trigger_step: 10
24+
# Number of iterations for the parameter sweep.
25+
num_iterations: 100
26+
fiproject:
27+
# Project database type and memory threshold.
28+
project_db: "ot_fi_project"
29+
project_mem_threshold: 10000
30+
# Store FI plot.
31+
show_plot: True
32+
num_plots: 10
33+
plot_x_axis: "trigger_delay"
34+
plot_x_axis_legend: "[cycles]"
35+
plot_y_axis: "glitch_width"
36+
plot_y_axis_legend: "[cycles]"
37+
test:
38+
which_test: "ibex_char_unconditional_branch"
39+
expected_result: '{"result":100,"err_status":0}'

objs/sca_ujson_fpga_cw310.bin

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:0ad1df47ebaad117676b11d7b3937f5e3b6becf9c73914554badd4e32ba73052
3-
size 298684
2+
oid sha256:b79fa7125b748b00bc231ecb563e266edf4213eb27ef2318b35315d5c32169b1
3+
size 304188

target/communication/fi_ibex_commands.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,60 @@ def ibex_char_mem_op_loop(self) -> None:
5454
time.sleep(0.01)
5555
self.target.write(json.dumps("CharMemOpLoop").encode("ascii"))
5656

57+
def ibex_char_flash_read(self) -> None:
58+
""" Starts the ibex.char.flash_read test.
59+
"""
60+
# IbexFi command.
61+
self._ujson_ibex_fi_cmd()
62+
# CharFlashRead command.
63+
time.sleep(0.01)
64+
self.target.write(json.dumps("CharFlashRead").encode("ascii"))
65+
66+
def ibex_char_flash_write(self) -> None:
67+
""" Starts the ibex.char.flash_write test.
68+
"""
69+
# IbexFi command.
70+
self._ujson_ibex_fi_cmd()
71+
# CharFlashWrite command.
72+
time.sleep(0.01)
73+
self.target.write(json.dumps("CharFlashWrite").encode("ascii"))
74+
75+
def ibex_char_sram_read(self) -> None:
76+
""" Starts the ibex.char.sram_read test.
77+
"""
78+
# IbexFi command.
79+
self._ujson_ibex_fi_cmd()
80+
# CharSramRead command.
81+
time.sleep(0.01)
82+
self.target.write(json.dumps("CharSramRead").encode("ascii"))
83+
84+
def ibex_char_sram_write(self) -> None:
85+
""" Starts the ibex.char.sram_write test.
86+
"""
87+
# IbexFi command.
88+
self._ujson_ibex_fi_cmd()
89+
# CharSramWrite command.
90+
time.sleep(0.01)
91+
self.target.write(json.dumps("CharSramWrite").encode("ascii"))
92+
93+
def ibex_char_unconditional_branch(self) -> None:
94+
""" Starts the ibex.char.unconditional_branch test.
95+
"""
96+
# IbexFi command.
97+
self._ujson_ibex_fi_cmd()
98+
# CharUncondBranch command.
99+
time.sleep(0.01)
100+
self.target.write(json.dumps("CharUncondBranch").encode("ascii"))
101+
102+
def ibex_char_conditional_branch(self) -> None:
103+
""" Starts the ibex.char.conditional_branch test.
104+
"""
105+
# IbexFi command.
106+
self._ujson_ibex_fi_cmd()
107+
# CharCondBranch command.
108+
time.sleep(0.01)
109+
self.target.write(json.dumps("CharCondBranch").encode("ascii"))
110+
57111
def init_trigger(self) -> None:
58112
""" Initialize the FI trigger on the chip.
59113

0 commit comments

Comments
 (0)