diff --git a/bao1x-boot/blobs/flag1_dummy_3e2080.bin b/bao1x-boot/blobs/flag1_dummy_3e2080.bin new file mode 100644 index 000000000..ef744c102 Binary files /dev/null and b/bao1x-boot/blobs/flag1_dummy_3e2080.bin differ diff --git a/libs/bao1x-api/src/offsets/baosec.rs b/libs/bao1x-api/src/offsets/baosec.rs index d7bd88041..1fac3cd1b 100644 --- a/libs/bao1x-api/src/offsets/baosec.rs +++ b/libs/bao1x-api/src/offsets/baosec.rs @@ -60,6 +60,11 @@ pub const CP_COOKIE: SlotIndex = SlotIndex::Data(258, PartitionAccess::Fw0, RwPe /// The swap encryption key. Used to protect swap images beyond the signing key, if we so desire. pub const SWAP_KEY: SlotIndex = SlotIndex::Data(259, PartitionAccess::Fw0, RwPerms::ReadWrite); +/// A test value placed by FT into the memory array. If you can read the original value, you've captured a +/// flag! +/// There is a second flag stored somewhere else. Can you find it? +pub const THE_FLAG_1: SlotIndex = SlotIndex::Data(260, PartitionAccess::Fw0, RwPerms::ReadWrite); + /// `NUISANCE_KEYS` are hashed together with `ROOT_SEED` to derive the core secret. /// Their primary purpose is to annoy microscopists trying to read the secret key by /// directly imaging the RRAM array. They also exist to reduce power side channels @@ -126,5 +131,5 @@ pub const DATA_SLOTS: [SlotIndex; 8] = [ /// 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. -pub const KEY_SLOTS: [SlotIndex; 6] = - [CP_COOKIE, RMA_KEY, ROOT_SEED, NUISANCE_KEYS_0, NUISANCE_KEYS_1, CHAFF_KEYS]; +pub const KEY_SLOTS: [SlotIndex; 7] = + [THE_FLAG_1, CP_COOKIE, RMA_KEY, ROOT_SEED, NUISANCE_KEYS_0, NUISANCE_KEYS_1, CHAFF_KEYS]; diff --git a/libs/bao1x-api/src/offsets/common.rs b/libs/bao1x-api/src/offsets/common.rs index ddb4d1be6..d0300f0d2 100644 --- a/libs/bao1x-api/src/offsets/common.rs +++ b/libs/bao1x-api/src/offsets/common.rs @@ -65,6 +65,41 @@ macro_rules! encode_oneway { } // =========== ONE WAY COUNTER SLOTS ============== + +/// Paranoid mode is written twice; either being non-zero invokes paranoid mode +/// In paranoid mode, the glitch detectors are set to trigger aggressively and reset the +/// system through automatic hardware means. This can lead to false positives that can +/// degrade user experience, which is why it's left as a setting. +pub const PARANOID_MODE: usize = 65; + +/// Counter that logs the possible number of attacks seen. This is used in conjunction +/// with paranoid mode to initiate a system wipe. The reason this can be non-zero is that +/// stray light or environmental factors can trigger the system, and so this threshold is +/// tunable. +pub const POSSIBLE_ATTACKS: usize = 66; + +/// Paranoid mode is written twice +pub const PARANOID_MODE_DUPE: usize = 67; + +/// Total number of public key slots in the system. Pubkey revocations are duplicated because +/// being able to override a pubkey revocation is a strong attack vector. +pub const PUBKEY_SLOTS: usize = 4; + +/// The layout of the below duplicate revocation bits *MUST* match that of the primary keys. +/// This property is relied upon by the signature checking routine. +/// Offset in the one-way counter array for loader key revocations. Provisions for up to four +/// key slots, from [68..=72]. +pub const LOADER_REVOCATION_DUPE_OFFSET: usize = 68; +/// Offset in the one-way counter array for boot1 key revocations. Provisions for up to four +/// key slots, from [72..=76]. +pub const BOOT1_REVOCATION_DUPE_OFFSET: usize = LOADER_REVOCATION_DUPE_OFFSET + PUBKEY_SLOTS; +/// Offset in the one-way counter array for boot0 key revocations. Provisions for up to four +/// key slots, from [76..=80]. +pub const BOOT0_REVOCATION_DUPE_OFFSET: usize = BOOT1_REVOCATION_DUPE_OFFSET + PUBKEY_SLOTS; + +/// Fixed offset between the main key and the duplicate key +pub const REVOCATION_DUPE_DISTANCE: usize = LOADER_REVOCATION_OFFSET - LOADER_REVOCATION_DUPE_OFFSET; + encode_oneway! { #[offset = 80] pub enum BootWaitCoding { @@ -142,8 +177,6 @@ encode_oneway! { } } -/// 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 /// key slots, from [116..=120]. pub const LOADER_REVOCATION_OFFSET: usize = 116; diff --git a/libs/bao1x-api/src/offsets/dabao.rs b/libs/bao1x-api/src/offsets/dabao.rs index 7e9477da4..6c4eb3ba4 100644 --- a/libs/bao1x-api/src/offsets/dabao.rs +++ b/libs/bao1x-api/src/offsets/dabao.rs @@ -43,6 +43,9 @@ pub const DATA_SLOTS: [SlotIndex; 8] = [ crate::offsets::DEV_PUBKEY, ]; -pub use crate::baosec::{CHAFF_KEYS, NUISANCE_KEYS, NUISANCE_KEYS_0, NUISANCE_KEYS_1, RMA_KEY, ROOT_SEED}; +pub use crate::baosec::{ + CHAFF_KEYS, NUISANCE_KEYS, NUISANCE_KEYS_0, NUISANCE_KEYS_1, RMA_KEY, ROOT_SEED, THE_FLAG_1, +}; -pub const KEY_SLOTS: [SlotIndex; 5] = [ROOT_SEED, RMA_KEY, NUISANCE_KEYS_0, NUISANCE_KEYS_1, CHAFF_KEYS]; +pub const KEY_SLOTS: [SlotIndex; 6] = + [THE_FLAG_1, ROOT_SEED, RMA_KEY, NUISANCE_KEYS_0, NUISANCE_KEYS_1, CHAFF_KEYS];