Skip to content

Commit

Permalink
[manuf] Bind perso firmware with INITIAL MANUF_STATE
Browse files Browse the repository at this point in the history
This binds the personalization firmware with the `PERSO_INITIAL`
manufacturing state. This ensures the personalization firmware's
signature is invalidated once the device is fully personalized and
prevents the personalization firmware from being executed again.

A new manifest, `manifest_perso` is created with the `PERSO_INITIAL`
creator manufacturing state to facilitate this binding.

Signed-off-by: Anthony Chen <[email protected]>
(cherry picked from commit 70d0cff)
  • Loading branch information
anthonychen1251 authored and timothytrippel committed Oct 29, 2024
1 parent c9e6dba commit 321c23b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions rules/const.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ CONST = struct(
ESC_PHASE_3 = 0x76,
),
MANUF_STATE = struct(
PERSO_INITIAL = 0x00000000,
SIVAL = 0x30305653, # ASCII `SV00`.
PRODC = 0x30304350, # ASCII `PC00`.
),
Expand Down
17 changes: 17 additions & 0 deletions sw/device/silicon_creator/manuf/base/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# SPDX-License-Identifier: Apache-2.0

load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("//rules:const.bzl", "CONST", "hex")
load("//rules:manifest.bzl", "manifest")
load(
"//rules/opentitan:defs.bzl",
"fpga_params",
Expand All @@ -19,6 +21,10 @@ load(
"FT_PROVISIONING_INPUTS",
"LOCAL_CERT_ENDORSEMENT_PARAMS",
)
load(
"//sw/device/silicon_creator/rom_ext:defs.bzl",
"ROM_EXT_VERSION",
)

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -323,6 +329,16 @@ _FT_PERSO_EXTS = [
},
]

manifest(d = {
"name": "manifest_perso",
"identifier": hex(CONST.ROM_EXT),
"manuf_state_creator": hex(CONST.MANUF_STATE.PERSO_INITIAL),
"visibility": ["//visibility:private"],
"version_major": ROM_EXT_VERSION.MAJOR,
"version_minor": ROM_EXT_VERSION.MINOR,
"security_version": ROM_EXT_VERSION.SECURITY,
})

[
opentitan_binary(
name = "ft_personalize{}".format(ext["suffix"] + dice["suffix"]),
Expand All @@ -335,6 +351,7 @@ _FT_PERSO_EXTS = [
"//hw/top_earlgrey:silicon_creator": None,
},
linker_script = "//sw/device/lib/testing/test_framework:ottf_ld_silicon_creator_slot_a",
manifest = ":manifest_perso",
spx_key = {"//sw/device/silicon_creator/rom/keys/fake/spx:prod_key_0_spx": "prod_key_0"},
deps = [":ft_personalize_base{}".format(dice["suffix"])] + ext["ext_libs"],
)
Expand Down

0 comments on commit 321c23b

Please sign in to comment.