diff options
author | Werner Koch <[email protected]> | 2008-09-25 10:06:02 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2008-09-25 10:06:02 +0000 |
commit | 96f16f736e97992c985f01c5e93bf825fdcd5707 (patch) | |
tree | 2db9d0ade98d7ca89ffb8aa17e65a0cb6bf2c8e4 /scd/iso7816.c | |
parent | * pkclist.c (select_algo_from_prefs): Redo function to rank prefs and (diff) | |
download | gnupg-96f16f736e97992c985f01c5e93bf825fdcd5707.tar.gz gnupg-96f16f736e97992c985f01c5e93bf825fdcd5707.zip |
Finished support for v2 cards with the exception of secure messaging.
Diffstat (limited to '')
-rw-r--r-- | scd/iso7816.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/scd/iso7816.c b/scd/iso7816.c index 75a8f4a6a..2286090b6 100644 --- a/scd/iso7816.c +++ b/scd/iso7816.c @@ -1,5 +1,5 @@ /* iso7816.c - ISO 7816 commands - * Copyright (C) 2003, 2004 Free Software Foundation, Inc. + * Copyright (C) 2003, 2004, 2008 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -335,6 +335,7 @@ iso7816_reset_retry_counter_kp (int slot, int chvno, 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, @@ -350,6 +351,21 @@ iso7816_reset_retry_counter_kp (int slot, int chvno, gpg_error_t +iso7816_reset_retry_counter_with_rc (int slot, int chvno, + const char *data, size_t datalen) +{ + int sw; + + if (!data || !datalen ) + return gpg_error (GPG_ERR_INV_VALUE); + + sw = apdu_send_simple (slot, 0, 0x00, CMD_RESET_RETRY_COUNTER, + 0, chvno, datalen, data); + return map_sw (sw); +} + + +gpg_error_t iso7816_reset_retry_counter (int slot, int chvno, const char *newchv, size_t newchvlen) { @@ -404,6 +420,19 @@ iso7816_put_data (int slot, int extended_mode, int tag, return map_sw (sw); } +/* Same as iso7816_put_data but uses an odd instrcution byte. */ +gpg_error_t +iso7816_put_data_odd (int slot, int extended_mode, int tag, + const unsigned char *data, size_t datalen) +{ + int sw; + + sw = apdu_send_simple (slot, extended_mode, 0x00, CMD_PUT_DATA+1, + ((tag >> 8) & 0xff), (tag & 0xff), + datalen, (const char*)data); + return map_sw (sw); +} + /* Manage Security Environment. This is a weird operation and there is no easy abstraction for it. Furthermore, some card seem to have a different interpreation of 7816-8 and thus we resort to let the |