|
| 1 | +# Copyright lowRISC contributors (OpenTitan project). |
| 2 | +# Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| 3 | +# SPDX-License-Identifier: Apache-2.0 |
| 4 | + |
| 5 | +load("@//third_party/python:requirements.bzl", "requirement") |
| 6 | + |
| 7 | +package(default_visibility = ["//visibility:public"]) |
| 8 | + |
| 9 | +py_binary( |
| 10 | + name = "fi_crypto", |
| 11 | + testonly = True, |
| 12 | + srcs = ["fi_crypto.py"], |
| 13 | + data = [ |
| 14 | + "@lowrisc_opentitan//sw/host/opentitantool", |
| 15 | + ] + select({ |
| 16 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_silicon_owner_gb_rom_ext": [ |
| 17 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/firmware:pen_test_fi_silicon_owner_gb_rom_ext", |
| 18 | + ], |
| 19 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_fpga_cw310_rom_with_fake_keys": [ |
| 20 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/firmware:pen_test_fi_fpga_cw310_rom_with_fake_keys", |
| 21 | + ], |
| 22 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_fpga_cw310_sival_rom_ext": [ |
| 23 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/firmware:pen_test_fi_fpga_cw310_sival_rom_ext", |
| 24 | + ], |
| 25 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_fpga_cw310_test_rom": [ |
| 26 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/firmware:pen_test_fi_fpga_cw310_test_rom", |
| 27 | + ], |
| 28 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_silicon_owner_a2_rom_ext": [ |
| 29 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/firmware:pen_test_fi_silicon_owner_a2_rom_ext", |
| 30 | + ], |
| 31 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_silicon_owner_sival_rom_ext": [ |
| 32 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/firmware:pen_test_fi_silicon_owner_sival_rom_ext", |
| 33 | + ], |
| 34 | + "//conditions:default": [ |
| 35 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/firmware:pen_test_fi_silicon_owner_gb_rom_ext", |
| 36 | + ], |
| 37 | + }), |
| 38 | + env = select({ |
| 39 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_silicon_owner_gb_rom_ext": { |
| 40 | + "SELECTED_FIRMWARE_TARGET": "pen_test_fi_silicon_owner_gb_rom_ext", |
| 41 | + }, |
| 42 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_fpga_cw310_rom_with_fake_keys": { |
| 43 | + "SELECTED_FIRMWARE_TARGET": "pen_test_fi_fpga_cw310_rom_with_fake_keys", |
| 44 | + }, |
| 45 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_fpga_cw310_sival_rom_ext": { |
| 46 | + "SELECTED_FIRMWARE_TARGET": "pen_test_fi_fpga_cw310_sival_rom_ext", |
| 47 | + }, |
| 48 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_fpga_cw310_test_rom": { |
| 49 | + "SELECTED_FIRMWARE_TARGET": "pen_test_fi_fpga_cw310_test_rom", |
| 50 | + }, |
| 51 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_silicon_owner_a2_rom_ext": { |
| 52 | + "SELECTED_FIRMWARE_TARGET": "pen_test_fi_silicon_owner_a2_rom_ext", |
| 53 | + }, |
| 54 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_silicon_owner_sival_rom_ext": { |
| 55 | + "SELECTED_FIRMWARE_TARGET": "pen_test_fi_silicon_owner_sival_rom_ext", |
| 56 | + }, |
| 57 | + "//conditions:default": { |
| 58 | + "SELECTED_FIRMWARE_TARGET": "pen_test_fi_silicon_owner_gb_rom_ext", |
| 59 | + }, |
| 60 | + }), |
| 61 | + deps = [ |
| 62 | + requirement("pyyaml"), |
| 63 | + requirement("tqdm"), |
| 64 | + requirement("pycryptodome"), |
| 65 | + "//target/communication:fi_crypto_commands", |
| 66 | + "//fault_injection/project_library:project", |
| 67 | + "//util:plot", |
| 68 | + "//util:helpers", |
| 69 | + "//target:targets", |
| 70 | + "@rules_python//python/runfiles", |
| 71 | + "//fault_injection/fi_gear:fi_gear", |
| 72 | + "//test/penetrationtests/util:utils", |
| 73 | + ], |
| 74 | +) |
| 75 | + |
| 76 | +py_binary( |
| 77 | + name = "fi_ibex", |
| 78 | + testonly = True, |
| 79 | + srcs = ["fi_ibex.py"], |
| 80 | + data = [ |
| 81 | + "@lowrisc_opentitan//sw/host/opentitantool", |
| 82 | + ] + select({ |
| 83 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_silicon_owner_gb_rom_ext": [ |
| 84 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/firmware:pen_test_fi_ibex_silicon_owner_gb_rom_ext", |
| 85 | + ], |
| 86 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_fpga_cw310_rom_with_fake_keys": [ |
| 87 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/firmware:pen_test_fi_ibex_fpga_cw310_rom_with_fake_keys", |
| 88 | + ], |
| 89 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_fpga_cw310_sival_rom_ext": [ |
| 90 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/firmware:pen_test_fi_ibex_fpga_cw310_sival_rom_ext", |
| 91 | + ], |
| 92 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_fpga_cw310_test_rom": [ |
| 93 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/firmware:pen_test_fi_ibex_fpga_cw310_test_rom", |
| 94 | + ], |
| 95 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_silicon_owner_a2_rom_ext": [ |
| 96 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/firmware:pen_test_fi_ibex_silicon_owner_a2_rom_ext", |
| 97 | + ], |
| 98 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_silicon_owner_sival_rom_ext": [ |
| 99 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/firmware:pen_test_fi_ibex_silicon_owner_sival_rom_ext", |
| 100 | + ], |
| 101 | + "//conditions:default": [ |
| 102 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/firmware:pen_test_fi_ibex_silicon_owner_gb_rom_ext", |
| 103 | + ], |
| 104 | + }), |
| 105 | + env = select({ |
| 106 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_silicon_owner_gb_rom_ext": { |
| 107 | + "SELECTED_FIRMWARE_TARGET": "pen_test_fi_ibex_silicon_owner_gb_rom_ext", |
| 108 | + }, |
| 109 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_fpga_cw310_rom_with_fake_keys": { |
| 110 | + "SELECTED_FIRMWARE_TARGET": "pen_test_fi_ibex_fpga_cw310_rom_with_fake_keys", |
| 111 | + }, |
| 112 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_fpga_cw310_sival_rom_ext": { |
| 113 | + "SELECTED_FIRMWARE_TARGET": "pen_test_fi_ibex_fpga_cw310_sival_rom_ext", |
| 114 | + }, |
| 115 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_fpga_cw310_test_rom": { |
| 116 | + "SELECTED_FIRMWARE_TARGET": "pen_test_fi_ibex_fpga_cw310_test_rom", |
| 117 | + }, |
| 118 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_silicon_owner_a2_rom_ext": { |
| 119 | + "SELECTED_FIRMWARE_TARGET": "pen_test_fi_ibex_silicon_owner_a2_rom_ext", |
| 120 | + }, |
| 121 | + "@lowrisc_opentitan//sw/device/tests/penetrationtests/config:env_silicon_owner_sival_rom_ext": { |
| 122 | + "SELECTED_FIRMWARE_TARGET": "pen_test_fi_ibex_silicon_owner_sival_rom_ext", |
| 123 | + }, |
| 124 | + "//conditions:default": { |
| 125 | + "SELECTED_FIRMWARE_TARGET": "pen_test_fi_ibex_silicon_owner_gb_rom_ext", |
| 126 | + }, |
| 127 | + }), |
| 128 | + deps = [ |
| 129 | + requirement("pyyaml"), |
| 130 | + requirement("tqdm"), |
| 131 | + requirement("pycryptodome"), |
| 132 | + "//target/communication:fi_ibex_commands", |
| 133 | + "//fault_injection/project_library:project", |
| 134 | + "//util:plot", |
| 135 | + "//util:helpers", |
| 136 | + "//target:targets", |
| 137 | + "@rules_python//python/runfiles", |
| 138 | + "//fault_injection/fi_gear:fi_gear", |
| 139 | + "//test/penetrationtests/util:utils", |
| 140 | + ], |
| 141 | +) |
0 commit comments