Skip to content

Reset the security state on SELECT - #50

Open
FlorianFranzen wants to merge 1 commit into
trussed-dev:mainfrom
FlorianFranzen:feat/select-resets-state
Open

FlorianFranzen wants to merge 1 commit into
trussed-dev:mainfrom
FlorianFranzen:feat/select-resets-state

Conversation

@FlorianFranzen

Copy link
Copy Markdown
Contributor

Selecting the PIV application now resets the security state (PIN verification and management authentication), like a YubiKey does. Both Yubico client libraries rely on this to read the retry counter: libykpiv (ykpiv_get_pin_retries) and yubikey.rs (get_pin_retries) re-select the application to drop the PIN verification and then send VERIFY without data, and would otherwise mistake a verified session for one with no retries left. A verified PIN surviving a re-select is also wrong on its own: a second host process selecting the application would inherit the first one's verification.

Tested in command_response.ron: after VERIFY and management authentication, a SELECT makes VERIFY with no data report the remaining retries again and makes PUT DATA fail with SecurityStatusNotSatisfied.

Found while provisioning the vpicc virtual card end to end with a yubikey.rs based tool.

FlorianFranzen added a commit to FlorianFranzen/piv-authenticator that referenced this pull request Oct 16, 2026
- 7b8aee4 Reset the security state on SELECT

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant