Error in 2.3 regarding reader-port (infinite loop)

2021-12-29 Thread Anze Jensterle
Hey everyone,
I just updated my Windows PC to 2.3. I used the "reader-port" option in
scdaemon.conf to only use my Yubikey. Since updating I have found that with
that option set, the scdaemon goes into an infinite loop when trying to
access smart cards (for example Kleopatra hangs while opening). If I remove
the reader-port option in the config, the loop stops. Looking at the logs,
it seems like scd is constantly trying to initiate the first reader it
finds)
I have attached logs of the wrong and correct behavior I observed
(debug-level guru, debug-all).

Best,
Anze Jensterle
2021-12-29 14:18:30 scdaemon[19892] DBG: chan_0x0300 <- SERIALNO --all
2021-12-29 14:18:30 scdaemon[19892] detected reader 'ACS ACR1252 1S CL Reader 
PICC 0'
2021-12-29 14:18:30 scdaemon[19892] detected reader 'ACS ACR1252 1S CL Reader 
SAM 0'
2021-12-29 14:18:30 scdaemon[19892] detected reader 'OMNIKEY CardMan 3821 0'
2021-12-29 14:18:30 scdaemon[19892] detected reader 'Windows Hello for Business 
1'
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: ACS ACR1252 1S CL 
Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: new device=ACS 
ACR1252 1S CL Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: ACS ACR1252 1S CL 
Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: new device=ACS 
ACR1252 1S CL Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: ACS ACR1252 1S CL 
Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: new device=ACS 
ACR1252 1S CL Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: ACS ACR1252 1S CL 
Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: new device=ACS 
ACR1252 1S CL Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: ACS ACR1252 1S CL 
Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: new device=ACS 
ACR1252 1S CL Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: ACS ACR1252 1S CL 
Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: new device=ACS 
ACR1252 1S CL Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: ACS ACR1252 1S CL 
Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: new device=ACS 
ACR1252 1S CL Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: ACS ACR1252 1S CL 
Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: new device=ACS 
ACR1252 1S CL Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: ACS ACR1252 1S CL 
Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: new device=ACS 
ACR1252 1S CL Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: ACS ACR1252 1S CL 
Reader PICC 0
2021-12-29 14:18:30 scdaemon[19892] DBG: apdu_open_reader: new device=ACS 
ACR1252 1S CL Reader PICC 02021-12-29 14:38:46 scdaemon[10144] DBG: chan_0x02e4 <- serialno
2021-12-29 14:38:46 scdaemon[10144] detected reader 'OMNIKEY CardMan 3821 0'
2021-12-29 14:38:46 scdaemon[10144] detected reader 'Windows Hello for Business 
1'
2021-12-29 14:38:46 scdaemon[10144] detected reader 'Yubico YubiKey 
OTP+FIDO+CCID 0'
2021-12-29 14:38:46 scdaemon[10144] DBG: apdu_open_reader: OMNIKEY CardMan 3821 0
2021-12-29 14:38:46 scdaemon[10144] DBG: apdu_open_reader: new device=OMNIKEY 
CardMan 3821 0
2021-12-29 14:38:46 scdaemon[10144] reader slot 0: not connected
2021-12-29 14:38:46 scdaemon[10144] DBG: enter: apdu_connect: slot=0
2021-12-29 14:38:46 scdaemon[10144] DBG: feature: code=06, len=4, v=31300C
2021-12-29 14:38:46 scdaemon[10144] DBG: feature: code=07, len=4, v=313010
2021-12-29 14:38:46 scdaemon[10144] DBG: feature: code=0F, len=4, v=31302C
2021-12-29 14:38:46 scdaemon[10144] DBG: feature: code=11, len=4, v=313034
2021-12-29 14:38:46 scdaemon[10144] DBG: feature: code=0A, len=4, v=313008
2021-12-29 14:38:46 scdaemon[10144] DBG: feature: code=10, len=4, v=313030
2021-12-29 14:38:46 scdaemon[10144] reader slot 0: active protocol: T0
2021-12-29 14:38:46 scdaemon[10144] slot 0: 
ATR=3b7d9680318065b0830201f383009000
2021-12-29 14:38:46 scdaemon[10144] DBG: pcsc_get_status_change:  changed 
present excl inuse
2021-12-29 14:38:46 scdaemon[10144] DBG: leave: apdu_connect => sw=0x0
2021-12-29 14:38:46 scdaemon[10144] DBG: send apdu: c=00 i=A4 p1=00 p2=0C lc=2 
le=-1 em=0
2021-12-29 14:38:46 scdaemon[10144] DBG:   PCSC_data: 00a4000c023f00
2021-12-29 14:38:46 scdaemon[10144] DBG:  response: sw=6A86  datalen=0
2021-12-29 14:38:46 scdaemon[10144] DBG: send apdu: c=00 i=A4 p1=04 p2=00 lc=6 
le=-1 em=0
2021-12-29 14:38:46 scdaemon[10144] DBG:   PCSC_data: 00a4040006d27600012401
2021-12-29 14:38:46 scdaemon[10144] DBG:  response: sw=6A82  datalen=0
2021-12-29 14:38:46 scdaemon[10144] DBG: send apdu: c=00 i=A4 p1=04 p2=00 lc=9 
le=256 em=0
2021-12-29 14:38:46 scdaemon[10144] DBG:   PCSC_data: 
00a4040009a003081000
2021-12-29 14:3

