Patch for scdaemon and reader/smartcard combo devices

NIIBE Yutaka gniibe at fsij.org
Fri Jan 21 03:52:49 CET 2011


2011-01-21 10:09, Grant Olson wrote:
> I was working off of STABLE-BRANCH-2-0.

I do it again with STABLE-BRANCH-2-0, and it is successfully applied.

My environment is pcscd 1.5.5-3 and libccid 1.3.11-1 on Debian sid.
Yes, I use a Gnuk token (version 0.8).

I did:

  * attempting to sign without a card.

  * signing once, removing and reinserting the card, signing again.

and it works fine.  However,

  * signing once, removing the card, attempting to sign, inserting the
    card, and signing again

doesn't work well.  The log of scdaemon is:

----------------------------------
scdaemon[11554]: chan_7 <- RESTART
scdaemon[11554]: chan_7 -> OK
2011-01-21 11:11:10 scdaemon[11554] updating slot 0 status: 0x0007->0x0000 (1->2)
2011-01-21 11:11:10 scdaemon[11554] sending signal 12 to client 2753
scdaemon[11554]: chan_7 <- SERIALNO openpgp
2011-01-21 11:11:14 scdaemon[11554] PC/SC RESET failed: invalid value (0x80100011)
scdaemon[11554]: chan_7 -> ERR 100663404 Card error <SCD>
scdaemon[11554]: chan_7 <- RESTART
scdaemon[11554]: chan_7 -> OK
scdaemon[11554]: chan_7 <- SERIALNO openpgp
scdaemon[11554]: chan_7 -> ERR 100663404 Card error <SCD>
scdaemon[11554]: chan_7 <- RESTART
scdaemon[11554]: chan_7 -> OK
----------------------------------

So, I added:

diff --git a/scd/apdu.c b/scd/apdu.c
index 1bdc673..458bcdd 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -1416,7 +1416,8 @@ reset_pcsc_reader_wrapped (int slot)
       /* If the error code is no smart card or no reader, we should not consider
          this a major error and close the wrapper.  */
       sw = pcsc_error_to_sw (err);
-      if (err == PCSC_E_NO_SMARTCARD || err == PCSC_E_UNKNOWN_READER)
+      if (err == PCSC_E_NO_SMARTCARD || err == PCSC_E_UNKNOWN_READER
+	  || err == PCSC_E_INVALID_VALUE)
         return sw;
       goto command_failed;
     }

Then,

  * signing once, removing the card, attempting to sign, inserting the
    card, and signing again

works fine too.
-- 



More information about the Gnupg-devel mailing list