Unplugging USB Smartcard/Yubikey causes problems with scdaemon

Daniel Hoffend dh at dotlan.net
Wed Dec 9 16:56:32 CET 2015


In the last days I've tracked down an issue under windows where
unplugging the yubikey (usb smartcard reader with integrated smartcard)
resulted in an usable scdaemon. Once plugged out the yubikey will no
longer work until I killed the scdaemon from the task manager.

The main issue is that unplugging pcsc/scdaemon throws an error which
is mapped to general error leaving the smartcard loaded in an unusable
state. It still shows the smartcard loaded which is unsuable.

I've documented the issue including scdaemon debug logs with comments
in the bug tracker:

I've also created a patch which maps the 2 errors I've encountered
SW_HOST_NO_READER error. This should result in removing the no longer
existing Smarcard Reader from the current list of active devices.

Since I'm not able to compile the windows version of gpg myself I can't
verify this finally. I also can't say for sure that the 2 errors aren't
used in any other scenario but right now it sounds logical to me.

I'm able to reproduce this error using the stable gnupg 2.0.29 version
(from gpg4win 2.3) and the gnupg 2.1.9 (solo installation). The patch
should fix the issue for 2.0 and 2.1 hopefully.

If there's anything else I can help you with I'm happy to help testing

Best Regards
Daniel Hoffend

More information about the Gnupg-devel mailing list