diff --git a/scd/apdu.c b/scd/apdu.c index 3c549a3a0..21cd57430 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -82,15 +82,7 @@ #define DLSTDCALL #endif - -/* Helper to pass parameters related to keypad based operations. */ -struct pininfo_s -{ - int mode; - int minlen; - int maxlen; - int padlen; -}; +#define pininfo_s iso7816_pininfo_s /* A structure to collect information pertaining to one reader slot. */ @@ -107,7 +99,7 @@ struct reader_table_s { int (*get_status_reader)(int, unsigned int *); int (*send_apdu_reader)(int,unsigned char *,size_t, unsigned char *, size_t *, struct pininfo_s *); - int (*check_keypad)(int, int, int, int, int, int); + int (*check_keypad)(int, int, int, int, int); void (*dump_status_reader)(int); int (*set_progress_cb)(int, gcry_handler_progress_t, void*); int (*keypad_verify)(int, int, int, int, int, struct pininfo_s *); @@ -313,7 +305,7 @@ static int apdu_get_status_internal (int slot, int hang, int no_atr_reset, unsigned int *status, unsigned int *changed); static int check_pcsc_keypad (int slot, int command, int pin_mode, - int pinlen_min, int pinlen_max, int pin_padlen); + int pinlen_min, int pinlen_max); static int pcsc_keypad_verify (int slot, int class, int ins, int p0, int p1, struct pininfo_s *pininfo); static int pcsc_keypad_modify (int slot, int class, int ins, int p0, int p1, @@ -2023,7 +2015,7 @@ open_pcsc_reader (const char *portstr) on the keypad. Return 0 on success. */ static int check_pcsc_keypad (int slot, int command, int pin_mode, - int pinlen_min, int pinlen_max, int pin_padlen) + int pinlen_min, int pinlen_max) { unsigned char buf[256]; size_t len = 256; @@ -2032,7 +2024,6 @@ check_pcsc_keypad (int slot, int command, int pin_mode, (void)pin_mode; (void)pinlen_min; (void)pinlen_max; - (void)pin_padlen; check_again: if (command == ISO7816_VERIFY) @@ -2099,9 +2090,6 @@ pcsc_keypad_verify (int slot, int class, int ins, int p0, int p1, if (pininfo->mode != 1) return SW_NOT_SUPPORTED; - if (pininfo->padlen != 0) - return SW_NOT_SUPPORTED; - if (!pininfo->minlen) pininfo->minlen = 1; if (!pininfo->maxlen) @@ -2181,9 +2169,6 @@ pcsc_keypad_modify (int slot, int class, int ins, int p0, int p1, if (pininfo->mode != 1) return SW_NOT_SUPPORTED; - if (pininfo->padlen != 0) - return SW_NOT_SUPPORTED; - if (!pininfo->minlen) pininfo->minlen = 1; if (!pininfo->maxlen) @@ -2360,7 +2345,6 @@ send_apdu_ccid (int slot, unsigned char *apdu, size_t apdulen, pininfo->mode, pininfo->minlen, pininfo->maxlen, - pininfo->padlen, buffer, maxbuflen, buflen); else err = ccid_transceive (reader_table[slot].ccid.handle, @@ -2379,14 +2363,14 @@ send_apdu_ccid (int slot, unsigned char *apdu, size_t apdulen, parameters, see ccid-driver.c */ static int check_ccid_keypad (int slot, int command, int pin_mode, - int pinlen_min, int pinlen_max, int pin_padlen) + int pinlen_min, int pinlen_max) { unsigned char apdu[] = { 0, 0, 0, 0x81 }; apdu[1] = command; return ccid_transceive_secure (reader_table[slot].ccid.handle, apdu, sizeof apdu, - pin_mode, pinlen_min, pinlen_max, pin_padlen, + pin_mode, pinlen_min, pinlen_max, NULL, 0, NULL); } @@ -2407,7 +2391,6 @@ ccid_keypad_operation (int slot, int class, int ins, int p0, int p1, err = ccid_transceive_secure (reader_table[slot].ccid.handle, apdu, sizeof apdu, pininfo->mode, pininfo->minlen, pininfo->maxlen, - pininfo->padlen, result, 2, &resultlen); if (err) return err; @@ -3318,7 +3301,7 @@ apdu_get_status (int slot, int hang, parameters, see ccid-driver.c */ int apdu_check_keypad (int slot, int command, int pin_mode, - int pinlen_min, int pinlen_max, int pin_padlen) + int pinlen_min, int pinlen_max) { if (slot < 0 || slot >= MAX_READER || !reader_table[slot].used ) return SW_HOST_NO_DRIVER; @@ -3331,8 +3314,7 @@ apdu_check_keypad (int slot, int command, int pin_mode, return sw; sw = reader_table[slot].check_keypad (slot, command, - pin_mode, pinlen_min, pinlen_max, - pin_padlen); + pin_mode, pinlen_min, pinlen_max); unlock_slot (slot); return sw; } @@ -3343,14 +3325,13 @@ apdu_check_keypad (int slot, int command, int pin_mode, int apdu_keypad_verify (int slot, int class, int ins, int p0, int p1, int pin_mode, - int pinlen_min, int pinlen_max, int pin_padlen) + int pinlen_min, int pinlen_max) { struct pininfo_s pininfo; pininfo.mode = pin_mode; pininfo.minlen = pinlen_min; pininfo.maxlen = pinlen_max; - pininfo.padlen = pin_padlen; if (slot < 0 || slot >= MAX_READER || !reader_table[slot].used ) return SW_HOST_NO_DRIVER; @@ -3374,14 +3355,13 @@ apdu_keypad_verify (int slot, int class, int ins, int p0, int p1, int pin_mode, int apdu_keypad_modify (int slot, int class, int ins, int p0, int p1, int pin_mode, - int pinlen_min, int pinlen_max, int pin_padlen) + int pinlen_min, int pinlen_max) { struct pininfo_s pininfo; pininfo.mode = pin_mode; pininfo.minlen = pinlen_min; pininfo.maxlen = pinlen_max; - pininfo.padlen = pin_padlen; if (slot < 0 || slot >= MAX_READER || !reader_table[slot].used ) return SW_HOST_NO_DRIVER; diff --git a/scd/apdu.h b/scd/apdu.h index 61501c43b..64c216231 100644 --- a/scd/apdu.h +++ b/scd/apdu.h @@ -113,13 +113,11 @@ int apdu_reset (int slot); int apdu_get_status (int slot, int hang, unsigned int *status, unsigned int *changed); int apdu_check_keypad (int slot, int command, int pin_mode, - int pinlen_min, int pinlen_max, int pin_padlen); + int pinlen_min, int pinlen_max); int apdu_keypad_verify (int slot, int class, int ins, int p0, int p1, - int pin_mode, int pinlen_min, int pinlen_max, - int pin_padlen); + int pin_mode, int pinlen_min, int pinlen_max); int apdu_keypad_modify (int slot, int class, int ins, int p0, int p1, - int pin_mode, int pinlen_min, int pinlen_max, - int pin_padlen); + int pin_mode, int pinlen_min, int pinlen_max); int apdu_send_simple (int slot, int extended_mode, int class, int ins, int p0, int p1, int lc, const char *data); diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c index 6d135e017..b8a98096f 100644 --- a/scd/ccid-driver.c +++ b/scd/ccid-driver.c @@ -3289,8 +3289,8 @@ ccid_transceive (ccid_driver_t handle, The APDU should me made up of 4 bytes without Lc. PINLEN_MIN and PINLEN_MAX define the limits for the pin length. 0 - may be used t enable reasonable defaults. PIN_PADLEN should be 0. - + may be used t enable reasonable defaults. + When called with RESP and NRESP set to NULL, the function will merely check whether the reader supports the secure command for the given APDU and PIN_MODE. */ @@ -3298,7 +3298,6 @@ int ccid_transceive_secure (ccid_driver_t handle, const unsigned char *apdu_buf, size_t apdu_buflen, int pin_mode, int pinlen_min, int pinlen_max, - int pin_padlen, unsigned char *resp, size_t maxresplen, size_t *nresp) { int rc; @@ -3327,9 +3326,6 @@ ccid_transceive_secure (ccid_driver_t handle, if (pin_mode != 1) return CCID_DRIVER_ERR_NOT_SUPPORTED; - if (pin_padlen != 0) - return CCID_DRIVER_ERR_NOT_SUPPORTED; - if (!pinlen_min) pinlen_min = 1; if (!pinlen_max) diff --git a/scd/ccid-driver.h b/scd/ccid-driver.h index 6bb1913e1..d5e40ca43 100644 --- a/scd/ccid-driver.h +++ b/scd/ccid-driver.h @@ -93,8 +93,8 @@ int ccid_transceive (ccid_driver_t handle, unsigned char *resp, size_t maxresplen, size_t *nresp); int ccid_transceive_secure (ccid_driver_t handle, const unsigned char *apdu, size_t apdulen, - int pin_mode, - int pinlen_min, int pinlen_max, int pin_padlen, + int pin_mode, + int pinlen_min, int pinlen_max, unsigned char *resp, size_t maxresplen, size_t *nresp); int ccid_transceive_escape (ccid_driver_t handle, const unsigned char *data, size_t datalen, diff --git a/scd/iso7816.c b/scd/iso7816.c index 12daff9fb..23b84cf6f 100644 --- a/scd/iso7816.c +++ b/scd/iso7816.c @@ -273,9 +273,8 @@ iso7816_check_keypad (int slot, int command, iso7816_pininfo_t *pininfo) { int sw; - sw = apdu_check_keypad (slot, command, - pininfo->mode, pininfo->minlen, pininfo->maxlen, - pininfo->padlen); + sw = apdu_check_keypad (slot, command, + pininfo->mode, pininfo->minlen, pininfo->maxlen); return iso7816_map_sw (sw); } @@ -289,8 +288,7 @@ iso7816_verify_kp (int slot, int chvno, iso7816_pininfo_t *pininfo) int sw; sw = apdu_keypad_verify (slot, 0x00, CMD_VERIFY, 0, chvno, - pininfo->mode, pininfo->minlen, pininfo->maxlen, - pininfo->padlen); + pininfo->mode, pininfo->minlen, pininfo->maxlen); return map_sw (sw); } @@ -318,7 +316,7 @@ iso7816_change_reference_data_kp (int slot, int chvno, int is_exchange, sw = apdu_keypad_modify (slot, 0x00, CMD_CHANGE_REFERENCE_DATA, is_exchange ? 1 : 0, chvno, pininfo->mode, pininfo->minlen, - pininfo->maxlen, pininfo->padlen); + pininfo->maxlen); return map_sw (sw); } diff --git a/scd/iso7816.h b/scd/iso7816.h index d12855b1c..1d66f6df7 100644 --- a/scd/iso7816.h +++ b/scd/iso7816.h @@ -37,8 +37,6 @@ struct iso7816_pininfo_s int mode; /* A mode of 0 means: Do not use the keypad. */ int minlen; int maxlen; - int padlen; - int padchar; }; typedef struct iso7816_pininfo_s iso7816_pininfo_t;