From d91c2e7671732f272d7b6ca69e5e8c4ccbdc0200 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 6 Nov 2025 14:10:00 +0800 Subject: [PATCH] fix API to reflect that the 0-state is the most permissive state --- libs/bao1x-api/src/offsets.rs | 7 ++++--- libs/bao1x-api/src/offsets/common.rs | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libs/bao1x-api/src/offsets.rs b/libs/bao1x-api/src/offsets.rs index 0952f2274..3685693c5 100644 --- a/libs/bao1x-api/src/offsets.rs +++ b/libs/bao1x-api/src/offsets.rs @@ -213,7 +213,8 @@ pub enum RwPerms { /// Specifies what partitions can access a given slot. Some common patterns are /// provided, a Custom field is also provided for other odd combinations. pub enum PartitionAccess { - None, + /// Open disables not just PartitionAccess but also all other security controls + Open, All, Boot0, Boot1, @@ -235,7 +236,7 @@ impl PartitionAccess { // The bitfield coding is fw1:fw0:boot1:boot0 from MSB to LSB. let code: u4 = u4::new(((raw >> 20) & 0xF) as u8); match code.value() { - 0b0000 => Self::None, + 0b0000 => Self::Open, 0b1111 => Self::All, 0b0001 => Self::Boot0, 0b0010 => Self::Boot1, @@ -251,7 +252,7 @@ impl PartitionAccess { // can be shifted into place. fn to_raw_u4(&self) -> u4 { match self { - Self::None => u4::new(0b0000 & 0xF), + Self::Open => u4::new(0b0000 & 0xF), Self::All => u4::new(0b1111 & 0xF), Self::Boot0 => u4::new(0b0001 & 0xF), Self::Boot1 => u4::new(0b0010 & 0xF), diff --git a/libs/bao1x-api/src/offsets/common.rs b/libs/bao1x-api/src/offsets/common.rs index e5c82a2ac..8348d8a10 100644 --- a/libs/bao1x-api/src/offsets/common.rs +++ b/libs/bao1x-api/src/offsets/common.rs @@ -168,8 +168,9 @@ pub const SERIAL_NUMBER: SlotIndex = SlotIndex::Data(0, PartitionAccess::All, Rw /// `UUID` is a 256-bit random number that can be used as a UUID for the chip. It is publicly /// readable and generated by a TRNG. This is suitable for putting into a KDF and generating -/// salts for algorithms that require such a parameter. -pub const UUID: SlotIndex = SlotIndex::Data(1, PartitionAccess::All, RwPerms::ReadOnly); +/// salts for algorithms that require such a parameter. The UUID is changeable, but changing +/// will cause all derived keys to be changed as well. +pub const UUID: SlotIndex = SlotIndex::Data(1, PartitionAccess::Open, RwPerms::ReadWrite); /// `IFR_HASH` is a provisional slot for a hash of the IFR region. Whether the hash is meaningful /// or not depends on if the chip is booted before it is sealed. At the time of writing, it's