mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-22 14:57:02 +01:00
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. -- Cherry-pick master commit of: ab66c4357595b8a10ca25fd735f439fe795919b2 GnuPG-bug-id: 5297 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
18551c6dc2
commit
f8ae51977c
@ -1301,13 +1301,23 @@ ccid_vendor_specific_init (ccid_driver_t handle)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
ccid_vendor_specific_setup (ccid_driver_t handle)
|
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)
|
if (handle->id_vendor == VENDOR_SCM && handle->id_product == SCM_SPR532)
|
||||||
{
|
{
|
||||||
DEBUGOUT ("sending escape sequence to switch to a case 1 APDU\n");
|
DEBUGOUT ("sending escape sequence to switch to a case 1 APDU\n");
|
||||||
send_escape_cmd (handle, (const unsigned char*)"\x80\x02\x00", 3,
|
send_escape_cmd (handle, (const unsigned char*)"\x80\x02\x00", 3,
|
||||||
NULL, 0, NULL);
|
NULL, 0, NULL);
|
||||||
libusb_clear_halt (handle->idev, handle->ep_intr);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3583,6 +3593,8 @@ ccid_transceive_secure (ccid_driver_t handle,
|
|||||||
if (pininfo->fixedlen < 0 || pininfo->fixedlen >= 16)
|
if (pininfo->fixedlen < 0 || pininfo->fixedlen >= 16)
|
||||||
return CCID_DRIVER_ERR_NOT_SUPPORTED;
|
return CCID_DRIVER_ERR_NOT_SUPPORTED;
|
||||||
|
|
||||||
|
ccid_vendor_specific_pinpad_setup (handle);
|
||||||
|
|
||||||
msg = send_buffer;
|
msg = send_buffer;
|
||||||
msg[0] = cherry_mode? 0x89 : PC_to_RDR_Secure;
|
msg[0] = cherry_mode? 0x89 : PC_to_RDR_Secure;
|
||||||
msg[5] = 0; /* slot */
|
msg[5] = 0; /* slot */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user