diff options
author | NIIBE Yutaka <[email protected]> | 2013-01-28 02:46:40 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2013-02-05 05:16:06 +0000 |
commit | c3070705a4060694bfe5112fa9c1edc9f5479bf4 (patch) | |
tree | 80548f15d9f77c3f04df45e924fca98d68c25a22 | |
parent | SCD: Support P=N format for login data. (diff) | |
download | gnupg-c3070705a4060694bfe5112fa9c1edc9f5479bf4.tar.gz gnupg-c3070705a4060694bfe5112fa9c1edc9f5479bf4.zip |
SCD: Add vendor specific initalization.
* scd/ccid-driver.c (ccid_vendor_specific_init): New.
(ccid_open_reader): Call ccid_vendor_specific_init.
-rw-r--r-- | scd/ccid-driver.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c index fcc71ba44..e01b20cce 100644 --- a/scd/ccid-driver.c +++ b/scd/ccid-driver.c @@ -305,6 +305,9 @@ static int bulk_in (ccid_driver_t handle, unsigned char *buffer, size_t length, size_t *nread, int expected_type, int seqno, int timeout, int no_debug); static int abort_cmd (ccid_driver_t handle, int seqno); +static int send_escape_cmd (ccid_driver_t handle, const unsigned char *data, + size_t datalen, unsigned char *result, + size_t resultmax, size_t *resultlen); /* Convert a little endian stored 4 byte value into an unsigned integer. */ @@ -1526,7 +1529,30 @@ ccid_get_reader_list (void) } -/* Open the reader with the internal number READERNO and return a +/* Vendor specific custom initialization. */ +static int +ccid_vendor_specific_init (ccid_driver_t handle) +{ + if (handle->id_vendor == VENDOR_VEGA && handle->id_product == VEGA_ALPHA) + { + /* + * Vega alpha has a feature to show retry counter on the pinpad + * display. But it assumes that the card returns the value of + * retry counter by VERIFY with empty data (return code of + * 63Cx). Unfortunately, existing OpenPGP cards don't support + * VERIFY command with empty data. This vendor specific command + * sequence is to disable the feature. + */ + const unsigned char cmd[] = "\xb5\x01\x00\x03\x00"; + + return send_escape_cmd (handle, cmd, sizeof (cmd), NULL, 0, NULL); + } + + return 0; +} + + +/* Open the reader with the internal number READERNO and return a pointer to be used as handle in HANDLE. Returns 0 on success. */ int ccid_open_reader (ccid_driver_t *handle, const char *readerid) @@ -1634,6 +1660,8 @@ ccid_open_reader (ccid_driver_t *handle, const char *readerid) } } + rc = ccid_vendor_specific_init (*handle); + leave: free (ifcdesc_extra); if (rc) |