1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-11 21:48:50 +01:00

scd: more pinpad fix.

* scd/apdu.c (check_pcsc_pinpad): Set ->minlen and ->maxlen only when
those are specified.
(pcsc_pinpad_modify): Remove old check code.

--

cherry picked from master.
This commit is contained in:
NIIBE Yutaka 2013-11-11 16:41:43 +09:00
parent 04e5feea8b
commit 07d7015e4d

View File

@ -2206,8 +2206,11 @@ check_pcsc_pinpad (int slot, int command, pininfo_t *pininfo)
{ {
int r; int r;
pininfo->minlen = reader_table[slot].pcsc.pinmin; if (reader_table[slot].pcsc.pinmin >= 0)
pininfo->maxlen = reader_table[slot].pcsc.pinmax; pininfo->minlen = reader_table[slot].pcsc.pinmin;
if (reader_table[slot].pcsc.pinmax >= 0)
pininfo->maxlen = reader_table[slot].pcsc.pinmax;
if ((command == ISO7816_VERIFY && reader_table[slot].pcsc.verify_ioctl != 0) if ((command == ISO7816_VERIFY && reader_table[slot].pcsc.verify_ioctl != 0)
|| (command == ISO7816_CHANGE_REFERENCE_DATA || (command == ISO7816_CHANGE_REFERENCE_DATA
@ -2330,12 +2333,6 @@ pcsc_pinpad_modify (int slot, int class, int ins, int p0, int p1,
if (!pininfo->maxlen) if (!pininfo->maxlen)
pininfo->maxlen = 15; pininfo->maxlen = 15;
/* Note that the 25 is the maximum value the SPR532 allows. */
if (pininfo->minlen < 1 || pininfo->minlen > 25
|| pininfo->maxlen < 1 || pininfo->maxlen > 25
|| pininfo->minlen > pininfo->maxlen)
return SW_HOST_INV_VALUE;
pin_modify = xtrymalloc (len); pin_modify = xtrymalloc (len);
if (!pin_modify) if (!pin_modify)
return SW_HOST_OUT_OF_CORE; return SW_HOST_OUT_OF_CORE;