Skip to content

Commit

Permalink
[bazel] Convert sigverify_key_validity to the new rules.
Browse files Browse the repository at this point in the history
Fixes: #20098

Signed-off-by: Chris Frantz <[email protected]>
  • Loading branch information
cfrantz committed Nov 27, 2023
1 parent 4fe628c commit f379fc8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
4 changes: 3 additions & 1 deletion sw/device/silicon_creator/rom/e2e/empty_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

#include <stdbool.h>

#include "sw/device/lib/runtime/log.h"
#include "sw/device/lib/testing/test_framework/ottf_main.h"
#ifdef EMPTY_TEST_MSG
#include "sw/device/lib/runtime/log.h"
#include "sw/device/silicon_creator/lib/drivers/lifecycle.h"
#include "sw/device/silicon_creator/lib/drivers/otp.h"
#include "sw/device/silicon_creator/lib/manifest_def.h"
#include "sw/device/silicon_creator/lib/sigverify/spx_verify.h"

#include "otp_ctrl_regs.h"
#endif

OTTF_DEFINE_TEST_CONFIG();

Expand Down
36 changes: 11 additions & 25 deletions sw/device/silicon_creator/rom/e2e/sigverify_key_validity/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# SPDX-License-Identifier: Apache-2.0

load(
"//rules:opentitan_test.bzl",
"//rules/opentitan:defs.bzl",
"cw310_params",
"opentitan_functest",
"opentitan_test",
)
load(
"//rules:const.bzl",
Expand Down Expand Up @@ -75,30 +75,13 @@ otp_json(
]

[
bitstream_splice(
name = "bitstream_sigverify_key_validity_{}".format(
lc_state,
),
src = "//hw/bitstream:rom_with_fake_keys",
data = ":otp_img_sigverify_key_validity_{}".format(
lc_state,
),
meminfo = "//hw/bitstream:otp_mmi",
tags = maybe_skip_in_ci(lc_state_val),
update_usr_access = True,
visibility = ["//visibility:private"],
)
for lc_state, lc_state_val in get_lc_items()
]

[
opentitan_functest(
opentitan_test(
name = "sigverify_key_validity_{}_{}".format(
lc_state,
key.rsa.name,
),
srcs = ["//sw/device/silicon_creator/rom/e2e:empty_test"],
cw310 = cw310_params(
bitstream = ":bitstream_sigverify_key_validity_{}".format(lc_state),
exit_failure = MSG_PASS if lc_state_val != CONST.LCV.TEST_UNLOCKED0 else MSG_TEMPLATE_BFV_LCV.format(
hex_digits(CONST.BFV.SIGVERIFY.BAD_RSA_KEY),
hex_digits(lc_state_val),
Expand All @@ -107,12 +90,15 @@ otp_json(
hex_digits(CONST.BFV.SIGVERIFY.BAD_RSA_KEY),
hex_digits(lc_state_val),
) if lc_state_val != CONST.LCV.TEST_UNLOCKED0 else MSG_PASS,
otp = ":otp_img_sigverify_key_validity_{}".format(lc_state),
tags = maybe_skip_in_ci(lc_state_val),
),
key_struct = key,
ot_flash_binary = "//sw/device/silicon_creator/rom/e2e:empty_test_slot_a",
targets = [
"cw310_rom_with_fake_keys",
exec_env = {
"//hw/top_earlgrey:fpga_cw310_rom_with_fake_keys": None,
},
rsa_key = {key.rsa.label: key.rsa.name},
deps = [
"//sw/device/lib/testing/test_framework:ottf_main",
],
)
for lc_state, lc_state_val in get_lc_items()
Expand Down

0 comments on commit f379fc8

Please sign in to comment.