From 2a45590643fc12966552e02b11c1707f69ade83a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Fri, 26 May 2023 14:41:36 +0200 Subject: [PATCH] Fix reset - Delete pins - Verify that the user pin is locked - Reset loaded state Fix #26 --- src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 4fbb09d..f22a0dc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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) => {