diff options
author | NIIBE Yutaka <[email protected]> | 2015-06-23 01:10:15 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2015-06-23 01:48:04 +0000 |
commit | 022719695e3900005d78564dfe4b2154fe0537a5 (patch) | |
tree | 2f85a002bd47a9552e6d4f3bcfeb94ae32cbff94 | |
parent | scd: Fix Cherry ST-2000 support for pinpad input. (diff) | |
download | gnupg-022719695e3900005d78564dfe4b2154fe0537a5.tar.gz gnupg-022719695e3900005d78564dfe4b2154fe0537a5.zip |
scd: pinpad workaround for PC/SC implementations.
* scd/adpu.c (pcsc_pinpad_verify, pcsc_pinpad_modify): Bigger buffer
for TPDU card reader.
--
(backport from 2.1 commit 5e1d2fe6555d06f9dcd2daac713b2edfbc0428a5)
GnuPG-bug-id: 2003, 2004
This is needed for PC/SC on Debian Jessie. Note that it's not only
for Cherry ST-2000, but also, for any TPDU card readers.
-rw-r--r-- | scd/apdu.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/scd/apdu.c b/scd/apdu.c index a2880f815..f9a1a2da9 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -2252,8 +2252,16 @@ pcsc_pinpad_verify (int slot, int class, int ins, int p0, int p1, int sw; unsigned char *pin_verify; int len = PIN_VERIFY_STRUCTURE_SIZE + pininfo->fixedlen; - unsigned char result[2]; - pcsc_dword_t resultlen = 2; + /* + * The result buffer is only expected to have two-byte result on + * return. However, some implementation uses this buffer for lower + * layer too and it assumes that there is enough space for lower + * layer communication. Such an implementation fails for TPDU + * readers with "insufficient buffer", as it needs header and + * trailer. Six is the number for header + result + trailer (TPDU). + */ + unsigned char result[6]; + pcsc_dword_t resultlen = 6; int no_lc; if (!reader_table[slot].atrlen @@ -2327,8 +2335,8 @@ pcsc_pinpad_modify (int slot, int class, int ins, int p0, int p1, int sw; unsigned char *pin_modify; int len = PIN_MODIFY_STRUCTURE_SIZE + 2 * pininfo->fixedlen; - unsigned char result[2]; - pcsc_dword_t resultlen = 2; + unsigned char result[6]; /* See the comment at pinpad_verify. */ + pcsc_dword_t resultlen = 6; int no_lc; if (!reader_table[slot].atrlen |