Re: Error in 2.3 regarding reader-port (infinite loop)

2021-12-30 Thread Werner Koch via Gnupg-users
On Wed, 29 Dec 2021 14:55, Anze Jensterle said:

> I just updated my Windows PC to 2.3. I used the "reader-port" option in

Do you mean gnupg 2.3.4 for Windows or the gpg4win 4.0 ?

> I have attached logs of the wrong and correct behavior I observed
> (debug-level guru, debug-all).

Thanks.  We will try to replicate this.


Shalom-Salam,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.


signature.asc
Description: PGP signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: Error in 2.3 regarding reader-port (infinite loop)

2021-12-30 Thread Werner Koch via Gnupg-users
> I have attached logs of the wrong and correct behavior I observed
> (debug-level guru, debug-all).

Yes, this is an obvious bug.  We have not yet seen it because on Unix we
prefer to use the CCID driver using a different code path and further
with 2.3 there is not much need to specify a port.

Here is the bug:

  while (dl->idx < dl->idx_max)
{
  const char *rdrname = pcsc.rdrname[dl->idx];

  if (DBG_READER)
log_debug ("apdu_open_reader: %s\n", rdrname);

  /* Check the identity of reader against already opened one.  */
  for (slot = 0; slot < MAX_READER; slot++)
if (reader_table[slot].used
&& !strcmp (reader_table[slot].rdrname, rdrname))
  break;

  if (slot == MAX_READER)
{ /* Found a new device.  */
  if (DBG_READER)
log_debug ("apdu_open_reader: new device=%s\n", rdrname);

  /* When reader string is specified, check if it is the one.  */
  if (readerno < 0
  && strncmp (rdrname, dl->portstr, strlen (dl->portstr)) != 0)
continue;

The /continue/ causes the loop because the loop index is not bumped.


Salam-Shalom,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.


signature.asc
Description: PGP signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: Error in 2.3 regarding reader-port (infinite loop)

2021-12-31 Thread Anze Jensterle
I made a PR to fix this: https://dev.gnupg.org/D547.

Best,
Anze

On Thu, Dec 30, 2021 at 3:52 PM Werner Koch  wrote:

> > I have attached logs of the wrong and correct behavior I observed
> > (debug-level guru, debug-all).
>
> Yes, this is an obvious bug.  We have not yet seen it because on Unix we
> prefer to use the CCID driver using a different code path and further
> with 2.3 there is not much need to specify a port.
>
> Here is the bug:
>
>   while (dl->idx < dl->idx_max)
> {
>   const char *rdrname = pcsc.rdrname[dl->idx];
>
>   if (DBG_READER)
> log_debug ("apdu_open_reader: %s\n", rdrname);
>
>   /* Check the identity of reader against already opened one.  */
>   for (slot = 0; slot < MAX_READER; slot++)
> if (reader_table[slot].used
> && !strcmp (reader_table[slot].rdrname, rdrname))
>   break;
>
>   if (slot == MAX_READER)
> { /* Found a new device.  */
>   if (DBG_READER)
> log_debug ("apdu_open_reader: new device=%s\n", rdrname);
>
>   /* When reader string is specified, check if it is the one.
> */
>   if (readerno < 0
>   && strncmp (rdrname, dl->portstr, strlen (dl->portstr))
> != 0)
> continue;
>
> The /continue/ causes the loop because the loop index is not bumped.
>
>
> Salam-Shalom,
>
>Werner
>
> --
> Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
>
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users