|
2 | 2 | # Licensed under the Apache License, Version 2.0, see LICENSE for details.
|
3 | 3 | # SPDX-License-Identifier: Apache-2.0
|
4 | 4 |
|
| 5 | +load("//rules:const.bzl", "CONST", "hex") |
| 6 | +load("//rules:manifest.bzl", "manifest") |
| 7 | +load("//rules/opentitan:cc.bzl", "opentitan_binary_assemble") |
5 | 8 | load(
|
6 | 9 | "//rules/opentitan:defs.bzl",
|
7 | 10 | "fpga_params",
|
| 11 | + "opentitan_binary", |
8 | 12 | "opentitan_test",
|
9 | 13 | )
|
| 14 | +load( |
| 15 | + "//sw/device/silicon_creator/rom/e2e:defs.bzl", |
| 16 | + "SLOTS", |
| 17 | +) |
10 | 18 | load(
|
11 | 19 | "//sw/device/silicon_creator/rom_ext:defs.bzl",
|
12 | 20 | "ROM_EXT_VARIATIONS",
|
13 | 21 | )
|
| 22 | +load( |
| 23 | + "//sw/device/silicon_creator/rom_ext/e2e:defs.bzl", |
| 24 | + "OWNER_SLOTS", |
| 25 | +) |
14 | 26 |
|
15 | 27 | package(default_visibility = ["//visibility:public"])
|
16 | 28 |
|
@@ -38,3 +50,91 @@ package(default_visibility = ["//visibility:public"])
|
38 | 50 | )
|
39 | 51 | for variation in ROM_EXT_VARIATIONS.keys()
|
40 | 52 | ]
|
| 53 | + |
| 54 | +manifest({ |
| 55 | + "name": "owner_manifest", |
| 56 | + "identifier": hex(CONST.OWNER), |
| 57 | + "visibility": ["//visibility:private"], |
| 58 | +}) |
| 59 | + |
| 60 | +opentitan_binary( |
| 61 | + name = "print_certs_for_assemble", |
| 62 | + testonly = True, |
| 63 | + srcs = ["//sw/device/silicon_creator/rom_ext/e2e/attestation:print_certs.c"], |
| 64 | + exec_env = { |
| 65 | + "//hw/top_earlgrey:fpga_hyper310_rom_ext": None, |
| 66 | + "//hw/top_earlgrey:fpga_cw340_rom_ext": None, |
| 67 | + }, |
| 68 | + linker_script = "//sw/device/lib/testing/test_framework:ottf_ld_silicon_owner_slot_a", |
| 69 | + manifest = ":owner_manifest", |
| 70 | + deps = [ |
| 71 | + "//sw/device/lib/base:status", |
| 72 | + "//sw/device/lib/runtime:log", |
| 73 | + "//sw/device/lib/runtime:print", |
| 74 | + "//sw/device/lib/testing/test_framework:ottf_main", |
| 75 | + "//sw/device/silicon_creator/lib/drivers:flash_ctrl", |
| 76 | + "//sw/device/silicon_creator/manuf/base:perso_tlv_data", |
| 77 | + ], |
| 78 | +) |
| 79 | + |
| 80 | +[ |
| 81 | + opentitan_binary_assemble( |
| 82 | + name = "{}_rom_ext_owner_bundle".format(variation), |
| 83 | + testonly = True, |
| 84 | + bins = { |
| 85 | + "//sw/device/silicon_creator/rom_ext:rom_ext_{}_slot_a".format(variation): SLOTS["a"], |
| 86 | + ":print_certs_for_assemble": OWNER_SLOTS["a"], |
| 87 | + }, |
| 88 | + exec_env = [ |
| 89 | + "//hw/top_earlgrey:fpga_hyper310_rom_with_fake_keys", |
| 90 | + "//hw/top_earlgrey:fpga_cw340_rom_with_fake_keys", |
| 91 | + ], |
| 92 | + ) |
| 93 | + for variation in ROM_EXT_VARIATIONS.keys() |
| 94 | +] |
| 95 | + |
| 96 | +_VARIATION_INTEROP_TEST_CASES = [ |
| 97 | + { |
| 98 | + "first": "x509", |
| 99 | + "second": "cwt", |
| 100 | + }, |
| 101 | + { |
| 102 | + "first": "cwt", |
| 103 | + "second": "x509", |
| 104 | + }, |
| 105 | +] |
| 106 | + |
| 107 | +[ |
| 108 | + opentitan_test( |
| 109 | + name = "variation_interop_{}_first_test".format(tc["first"]), |
| 110 | + exec_env = { |
| 111 | + "//hw/top_earlgrey:fpga_hyper310_rom_with_fake_keys": None, |
| 112 | + "//hw/top_earlgrey:fpga_cw340_rom_with_fake_keys": None, |
| 113 | + }, |
| 114 | + fpga = fpga_params( |
| 115 | + binaries = { |
| 116 | + ":dice_{}_rom_ext_owner_bundle".format(tc["second"]): "second", |
| 117 | + ":dice_{}_rom_ext_owner_bundle".format(tc["first"]): "firmware", |
| 118 | + }, |
| 119 | + otp = "//sw/device/silicon_creator/rom_ext/e2e:otp_img_secret2_locked_rma", |
| 120 | + test_cmd = """ |
| 121 | + --clear-bitstream |
| 122 | + --bootstrap={firmware} |
| 123 | + --second-bootstrap={second} |
| 124 | + """, |
| 125 | + test_harness = "//sw/host/tests/rom_ext/e2e_variation_interop", |
| 126 | + ), |
| 127 | + ) |
| 128 | + for tc in _VARIATION_INTEROP_TEST_CASES |
| 129 | +] |
| 130 | + |
| 131 | +test_suite( |
| 132 | + name = "variation_interop_tests", |
| 133 | + tags = ["manual"], |
| 134 | + tests = [ |
| 135 | + "variation_interop_{}_first_test".format( |
| 136 | + tc["first"], |
| 137 | + ) |
| 138 | + for tc in _VARIATION_INTEROP_TEST_CASES |
| 139 | + ], |
| 140 | +) |
0 commit comments