remove panic/resets on errors during secret erase

at the moment this runs a risk of boot-loops depending on the
configuration of the device.
This commit is contained in:
bunnie 2025-11-14 19:14:35 +08:00
parent 5e805196e6
commit ff5cfa7b12

View file

@ -257,10 +257,12 @@ pub fn erase_secrets() {
let check = unsafe { slot_mgr.read_data_slot(data_index) }; let check = unsafe { slot_mgr.read_data_slot(data_index) };
if !check.iter().all(|&b| b == ERASE_VALUE) { if !check.iter().all(|&b| b == ERASE_VALUE) {
crate::println!("Failed to erase key at {}: {:x?}", data_index, check); crate::println!("Failed to erase key at {}: {:x?}", data_index, check);
/* // commented out - can lead to boot loops
// reboot on failure to erase // reboot on failure to erase
let mut rcurst = let mut rcurst =
utralib::CSR::new(utralib::utra::sysctrl::HW_SYSCTRL_BASE as *mut u32); utralib::CSR::new(utralib::utra::sysctrl::HW_SYSCTRL_BASE as *mut u32);
rcurst.wo(utralib::utra::sysctrl::SFR_RCURST0, 0x55AA); rcurst.wo(utralib::utra::sysctrl::SFR_RCURST0, 0x55AA);
*/
} else { } else {
crate::println!("Key range at {} confirmed erased", slot.get_base()); crate::println!("Key range at {} confirmed erased", slot.get_base());
} }
@ -268,9 +270,7 @@ pub fn erase_secrets() {
_ => {} _ => {}
} }
if zero_key_count > ZERO_ERR_THRESH { if zero_key_count > ZERO_ERR_THRESH {
panic!( crate::println!("Saw too many zero-keys. Insufficient privilege to erase keys!");
"Saw too many zero-keys. Insufficient privilege to erase keys, panicing instead of allowing a boot!"
);
} }
} }
} }