summaryrefslogtreecommitdiffstats
path: root/scd
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2013-11-11 08:41:43 +0100
committerNIIBE Yutaka <gniibe@fsij.org>2013-11-11 08:41:43 +0100
commit037dea9dd5eac7a74df0e12cb437e71fb0732afa (patch)
treef40b0de12e1ee9fb30f78169552f4629e2a52dc0 /scd
parentscd: pinpad fix for PC/SC on Windows. (diff)
downloadgnupg2-037dea9dd5eac7a74df0e12cb437e71fb0732afa.tar.xz
gnupg2-037dea9dd5eac7a74df0e12cb437e71fb0732afa.zip
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. -- GnuPG-bug-id: 1549
Diffstat (limited to 'scd')
-rw-r--r--scd/apdu.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/scd/apdu.c b/scd/apdu.c
index e0127d804..961c4191f 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -2177,8 +2177,11 @@ check_pcsc_pinpad (int slot, int command, pininfo_t *pininfo)
{
int r;
- pininfo->minlen = reader_table[slot].pcsc.pinmin;
- pininfo->maxlen = reader_table[slot].pcsc.pinmax;
+ if (reader_table[slot].pcsc.pinmin >= 0)
+ 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)
|| (command == ISO7816_CHANGE_REFERENCE_DATA
@@ -2303,12 +2306,6 @@ pcsc_pinpad_modify (int slot, int class, int ins, int p0, int p1,
if (!pininfo->maxlen)
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);
if (!pin_modify)
return SW_HOST_OUT_OF_CORE;