mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
PC/SC pinpad support (pinpad input for modify pass phrase with resetcode, by admin).
This commit is contained in:
parent
20c59b74ad
commit
93db5ed4e6
6 changed files with 139 additions and 73 deletions
|
@ -354,26 +354,14 @@ iso7816_change_reference_data (int slot, int chvno,
|
|||
|
||||
|
||||
gpg_error_t
|
||||
iso7816_reset_retry_counter_kp (int slot, int chvno,
|
||||
const char *newchv, size_t newchvlen,
|
||||
iso7816_pininfo_t *pininfo)
|
||||
iso7816_reset_retry_counter_with_rc_kp (int slot, int chvno,
|
||||
iso7816_pininfo_t *pininfo)
|
||||
{
|
||||
int sw;
|
||||
|
||||
if (!newchv || !newchvlen )
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
/* FIXME: The keypad mode has not yet been tested. */
|
||||
if (pininfo && pininfo->mode)
|
||||
sw = apdu_send_simple_kp (slot, 0x00, CMD_RESET_RETRY_COUNTER,
|
||||
2, chvno, newchvlen, newchv,
|
||||
pininfo->mode,
|
||||
pininfo->minlen,
|
||||
pininfo->maxlen,
|
||||
sw = apdu_keypad_modify (slot, 0x00, CMD_RESET_RETRY_COUNTER, 0, chvno,
|
||||
pininfo->mode, pininfo->minlen, pininfo->maxlen,
|
||||
pininfo->padlen);
|
||||
else
|
||||
sw = apdu_send_simple (slot, 0, 0x00, CMD_RESET_RETRY_COUNTER,
|
||||
2, chvno, newchvlen, newchv);
|
||||
return map_sw (sw);
|
||||
}
|
||||
|
||||
|
@ -393,11 +381,28 @@ iso7816_reset_retry_counter_with_rc (int slot, int chvno,
|
|||
}
|
||||
|
||||
|
||||
gpg_error_t
|
||||
iso7816_reset_retry_counter_kp (int slot, int chvno,
|
||||
iso7816_pininfo_t *pininfo)
|
||||
{
|
||||
int sw;
|
||||
|
||||
sw = apdu_keypad_modify (slot, 0x00, CMD_RESET_RETRY_COUNTER, 2, chvno,
|
||||
pininfo->mode, pininfo->minlen, pininfo->maxlen,
|
||||
pininfo->padlen);
|
||||
return map_sw (sw);
|
||||
}
|
||||
|
||||
|
||||
gpg_error_t
|
||||
iso7816_reset_retry_counter (int slot, int chvno,
|
||||
const char *newchv, size_t newchvlen)
|
||||
{
|
||||
return iso7816_reset_retry_counter_kp (slot, chvno, newchv, newchvlen, NULL);
|
||||
int sw;
|
||||
|
||||
sw = apdu_send_simple (slot, 0, 0x00, CMD_RESET_RETRY_COUNTER,
|
||||
2, chvno, newchvlen, newchv);
|
||||
return map_sw (sw);
|
||||
}
|
||||
|
||||
|
||||
|
@ -440,6 +445,19 @@ iso7816_get_data (int slot, int extended_mode, int tag,
|
|||
}
|
||||
|
||||
|
||||
gpg_error_t
|
||||
iso7816_put_data_kp (int slot, int tag, iso7816_pininfo_t *pininfo)
|
||||
{
|
||||
int sw;
|
||||
|
||||
sw = apdu_keypad_modify (slot, 0x00, CMD_PUT_DATA,
|
||||
((tag >> 8) & 0xff), (tag & 0xff),
|
||||
pininfo->mode, pininfo->minlen, pininfo->maxlen,
|
||||
pininfo->padlen);
|
||||
return map_sw (sw);
|
||||
}
|
||||
|
||||
|
||||
/* Perform a PUT DATA command on card in SLOT. Write DATA of length
|
||||
DATALEN to TAG. EXTENDED_MODE controls whether extended length
|
||||
headers or command chaining is used instead of single length
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue