From 1586f240f43d134ab7225fbbf9624d445a925d0e Mon Sep 17 00:00:00 2001 From: vletoux Date: Sun, 3 May 2015 12:48:26 +0200 Subject: [PATCH] iso7816.c: fix SC_PIN_CMD_IMPLICIT_CHANGE with pinpad When a pinpad is used, the old pin is asked whatever, even if a previous authentication happenened or if the card doesn't support it. --- src/libopensc/iso7816.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libopensc/iso7816.c b/src/libopensc/iso7816.c index 37abd177..9c8d85ef 100644 --- a/src/libopensc/iso7816.c +++ b/src/libopensc/iso7816.c @@ -999,7 +999,7 @@ iso7816_build_pin_apdu(struct sc_card *card, struct sc_apdu *apdu, break; case SC_PIN_CMD_CHANGE: ins = 0x24; - if (data->pin1.len != 0 || use_pin_pad) { + if (data->pin1.len != 0 || (use_pin_pad && !( data->flags & SC_PIN_CMD_IMPLICIT_CHANGE))) { if ((r = sc_build_pin(buf, buf_len, &data->pin1, pad)) < 0) return r; len += r; @@ -1023,7 +1023,7 @@ iso7816_build_pin_apdu(struct sc_card *card, struct sc_apdu *apdu, break; case SC_PIN_CMD_UNBLOCK: ins = 0x2C; - if (data->pin1.len != 0 || use_pin_pad) { + if (data->pin1.len != 0 || (use_pin_pad && !( data->flags & SC_PIN_CMD_IMPLICIT_CHANGE))) { if ((r = sc_build_pin(buf, buf_len, &data->pin1, pad)) < 0) return r; len += r;