gpg4win pinentry ignores pinpad

NIIBE Yutaka gniibe at fsij.org
Fri Oct 25 02:47:47 CEST 2013


On 2013-10-24 at 22:05 +0200, Martin Wolters wrote:
> looks it up in hope of finding something useful. The error code of
> pcsc_control() is Invalid Handle (0x06), forwarded from SCardControl()
> in the Windows Smartcard API, indicating reader_table[slot].pcsc.card
> contains an invalid value.

Err...  I understand.  This is a bug.

There are two implementations for PC/SC access by GnuPG, depending on
the flag NEED_PCSC_WRAPPER.  On Windows, *_direct version is used.
(While I tested mainly on GNU/Linux, where *_wrapper version is used.)

For *_direct version, we should not call pcsc_vendor_specific_init
from open_pcsc_reader_direct, as it is *not* yet connected to card,
or else, as you saw, it just returned error.

We should call pcsc_vendor_specific_init from connect_pcsc_card, even
though it's not card specific (but reader specific).  This is due to
PC/SC API where the distinction of reader and card is not good.  It
would be clear if we have API to control reader, but currently, we
need to control reader through the API of card control (thus, after
connecting card).

Here's a patch.  I will commit this soon.

Well, then, you're going back to your original question of building
GnuPG on Windows.  Sorry, I don't have knowledge.  You'd better to ask
to gpg4win-devel list.

Thank you for your bug report.

diff --git a/scd/apdu.c b/scd/apdu.c
index 58f6075..0351e00 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -1508,6 +1508,8 @@ connect_pcsc_card (int slot)
       pcsc_dword_t readerlen, atrlen;
       long card_state, card_protocol;
 
+      pcsc_vendor_specific_init (slot);
+
       atrlen = DIM (reader_table[0].atr);
       readerlen = sizeof reader -1 ;
       err = pcsc_status (reader_table[slot].pcsc.card,
@@ -1929,7 +1931,6 @@ open_pcsc_reader_direct (const char *portstr)
   reader_table[slot].send_apdu_reader = pcsc_send_apdu;
   reader_table[slot].dump_status_reader = dump_pcsc_reader_status;
 
-  pcsc_vendor_specific_init (slot);
   dump_reader_status (slot);
   return slot;
 }
-- 





More information about the Gnupg-devel mailing list