Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrent access results in PCSC Error #425

Closed
wrl opened this issue Nov 9, 2022 · 1 comment
Closed

Concurrent access results in PCSC Error #425

wrl opened this issue Nov 9, 2022 · 1 comment

Comments

@wrl
Copy link
Contributor

wrl commented Nov 9, 2022

This is a bug occurring in https://github.com/indygreg/apple-platform-rs, a downstream which (optionally) uses the yubikey-rs crate. It's unclear to me whether this is an apple-codesign (downstream) bug, one in yubikey-rs, or even one in pcsc-rust.

I've copied and pasted the text from from indygreg/apple-platform-rs#49 below:

I am using rcodesign in a on-premises CI server, with the smartcard functionality backed by a Yubikey 5 token.

When two (or more) jobs attempt to sign executables simultaneously, at least one (sometimes all) of them will begin exiting unsuccessfully with the pcsc-rust error Error::ResetCard, which has the description "The smart card has been reset, so any shared state information is invalid".

It's unclear to me where this error is being raised (i.e. when first connecting to the token, or when the signing operation is attempted), but it seems like pcsc-rust resets the Card when dropped (https://github.com/bluetech/pcsc-rust/blob/master/pcsc/src/lib.rs#L1670-L1684) and yubikey-rs doesn't change this or attempt to reconnect to the card on reset, though it does specify that the card should reset on reconnect (https://github.com/iqlusioninc/yubikey.rs/blob/main/src/yubikey.rs#L220-L224) and it seems like the card should perhaps reconnect if there's an error when starting a transaction (https://github.com/iqlusioninc/yubikey.rs/blob/main/src/yubikey.rs#L241-L245).

I am unfamiliar with PCSC and smartcards as a whole, so I'm not sure what the best practices for all of this are.

@tarcieri
Copy link
Collaborator

tarcieri commented Nov 9, 2022

Dup of #424

@tarcieri tarcieri closed this as completed Nov 9, 2022
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

No branches or pull requests

2 participants