add pubkey block to the data sets, fix nuisance key range

just learned of another ECO incoming that will tie the key
and data areas together in terms of access control from
the IFR region, so the nuisance key range has to have
its access control redefined to steer clear of the data
slots allocated that have write-protects on them.

pubkey block is added to the data ranges

also a oneway counter to keep track of pubkey validation
failures in boot0 is added
This commit is contained in:
bunnie 2025-10-28 03:33:15 +08:00
parent 1549a87772
commit 290a662bc3
No known key found for this signature in database
3 changed files with 31 additions and 5 deletions

View file

@ -80,7 +80,13 @@ pub const CP_COOKIE: SlotIndex = SlotIndex::Key(258, PartitionAccess::Fw0, RwPer
/// Thus 2x 4k pages on either end of the key range are carved out for the nuisance keys. 4k page size
/// is convenient because that's the natural page size over which the key range will be carved up before
/// handing to other processes.
pub const NUISANCE_KEYS_0: SlotIndex = SlotIndex::KeyRange(0..128, PartitionAccess::Fw0, RwPerms::ReadOnly);
///
/// The first 8 keys in bank 0 of NUISANCE_KEYS is not used. This is because due to an ECO in the A1
/// spin of silicon, the JTAG-wired access control on these is going to be tied to those on the similarly
/// numbered data slots. Some of the data slots in the first 8 slots will be read-only at CP time, and
/// thus they can't be initialized with random data and be used as a nuisance key. This is a minor degradation
/// in security margin.
pub const NUISANCE_KEYS_0: SlotIndex = SlotIndex::KeyRange(8..128, PartitionAccess::Fw0, RwPerms::ReadOnly);
pub const NUISANCE_KEYS_1: SlotIndex =
SlotIndex::KeyRange(1920..2048, PartitionAccess::Fw0, RwPerms::ReadOnly);
pub const NUISANCE_KEYS: [SlotIndex; 2] = [NUISANCE_KEYS_0, NUISANCE_KEYS_1];
@ -108,8 +114,16 @@ pub const CHAFF_KEYS: SlotIndex = SlotIndex::KeyRange(128..256, PartitionAccess:
/// All the slots of concern located in a single iterator. The idea is that everything is
/// condensed here and used to check for access integrity using the array below.
pub const DATA_SLOTS: [SlotIndex; 4] =
[crate::offsets::SERIAL_NUMBER, crate::offsets::UUID, crate::offsets::IFR_HASH, crate::offsets::CP_ID];
pub const DATA_SLOTS: [SlotIndex; 8] = [
crate::offsets::SERIAL_NUMBER,
crate::offsets::UUID,
crate::offsets::IFR_HASH,
crate::offsets::CP_ID,
crate::offsets::BAO1_PUBKEY,
crate::offsets::BAO2_PUBKEY,
crate::offsets::BETA_PUBKEY,
crate::offsets::DEV_PUBKEY,
];
/// In addition to these KEY_SLOTS, the DEVELOPER_MODE one way counter is a security-important parameter
/// that should be included as domain separation in any KDF.

View file

@ -113,6 +113,10 @@ pub const DEVELOPER_MODE: usize = 85;
/// did bless the bag of bits.
pub const OEM_MODE: usize = 86;
/// This is incremented if the boot0 public keys failed to compare against the static keys in
/// the data store.
pub const BOOT0_PUBKEY_FAIL: usize = 87;
/// Total number of public key slots in the system. Pubkey revocations are at the "top of range"
pub const PUBKEY_SLOTS: usize = 4;
/// Offset in the one-way counter array for loader key revocations. Provisions for up to four

View file

@ -32,6 +32,14 @@ pub const DEFAULT_FCLK_FREQUENCY: u32 = 700_000_000;
/// All the slots of concern located in a single iterator. The idea is that everything is
/// condensed here and used to check for access integrity using the array below.
pub const DATA_SLOTS: [SlotIndex; 4] =
[crate::offsets::SERIAL_NUMBER, crate::offsets::UUID, crate::offsets::IFR_HASH, crate::offsets::CP_ID];
pub const DATA_SLOTS: [SlotIndex; 8] = [
crate::offsets::SERIAL_NUMBER,
crate::offsets::UUID,
crate::offsets::IFR_HASH,
crate::offsets::CP_ID,
crate::offsets::BAO1_PUBKEY,
crate::offsets::BAO2_PUBKEY,
crate::offsets::BETA_PUBKEY,
crate::offsets::DEV_PUBKEY,
];
pub const KEY_SLOTS: [SlotIndex; 0] = [];