diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2020-09-25 03:35:45 +0200 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2020-09-25 03:35:45 +0200 |
commit | 4fae55f8ee11b3f710524e5e8b8a91b159949f2d (patch) | |
tree | 37459dc5bab3e48cfbc2043af8559436d29849ad /scd | |
parent | gpg: New experimental import option "bulk-import" (diff) | |
download | gnupg2-4fae55f8ee11b3f710524e5e8b8a91b159949f2d.tar.xz gnupg2-4fae55f8ee11b3f710524e5e8b8a91b159949f2d.zip |
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.
--
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'scd')
-rw-r--r-- | scd/ccid-driver.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c index ee4a5b356..345d385dd 100644 --- a/scd/ccid-driver.c +++ b/scd/ccid-driver.c @@ -1254,9 +1254,10 @@ ccid_get_reader_list (void) static int ccid_vendor_specific_init (ccid_driver_t handle) { + int r = 0; + 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 * display. But it assumes that the card returns the value of @@ -1268,12 +1269,19 @@ ccid_vendor_specific_init (ccid_driver_t handle) const unsigned char cmd[] = { '\xb5', '\x01', '\x00', '\x03', '\x00' }; 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) - return r; + } + else if (handle->id_vendor == VENDOR_SCM) + { + 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; } @@ -3528,15 +3536,6 @@ ccid_transceive_secure (ccid_driver_t handle, return CCID_DRIVER_ERR_NOT_SUPPORTED; 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[5] = 0; /* slot */ msg[6] = seqno = handle->seqno++; |