mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
update boot1 to use slotmanager API
also add the hook for setting up/checking all the other slots
This commit is contained in:
parent
356ab47c3c
commit
1d5cc0806b
4 changed files with 16 additions and 3 deletions
|
|
@ -3,6 +3,7 @@ pub use bao1x::*;
|
|||
pub mod debug;
|
||||
pub mod gfx;
|
||||
pub mod irq;
|
||||
pub mod slots;
|
||||
pub mod usb;
|
||||
|
||||
pub const UART_BAUD: u32 = 1_000_000;
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ pub fn setup_dabao_se0_pin<T: IoSetup + IoGpio>(iox: &T) -> (IoxPort, u8) {
|
|||
/// This can change the board type coding to a safer, simpler board type if the declared board type has
|
||||
/// problems booting.
|
||||
pub fn early_init(mut board_type: bao1x_api::BoardTypeCoding) -> (bao1x_api::BoardTypeCoding, u32) {
|
||||
crate::platform::slots::check_slots(&board_type);
|
||||
|
||||
let iox = Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
|
||||
|
||||
// setup board-specific I/Os - early boot set. These are items that have to be
|
||||
|
|
|
|||
9
bao1x-boot/boot1/src/platform/bao1x/slots.rs
Normal file
9
bao1x-boot/boot1/src/platform/bao1x/slots.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/// This function is designed to be called "frequently" to audit the state
|
||||
/// of the security slots. Its role is to:
|
||||
/// - Initialize any keys that have not yet been initialized
|
||||
/// - Update the one-way counters to lock out re-initializations
|
||||
/// - Verify that the ACLs have been set according to the spec
|
||||
/// - Repair any ACLs that are not set correctly. "Repair" is expected on first boot at the factory, since
|
||||
/// the chip comes blank. But repair is also useful in case an adversary manages to flip any ACL states
|
||||
/// on us.
|
||||
pub fn check_slots(board_type: &bao1x_api::BoardTypeCoding) {}
|
||||
|
|
@ -201,6 +201,8 @@ impl Repl {
|
|||
count += 1;
|
||||
}
|
||||
crate::println!("Board type set to {:?} after {} increments", new_type, count);
|
||||
crate::platform::slots::check_slots(&new_type);
|
||||
crate::println!("Key & data slots checked according to the new type");
|
||||
}
|
||||
"audit" => {
|
||||
let owc = OneWayCounter::new();
|
||||
|
|
@ -214,9 +216,8 @@ impl Repl {
|
|||
);
|
||||
crate::println!("Semver is: {}", crate::version::SEMVER);
|
||||
crate::println!("Description is: {}", crate::RELEASE_DESCRIPTION);
|
||||
let slot_mgr = bao1x_hal::protected_rram::SlotManager::new();
|
||||
// TODO: replace with a proper `const` value once we have the slots defined properly
|
||||
let sn = slot_mgr.read(&bao1x_hal::protected_rram::SlotIndex::Data(0)).unwrap();
|
||||
let slot_mgr = bao1x_hal::acram::SlotManager::new();
|
||||
let sn = slot_mgr.read(&bao1x_hal::board::SERIAL_NUMBER).unwrap();
|
||||
crate::println!(
|
||||
"Device serializer: {:08x}-{:08x}-{:08x}-{:08x}",
|
||||
u32::from_le_bytes(sn[12..16].try_into().unwrap()),
|
||||
|
|
|
|||
Loading…
Reference in a new issue