aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2019-07-25 00:16:46 +0000
committerNIIBE Yutaka <[email protected]>2019-08-12 01:39:35 +0000
commit879660bf4581d902cc1d1244091873c6c0225fa2 (patch)
treeddfcda5d18b03a2e447db28911790d0ee0e2f0a0
parentscd: Fix bBWI value. (diff)
downloadgnupg-879660bf4581d902cc1d1244091873c6c0225fa2.tar.gz
gnupg-879660bf4581d902cc1d1244091873c6c0225fa2.zip
scd: Handle CCID bwi of time extension.
* scd/ccid-driver.c (bulk_in): Increase timeout by the multiplier value as defined section 6.2.6 in CCID specification. -- Backport master commit of: 996c497a864d820af06333014b2c5f74d1054866 For TPDU level transfer, it was handled. This is fix for APDU level transfer. GnuPG-bug-id: 4646 Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--scd/ccid-driver.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
index 896f64f0f..c152e9c90 100644
--- a/scd/ccid-driver.c
+++ b/scd/ccid-driver.c
@@ -1946,6 +1946,7 @@ bulk_in (ccid_driver_t handle, unsigned char *buffer, size_t length,
int rc;
int msglen;
int notified = 0;
+ int bwi = 1;
/* Fixme: The next line for the current Valgrind without support
for USB IOCTLs. */
@@ -1956,7 +1957,7 @@ bulk_in (ccid_driver_t handle, unsigned char *buffer, size_t length,
npth_unprotect ();
#endif
rc = libusb_bulk_transfer (handle->idev, handle->ep_bulk_in,
- (char*)buffer, length, &msglen, timeout);
+ buffer, length, &msglen, bwi*timeout);
#ifdef USE_NPTH
npth_protect ();
#endif
@@ -2004,6 +2005,10 @@ bulk_in (ccid_driver_t handle, unsigned char *buffer, size_t length,
DEBUGOUT_2 ("time extension requested (%02X,%02X)\n",
buffer[7], buffer[8]);
+ bwi = 1;
+ if (buffer[8] != 0 && buffer[8] != 0xff)
+ bwi = buffer[8];
+
/* Gnuk enhancement to prompt user input by ack button */
if (buffer[8] == 0xff && !notified)
{