Unplugging USB Smartcard/Yubikey causes problems with scdaemon

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


Hello,

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:
https://bugs.gnupg.org/gnupg/issue2167

I've also created a patch which maps the 2 errors I've encountered
SCARD_E_NO_SERVICE and SCARD_E_SERVICE_STOPPED to the internal
SW_HOST_NO_READER error. This should result in removing the no longer
existing Smarcard Reader from the current list of active devices.
https://bugs.gnupg.org/gnupg/file732/0001-scd-Fix-removal-of-unplugged-usb-readers.patch

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
again.

--
Best Regards
Daniel Hoffend



More information about the Gnupg-devel mailing list