aboutsummaryrefslogtreecommitdiffstats
path: root/scd/ccid-driver.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2020-11-27 06:17:56 +0000
committerNIIBE Yutaka <[email protected]>2020-11-27 06:17:56 +0000
commitbb591222c3c5cb1a1750b1b1dd26d0bc53b347cb (patch)
tree016dbb5c3fed3c99e6a3ef361513b1d4e15d45be /scd/ccid-driver.c
parentagent: Fix YK s/n and prettify the request card prompt for Yubikeys (diff)
downloadgnupg-bb591222c3c5cb1a1750b1b1dd26d0bc53b347cb.tar.gz
gnupg-bb591222c3c5cb1a1750b1b1dd26d0bc53b347cb.zip
scd:ccid-driver: Fix pinpad error handling for cancel/timeout.
* scd/apdu.h (SW_HOST_UI_CANCELLED, SW_HOST_UI_TIMEOUT): New. * scd/ccid-driver.h (CCID_DRIVER_ERR_UI_CANCELLED): New. (CCID_DRIVER_ERR_UI_TIMEOUT): New. * scd/ccid-driver.c (bulk_in): Handle PIN input cancel/timeout error. * scd/iso7816.c (map_sw): Support SW_HOST_UI_CANCELLED and SW_HOST_UI_TIMEOUT. -- GnuPG-bug-id: 4614 Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'scd/ccid-driver.c')
-rw-r--r--scd/ccid-driver.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
index eed8e0320..021f9ac64 100644
--- a/scd/ccid-driver.c
+++ b/scd/ccid-driver.c
@@ -2148,7 +2148,16 @@ bulk_in (ccid_driver_t handle, unsigned char *buffer, size_t length,
}
}
if (CCID_COMMAND_FAILED (buffer))
- print_command_failed (buffer);
+ {
+ int ec;
+
+ ec = CCID_ERROR_CODE (buffer);
+ print_command_failed (buffer);
+ if (ec == 0xEF)
+ return CCID_DRIVER_ERR_UI_CANCELLED;
+ else if (ec == 0xF0)
+ return CCID_DRIVER_ERR_UI_TIMEOUT;
+ }
/* Check whether a card is at all available. Note: If you add new
error codes here, check whether they need to be ignored in