mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
add more graceful handling of erase inconsistencies
This commit is contained in:
parent
763a2c290d
commit
18a58c7d18
1 changed files with 16 additions and 8 deletions
|
|
@ -352,15 +352,23 @@ pub fn erase_secrets(csprng: &mut Option<&mut Csprng>) -> Result<(), String> {
|
|||
match rw_perms {
|
||||
RwPerms::ReadWrite | RwPerms::WriteOnly => {
|
||||
// only clear ACL if it isn't already cleared
|
||||
if slot_mgr.get_acl(slot).unwrap().raw_u32() != 0 {
|
||||
if slot_mgr
|
||||
.get_acl(slot)
|
||||
.unwrap_or(AccessSettings::Data(DataSlotAccess::new_with_raw_value(0xFFFF_FFFF)))
|
||||
.raw_u32()
|
||||
!= 0
|
||||
{
|
||||
// clear the ACL so we can operate on the data
|
||||
slot_mgr
|
||||
.set_acl(
|
||||
&mut rram,
|
||||
slot,
|
||||
&AccessSettings::Data(DataSlotAccess::new_with_raw_value(0)),
|
||||
)
|
||||
.expect("couldn't reset ACL");
|
||||
match slot_mgr.set_acl(
|
||||
&mut rram,
|
||||
slot,
|
||||
&AccessSettings::Data(DataSlotAccess::new_with_raw_value(0)),
|
||||
) {
|
||||
Ok(_) => (),
|
||||
Err(e) => {
|
||||
crate::println!("Couldn't erase ACL: {:?}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
let bytes = unsafe { slot_mgr.read_data_slot(data_index) };
|
||||
if bytes.iter().all(|&b| b == 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue