Fix reset

- Delete pins
- Verify that the user pin is locked
- Reset loaded state

Fix #26
This commit is contained in:
Sosthène Guédon
2023-05-26 14:41:36 +02:00
parent 01e7128239
commit 2a45590643
+5
View File
@@ -200,12 +200,17 @@ where
YubicoPivExtension::Reset => {
let this = self.load()?;
if this.state.persistent.remaining_pin_retries(this.trussed) == 0 {
return Err(Status::ConditionsOfUseNotSatisfied);
}
// TODO: find out what all needs resetting :)
for location in [Location::Volatile, Location::External, Location::Internal] {
try_syscall!(this.trussed.delete_all(location)).ok();
try_syscall!(this.trussed.remove_dir_all(location, PathBuf::new())).ok();
}
try_syscall!(this.trussed.delete_all_pins()).ok();
self.state.persistent = None;
}
YubicoPivExtension::SetManagementKey(touch_policy) => {