aboutsummaryrefslogtreecommitdiffstats
path: root/scd/iso7816.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2011-12-02 04:57:12 +0000
committerNIIBE Yutaka <[email protected]>2011-12-02 04:57:12 +0000
commitbf37c32367ba149559385ee90b6435cef8bd6412 (patch)
treefa2507fa48ebfec822932a48b94e989c75926383 /scd/iso7816.c
parentAdd hook to check the commit log syntax. (diff)
downloadgnupg-bf37c32367ba149559385ee90b6435cef8bd6412.tar.gz
gnupg-bf37c32367ba149559385ee90b6435cef8bd6412.zip
Fix pinpad input support for passphrase modification.
* apdu.c (pcsc_keypad_verify): Have dummy Lc field with value 0. (pcsc_keypad_modify): Likewise. (pcsc_keypad_modify): It's only for ISO7816_CHANGE_REFERENCE_DATA. bConfirmPIN value is determined by the parameter p0. * app-openpgp.c (do_change_pin): The flag use_keypad should be 0 when reset_mode is on, or resetcode is on. use_keypad only makes sense for iso7816_change_reference_data_kp. * iso7816.h (iso7816_put_data_kp): Remove. (iso7816_reset_retry_counter_kp): Remove. (iso7816_reset_retry_counter_with_rc_kp): Remove. (iso7816_change_reference_data_kp): Add an argument: IS_EXCHANGE. * iso7816.c (iso7816_put_data_kp): Remove. (iso7816_reset_retry_counter_kp): Remove. (iso7816_reset_retry_counter_with_rc_kp): Remove. (iso7816_change_reference_data_kp): Add an argument: IS_EXCHANGE.
Diffstat (limited to 'scd/iso7816.c')
-rw-r--r--scd/iso7816.c51
1 files changed, 7 insertions, 44 deletions
diff --git a/scd/iso7816.c b/scd/iso7816.c
index 8876b931a..45f5e08bf 100644
--- a/scd/iso7816.c
+++ b/scd/iso7816.c
@@ -307,16 +307,18 @@ iso7816_verify (int slot, int chvno, const char *chv, size_t chvlen)
/* Perform a CHANGE_REFERENCE_DATA command on SLOT for the card holder
verification vector CHVNO. With PININFO non-NULL the keypad of the
- reader will be used. */
+ reader will be used. If IS_EXCHANGE is 0, a "change reference
+ data" is done, otherwise an "exchange reference data". */
gpg_error_t
-iso7816_change_reference_data_kp (int slot, int chvno,
+iso7816_change_reference_data_kp (int slot, int chvno, int is_exchange,
iso7816_pininfo_t *pininfo)
{
int sw;
- sw = apdu_keypad_modify (slot, 0x00, CMD_CHANGE_REFERENCE_DATA, 0, chvno,
- pininfo->mode, pininfo->minlen, pininfo->maxlen,
- pininfo->padlen);
+ sw = apdu_keypad_modify (slot, 0x00, CMD_CHANGE_REFERENCE_DATA,
+ is_exchange ? 1 : 0,
+ chvno, pininfo->mode, pininfo->minlen,
+ pininfo->maxlen, pininfo->padlen);
return map_sw (sw);
}
@@ -354,19 +356,6 @@ iso7816_change_reference_data (int slot, int chvno,
gpg_error_t
-iso7816_reset_retry_counter_with_rc_kp (int slot, int chvno,
- iso7816_pininfo_t *pininfo)
-{
- int sw;
-
- sw = apdu_keypad_modify (slot, 0x00, CMD_RESET_RETRY_COUNTER, 0, chvno,
- pininfo->mode, pininfo->minlen, pininfo->maxlen,
- pininfo->padlen);
- return map_sw (sw);
-}
-
-
-gpg_error_t
iso7816_reset_retry_counter_with_rc (int slot, int chvno,
const char *data, size_t datalen)
{
@@ -382,19 +371,6 @@ 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)
{
@@ -445,19 +421,6 @@ 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