summaryrefslogtreecommitdiffstats
path: root/scd
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2013-11-13 08:43:26 +0100
committerNIIBE Yutaka <gniibe@fsij.org>2013-11-13 08:43:26 +0100
commitabd922e79b2ff63a5a763a30d4a06a91f93d0b12 (patch)
treedecf7f7d78d10e693431912dd49bcdf83fbbde9e /scd
parentscd: more pinpad fix. (diff)
downloadgnupg2-abd922e79b2ff63a5a763a30d4a06a91f93d0b12.tar.xz
gnupg2-abd922e79b2ff63a5a763a30d4a06a91f93d0b12.zip
scd: more pinpad input fix for PC/SC.
* scd/apdu.c (check_pcsc_pinpad): Set default values here. (pcsc_pinpad_verify, pcsc_pinpad_modify): Remove setting default values, as it's too late. -- GnuPG-bug-id: 1549
Diffstat (limited to 'scd')
-rw-r--r--scd/apdu.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/scd/apdu.c b/scd/apdu.c
index 961c4191f..dd45e9968 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -2183,6 +2183,11 @@ check_pcsc_pinpad (int slot, int command, pininfo_t *pininfo)
if (reader_table[slot].pcsc.pinmax >= 0)
pininfo->maxlen = reader_table[slot].pcsc.pinmax;
+ if (!pininfo->minlen)
+ pininfo->minlen = 1;
+ if (!pininfo->maxlen)
+ pininfo->maxlen = 15;
+
if ((command == ISO7816_VERIFY && reader_table[slot].pcsc.verify_ioctl != 0)
|| (command == ISO7816_CHANGE_REFERENCE_DATA
&& reader_table[slot].pcsc.modify_ioctl != 0))
@@ -2219,11 +2224,6 @@ pcsc_pinpad_verify (int slot, int class, int ins, int p0, int p1,
if (pininfo->fixedlen < 0 || pininfo->fixedlen >= 16)
return SW_NOT_SUPPORTED;
- if (!pininfo->minlen)
- pininfo->minlen = 1;
- if (!pininfo->maxlen)
- pininfo->maxlen = 15;
-
pin_verify = xtrymalloc (len);
if (!pin_verify)
return SW_HOST_OUT_OF_CORE;
@@ -2301,11 +2301,6 @@ pcsc_pinpad_modify (int slot, int class, int ins, int p0, int p1,
if (pininfo->fixedlen < 0 || pininfo->fixedlen >= 16)
return SW_NOT_SUPPORTED;
- if (!pininfo->minlen)
- pininfo->minlen = 1;
- if (!pininfo->maxlen)
- pininfo->maxlen = 15;
-
pin_modify = xtrymalloc (len);
if (!pin_modify)
return SW_HOST_OUT_OF_CORE;