summaryrefslogtreecommitdiffstats
path: root/scd
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2021-04-08 06:41:28 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2021-04-08 06:41:28 +0200
commitab66c4357595b8a10ca25fd735f439fe795919b2 (patch)
tree5a709ad3a5388d09fccb3016deb71d3a48a5201d /scd
parentcommon: Fix gnupg_wait_processes, by skipping invalid PID. (diff)
downloadgnupg2-ab66c4357595b8a10ca25fd735f439fe795919b2.tar.xz
gnupg2-ab66c4357595b8a10ca25fd735f439fe795919b2.zip
scd: Fix CCID driver for SCM SPR332/SPR532.
* scd/ccid-driver.c (ccid_vendor_specific_pinpad_setup): New. (ccid_vendor_specific_setup): Only send CLEAR_HALT. (ccid_transceive_secure): Each time, use send_escape_cmd. -- GnuPG-bug-id: 5297 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'scd')
-rw-r--r--scd/ccid-driver.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
index 603c0cdbc..ca900bffb 100644
--- a/scd/ccid-driver.c
+++ b/scd/ccid-driver.c
@@ -1291,10 +1291,20 @@ ccid_vendor_specific_setup (ccid_driver_t handle)
{
if (handle->id_vendor == VENDOR_SCM && handle->id_product == SCM_SPR532)
{
+ libusb_clear_halt (handle->idev, handle->ep_intr);
+ }
+ return 0;
+}
+
+
+static int
+ccid_vendor_specific_pinpad_setup (ccid_driver_t handle)
+{
+ if (handle->id_vendor == VENDOR_SCM && handle->id_product == SCM_SPR532)
+ {
DEBUGOUT ("sending escape sequence to switch to a case 1 APDU\n");
send_escape_cmd (handle, (const unsigned char*)"\x80\x02\x00", 3,
NULL, 0, NULL);
- libusb_clear_halt (handle->idev, handle->ep_intr);
}
return 0;
}
@@ -3587,6 +3597,8 @@ ccid_transceive_secure (ccid_driver_t handle,
if (pininfo->fixedlen < 0 || pininfo->fixedlen >= 16)
return CCID_DRIVER_ERR_NOT_SUPPORTED;
+ ccid_vendor_specific_pinpad_setup (handle);
+
msg = send_buffer;
msg[0] = cherry_mode? 0x89 : PC_to_RDR_Secure;
msg[5] = 0; /* slot */