mirror of
git://git.gnupg.org/gnupg.git
synced 2025-03-26 22:29:58 +01:00
scd: For SPR532, submit the ESCape command at initialization.
* scd/ccid-driver.c (ccid_vendor_specific_init): Submit the ESC command for VENDOR_SCM. (ccid_transceive_secure): Don't submit the ESC command every time. -- Backport master commit of: 4fae55f8ee11b3f710524e5e8b8a91b159949f2d Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
dd7cc24d5f
commit
11d8d1e050
@ -1266,9 +1266,10 @@ ccid_get_reader_list (void)
|
|||||||
static int
|
static int
|
||||||
ccid_vendor_specific_init (ccid_driver_t handle)
|
ccid_vendor_specific_init (ccid_driver_t handle)
|
||||||
{
|
{
|
||||||
|
int r = 0;
|
||||||
|
|
||||||
if (handle->id_vendor == VENDOR_VEGA && handle->id_product == VEGA_ALPHA)
|
if (handle->id_vendor == VENDOR_VEGA && handle->id_product == VEGA_ALPHA)
|
||||||
{
|
{
|
||||||
int r;
|
|
||||||
/*
|
/*
|
||||||
* Vega alpha has a feature to show retry counter on the pinpad
|
* Vega alpha has a feature to show retry counter on the pinpad
|
||||||
* display. But it assumes that the card returns the value of
|
* display. But it assumes that the card returns the value of
|
||||||
@ -1280,12 +1281,19 @@ ccid_vendor_specific_init (ccid_driver_t handle)
|
|||||||
const unsigned char cmd[] = { '\xb5', '\x01', '\x00', '\x03', '\x00' };
|
const unsigned char cmd[] = { '\xb5', '\x01', '\x00', '\x03', '\x00' };
|
||||||
|
|
||||||
r = send_escape_cmd (handle, cmd, sizeof (cmd), NULL, 0, NULL);
|
r = send_escape_cmd (handle, cmd, sizeof (cmd), NULL, 0, NULL);
|
||||||
if (r != 0 && r != CCID_DRIVER_ERR_CARD_INACTIVE
|
}
|
||||||
&& r != CCID_DRIVER_ERR_NO_CARD)
|
else if (handle->id_vendor == VENDOR_SCM)
|
||||||
return r;
|
{
|
||||||
|
DEBUGOUT ("sending escape sequence to switch to a case 1 APDU\n");
|
||||||
|
r = send_escape_cmd (handle, (const unsigned char*)"\x80\x02\x00", 3,
|
||||||
|
NULL, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
if (r != 0 && r != CCID_DRIVER_ERR_CARD_INACTIVE
|
||||||
|
&& r != CCID_DRIVER_ERR_NO_CARD)
|
||||||
|
return r;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3539,15 +3547,6 @@ ccid_transceive_secure (ccid_driver_t handle,
|
|||||||
return CCID_DRIVER_ERR_NOT_SUPPORTED;
|
return CCID_DRIVER_ERR_NOT_SUPPORTED;
|
||||||
|
|
||||||
msg = send_buffer;
|
msg = send_buffer;
|
||||||
if (handle->id_vendor == VENDOR_SCM)
|
|
||||||
{
|
|
||||||
DEBUGOUT ("sending escape sequence to switch to a case 1 APDU\n");
|
|
||||||
rc = send_escape_cmd (handle, (const unsigned char*)"\x80\x02\x00", 3,
|
|
||||||
NULL, 0, NULL);
|
|
||||||
if (rc)
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 */
|
||||||
msg[6] = seqno = handle->seqno++;
|
msg[6] = seqno = handle->seqno++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user