mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +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 {
|
match rw_perms {
|
||||||
RwPerms::ReadWrite | RwPerms::WriteOnly => {
|
RwPerms::ReadWrite | RwPerms::WriteOnly => {
|
||||||
// only clear ACL if it isn't already cleared
|
// 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
|
// clear the ACL so we can operate on the data
|
||||||
slot_mgr
|
match slot_mgr.set_acl(
|
||||||
.set_acl(
|
&mut rram,
|
||||||
&mut rram,
|
slot,
|
||||||
slot,
|
&AccessSettings::Data(DataSlotAccess::new_with_raw_value(0)),
|
||||||
&AccessSettings::Data(DataSlotAccess::new_with_raw_value(0)),
|
) {
|
||||||
)
|
Ok(_) => (),
|
||||||
.expect("couldn't reset ACL");
|
Err(e) => {
|
||||||
|
crate::println!("Couldn't erase ACL: {:?}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let bytes = unsafe { slot_mgr.read_data_slot(data_index) };
|
let bytes = unsafe { slot_mgr.read_data_slot(data_index) };
|
||||||
if bytes.iter().all(|&b| b == 0) {
|
if bytes.iter().all(|&b| b == 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue