Hello.

I found a bug (maybe a typo?) while playing with GnuK PIN pad support.

In openpgp.c L1410, it fills with bConfirmPIN with apdu.cmd_apdu_data[5].

It does not work when I gave it bPinSupport = 3 - which allows PIN
modification via PIN pad.

While I searching for solution, I found usb-icc.c mentions bConfirmPIN
is located in cmd_apdu_data[0]. I fixed openpgp.c to use [0] and it
seems to work well.

I attached patch for this.

Thanks.
>From 4d283cfb546920c51a22fac72dc9dea3c6c632e2 Mon Sep 17 00:00:00 2001
From: perillamint <[email protected]>
Date: Sun, 29 Nov 2015 07:32:17 +0900
Subject: [PATCH] Fix offset of bConfirmPIN.

---
 src/openpgp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/openpgp.c b/src/openpgp.c
index 0c5b8ed..efeff44 100644
--- a/src/openpgp.c
+++ b/src/openpgp.c
@@ -1407,7 +1407,7 @@ card_thread (chopstx_t thd, struct eventflag *ccid_comm)
       else if (m == EV_MODIFY_CMD_AVAILABLE)
 	{
 #if defined(PINPAD_SUPPORT)
-	  uint8_t bConfirmPIN = apdu.cmd_apdu_data[5];
+	  uint8_t bConfirmPIN = apdu.cmd_apdu_data[0];
 	  uint8_t *p = apdu.cmd_apdu_data;
 
 	  if (INS (apdu) != INS_CHANGE_REFERENCE_DATA
-- 
2.4.10

_______________________________________________
Gnupg-users mailing list
[email protected]
http://lists.gnupg.org/mailman/listinfo/gnupg-users

Reply via email to