From 9a95a40e813b4e7fcff970762d1d2485766c0c63 Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 25 Sep 2009 19:29:38 +0000 Subject: [PATCH] =?UTF-8?q?Implement=20pinpad=20support=20as=20used=20by?= =?UTF-8?q?=20Portugal=20eID,=20by=20Jo=C3=A3o=20Poupino?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3744 c6295689-39f2-0310-b995-f0e70906c6a9 --- src/libopensc/opensc.h | 5 +++-- src/libopensc/reader-pcsc.c | 13 +++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/libopensc/opensc.h b/src/libopensc/opensc.h index 6c105a84..111fa73b 100644 --- a/src/libopensc/opensc.h +++ b/src/libopensc/opensc.h @@ -318,8 +318,9 @@ typedef struct sc_reader { #define SC_PIN_CMD_CHANGE 1 #define SC_PIN_CMD_UNBLOCK 2 -#define SC_PIN_CMD_USE_PINPAD 0x0001 -#define SC_PIN_CMD_NEED_PADDING 0x0002 +#define SC_PIN_CMD_USE_PINPAD 0x0001 +#define SC_PIN_CMD_NEED_PADDING 0x0002 +#define SC_PIN_CMD_IMPLICIT_CHANGE 0x0004 #define SC_PIN_ENCODING_ASCII 0 #define SC_PIN_ENCODING_BCD 1 diff --git a/src/libopensc/reader-pcsc.c b/src/libopensc/reader-pcsc.c index d5ac73fb..7d467b31 100644 --- a/src/libopensc/reader-pcsc.c +++ b/src/libopensc/reader-pcsc.c @@ -1204,11 +1204,20 @@ static int part10_build_modify_pin_block(u8 * buf, size_t * size, sc_slot_info_t tmp16 = (data->pin1.min_length << 8 ) + data->pin1.max_length; pin_modify->wPINMaxExtraDigit = HOST_TO_CCID_16(tmp16); /* Min Max */ - pin_modify->bConfirmPIN = 0x03; /* bConfirmPIN, all */ + /* bConfirmPIN flags + * 0x01: New Pin, Confirm Pin + * 0x03: Enter Old Pin, New Pin, Confirm Pin + */ + pin_modify->bConfirmPIN = data->flags & SC_PIN_CMD_IMPLICIT_CHANGE ? 0x01 : 0x03; pin_modify->bEntryValidationCondition = 0x02; /* bEntryValidationCondition, keypress only */ + /* bNumberMessage flags + * 0x02: Messages seen on Pinpad display: New Pin, Confirm Pin + * 0x03: Messages seen on Pinpad display: Enter Old Pin, New Pin, Confirm Pin + * Could be 0xFF too. + */ if (slot->capabilities & SC_SLOT_CAP_DISPLAY) - pin_modify->bNumberMessage = 0x03; /* 3 messages (because bConfirmPIN = 3), all default. Could be 0xFF too */ + pin_modify->bNumberMessage = data->flags & SC_PIN_CMD_IMPLICIT_CHANGE ? 0x02 : 0x03; else pin_modify->bNumberMessage = 0x00; /* No messages */