diff --git a/bao1x-boot/blobs/ac-block-0x3dc000.bin b/bao1x-boot/blobs/ac-block-0x3dc000.bin index 73552f631..2679947d1 100644 Binary files a/bao1x-boot/blobs/ac-block-0x3dc000.bin and b/bao1x-boot/blobs/ac-block-0x3dc000.bin differ diff --git a/bao1x-boot/boot1/src/platform/bao1x/slots.rs b/bao1x-boot/boot1/src/platform/bao1x/slots.rs index 995fcbf87..9f313bf9f 100644 --- a/bao1x-boot/boot1/src/platform/bao1x/slots.rs +++ b/bao1x-boot/boot1/src/platform/bao1x/slots.rs @@ -43,19 +43,22 @@ pub fn check_slots(board_type: &bao1x_api::BoardTypeCoding) { if slot_mgr.read(&CP_ID).unwrap().iter().all(|&b| b == 0 || b == 0xFF) { let cp_id = unsafe { core::slice::from_raw_parts(IFR_CP_ID_BASE as *const u8, SLOT_ELEMENT_LEN_BYTES) }; - slot_mgr.write(&mut rram, &CP_ID, cp_id.try_into().unwrap()).unwrap(); + // don't fail on write failure - otherwise we get stuck here and can't debug the chip + slot_mgr.write(&mut rram, &CP_ID, cp_id.try_into().unwrap()).ok(); } // this one may allocate a TRNG, which takes >50 ms to warm up. if slot_mgr.read(&SERIAL_NUMBER).unwrap().iter().all(|&b| b == 0 || b == 0xFF) { let trng = maybe_trng.get_or_insert_with(|| super::trng::ManagedTrng::new(&board_type)); let k = trng.generate_key(); - slot_mgr.write(&mut rram, &SERIAL_NUMBER, &k).unwrap(); + // don't fail on write failure - otherwise we get stuck here and can't debug the chip + slot_mgr.write(&mut rram, &SERIAL_NUMBER, &k).ok(); } if slot_mgr.read(&UUID).unwrap().iter().all(|&b| b == 0 || b == 0xFF) { let trng = maybe_trng.get_or_insert_with(|| super::trng::ManagedTrng::new(&board_type)); let k = trng.generate_key(); - slot_mgr.write(&mut rram, &UUID, &k).unwrap(); + // don't fail on write failure - otherwise we get stuck here and can't debug the chip + slot_mgr.write(&mut rram, &UUID, &k).ok(); } if slot_mgr.read(&IFR_HASH).unwrap().iter().all(|&b| b == 0 || b == 0xFF) { use digest::Digest; @@ -65,7 +68,8 @@ pub fn check_slots(board_type: &bao1x_api::BoardTypeCoding) { unsafe { core::slice::from_raw_parts(bao1x_api::IFR_BASE as *const u8, bao1x_api::IFR_LEN) }; hasher.update(&ifr_slice); let digest = hasher.finalize(); - slot_mgr.write(&mut rram, &IFR_HASH, digest.as_slice().try_into().unwrap()).unwrap(); + // don't fail on write failure - otherwise we get stuck here and can't debug the chip + slot_mgr.write(&mut rram, &IFR_HASH, digest.as_slice().try_into().unwrap()).ok(); } // once all values are written, advance the CP_BOOT_SETUP_DONE state // safety: the offset is correct because we're pulling it from our pre-defined constants and diff --git a/libs/bao1x-api/src/offsets/common.rs b/libs/bao1x-api/src/offsets/common.rs index 364941872..96e3571dc 100644 --- a/libs/bao1x-api/src/offsets/common.rs +++ b/libs/bao1x-api/src/offsets/common.rs @@ -191,7 +191,7 @@ pub const BOOT0_REVOCATION_OFFSET: usize = BOOT1_REVOCATION_OFFSET + PUBKEY_SLOT /// nor does it have any guarantee of being a monotonic or smoothly spaced out. It could /// even be all zeros (in which case LOT_CODE should be used). However, nominally, the plan /// is for SERIAL_NUMBER to be exactly the CP_ID field. -pub const SERIAL_NUMBER: SlotIndex = SlotIndex::Data(0, PartitionAccess::All, RwPerms::ReadOnly); +pub const SERIAL_NUMBER: SlotIndex = SlotIndex::Data(0, PartitionAccess::Open, RwPerms::ReadWrite); /// `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