Page MenuHome GnuPG

scdaemon.conf reader-port setting broken in 2.3
Closed, ResolvedPublic

Description

OS: Windows 10

Since updating to gnupg 2.3 the reader-port setting in scdaemon.conf seems to be broken. Initially I just noticed that gnupg stopped working with my YubiKey after the update, giving the error:

pcsc_connect failed: removed card (0x80100069)

After some investigation I realized it was actually working, but selecting my built-in NFC reader instead (confirmed by placing a YubiKey on the reader, which works, as expected).

Previously (2.2) I used a substring of the reader name, but since updating to 2.3 (tested both 2.3.0 and 2.3.1) this value seems to be ignored. I've tried many variations of strings (full name, in quotes, single/multiple words, etc.), but nothing seems to make a difference and the first reader is always used. What I did find works, is to use an integer to index by position.

Log from using "reader-port Yubico" (which is ignored):

2021-05-01 15:56:21 scdaemon[6932] listening on socket 'C:\\Users\\dain\\AppData\\Roaming\\gnupg\\S.scdaemon'
2021-05-01 15:56:21 scdaemon[6932] handler for fd -1 started
2021-05-01 15:56:21 scdaemon[6932] DBG: chan_0x000000fc -> OK GNU Privacy Guard's Smartcard server ready
2021-05-01 15:56:21 scdaemon[6932] DBG: chan_0x000000fc <- GETINFO socket_name
2021-05-01 15:56:21 scdaemon[6932] DBG: chan_0x000000fc -> D C:\Users\dain\AppData\Roaming\gnupg\S.scdaemon
2021-05-01 15:56:21 scdaemon[6932] DBG: chan_0x000000fc -> OK
2021-05-01 15:56:21 scdaemon[6932] DBG: chan_0x000000fc <- OPTION event-signal=28c
2021-05-01 15:56:21 scdaemon[6932] DBG: chan_0x000000fc -> OK
2021-05-01 15:56:21 scdaemon[6932] DBG: chan_0x000000fc <- GETINFO version
2021-05-01 15:56:21 scdaemon[6932] DBG: chan_0x000000fc -> D 2.3.1
2021-05-01 15:56:21 scdaemon[6932] DBG: chan_0x000000fc -> OK
2021-05-01 15:56:21 scdaemon[6932] DBG: chan_0x000000fc <- SERIALNO
2021-05-01 15:56:21 scdaemon[6932] detected reader 'Microsoft IFD 0'
2021-05-01 15:56:21 scdaemon[6932] detected reader 'NXP NXP's Proximity based PCSC Reader 0'
2021-05-01 15:56:21 scdaemon[6932] detected reader 'Yubico Yubikey 4 U2F+CCID 0'
2021-05-01 15:56:21 scdaemon[6932] DBG: apdu_open_reader: Microsoft IFD 0
2021-05-01 15:56:21 scdaemon[6932] DBG: apdu_open_reader: new device=Microsoft IFD 0
2021-05-01 15:56:21 scdaemon[6932] reader slot 0: not connected
2021-05-01 15:56:21 scdaemon[6932] DBG: enter: apdu_connect: slot=0
2021-05-01 15:56:21 scdaemon[6932] pcsc_connect failed: removed card (0x80100069)
2021-05-01 15:56:21 scdaemon[6932] reader slot 0: not connected

Log from using "reader-port 2" (which works correctly):

2021-05-01 16:08:47 scdaemon[12620] handler for fd -1 started
2021-05-01 16:08:47 scdaemon[12620] DBG: chan_0x000002d8 -> OK GNU Privacy Guard's Smartcard server ready
2021-05-01 16:08:47 scdaemon[12620] DBG: chan_0x000002d8 <- GETINFO socket_name
2021-05-01 16:08:47 scdaemon[12620] DBG: chan_0x000002d8 -> D C:\Users\dain\AppData\Roaming\gnupg\S.scdaemon
2021-05-01 16:08:47 scdaemon[12620] DBG: chan_0x000002d8 -> OK
2021-05-01 16:08:47 scdaemon[12620] DBG: chan_0x000002d8 <- OPTION event-signal=298
2021-05-01 16:08:47 scdaemon[12620] DBG: chan_0x000002d8 -> OK
2021-05-01 16:08:47 scdaemon[12620] DBG: chan_0x000002d8 <- GETINFO version
2021-05-01 16:08:47 scdaemon[12620] DBG: chan_0x000002d8 -> D 2.3.1
2021-05-01 16:08:47 scdaemon[12620] DBG: chan_0x000002d8 -> OK
2021-05-01 16:08:47 scdaemon[12620] DBG: chan_0x000002d8 <- SERIALNO
2021-05-01 16:08:47 scdaemon[12620] detected reader 'Microsoft IFD 0'
2021-05-01 16:08:47 scdaemon[12620] detected reader 'NXP NXP's Proximity based PCSC Reader 0'
2021-05-01 16:08:47 scdaemon[12620] detected reader 'Yubico Yubikey 4 U2F+CCID 0'
2021-05-01 16:08:47 scdaemon[12620] reader slot 0: not connected
2021-05-01 16:08:47 scdaemon[12620] DBG: enter: apdu_connect: slot=0
2021-05-01 16:08:47 scdaemon[12620] reader slot 0: active protocol: T1
2021-05-01 16:08:47 scdaemon[12620] slot 0: ATR=3bf81300008131fe15597562696b657934d4

Details

Version
2.3.1

Event Timeline

gniibe triaged this task as Normal priority.
gniibe added a subscriber: gniibe.

Thank you for your report.

I found this problem yesterday and pushed a fix: rG53bdc6288f9b: scd: Recover the partial match for PORTSTR for PC/SC.