aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2011-12-02 17:09:58 +0000
committerNIIBE Yutaka <[email protected]>2012-06-08 03:25:26 +0000
commit08178d1e130a856622c0b938a34eb109bde79262 (patch)
tree540e800fdfc1627ad878c68771e04c5279dad7bd
parentfix wLangId in ccid-driver.c (diff)
downloadgnupg-08178d1e130a856622c0b938a34eb109bde79262.tar.gz
gnupg-08178d1e130a856622c0b938a34eb109bde79262.zip
Support the Cherry ST-2000 card reader.
* scd/ccid-driver.c (SCM_SCR331, SCM_SCR331DI, SCM_SCR335) (SCM_SCR3320, SCM_SPR532, CHERRY_ST2000): New constants. (parse_ccid_descriptor): Use them. (scan_or_find_usb_device, ccid_transceive_secure): Handle Cherry ST-2000. Suggested by Matthias-Christian Ott. Conflicts: scd/ccid-driver.c
-rw-r--r--THANKS1
-rw-r--r--scd/ccid-driver.c39
2 files changed, 28 insertions, 12 deletions
diff --git a/THANKS b/THANKS
index 10e8631aa..7a8740652 100644
--- a/THANKS
+++ b/THANKS
@@ -165,6 +165,7 @@ Martin Schulte schulte at thp.uni-koeln.de
Matt Kraai kraai at alumni.carnegiemellon.edu
Matthew Skala mskala at ansuz.sooke.bc.ca
Matthew Wilcox matthew at wil.cx
+Matthias-Christian Ott ott at mirix.org
Matthias Urlichs smurf at noris.de
Max Valianskiy maxcom at maxcom.ml.org
Michael Engels michael.engels at uni-duesseldorf.de
diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
index 3d66f1052..9a07c7955 100644
--- a/scd/ccid-driver.c
+++ b/scd/ccid-driver.c
@@ -209,9 +209,19 @@ enum {
VENDOR_SCM = 0x04e6,
VENDOR_OMNIKEY= 0x076b,
VENDOR_GEMPC = 0x08e6,
- VENDOR_KAAN = 0x0d46
+ VENDOR_KAAN = 0x0d46,
+ VENDOR_FSIJ = 0x234B
};
+/* Some product ids. */
+#define SCM_SCR331 0xe001
+#define SCM_SCR331DI 0x5111
+#define SCM_SCR335 0x5115
+#define SCM_SCR3320 0x5117
+#define SCM_SPR532 0xe003
+#define CHERRY_ST2000 0x003e
+
+
/* A list and a table with special transport descriptions. */
enum {
TRANSPORT_USB = 0, /* Standard USB transport. */
@@ -951,12 +961,12 @@ parse_ccid_descriptor (ccid_driver_t handle,
*/
if (handle->id_vendor == VENDOR_SCM
- && handle->max_ifsd > 48
- && ( (handle->id_product == 0xe001 && handle->bcd_device < 0x0516)
- ||(handle->id_product == 0x5111 && handle->bcd_device < 0x0620)
- ||(handle->id_product == 0x5115 && handle->bcd_device < 0x0514)
- ||(handle->id_product == 0xe003 && handle->bcd_device < 0x0504)
- ||(handle->id_product == 0x5117 && handle->bcd_device < 0x0522)
+ && handle->max_ifsd > 48
+ && ( (handle->id_product == SCM_SCR331 && handle->bcd_device < 0x0516)
+ ||(handle->id_product == SCM_SCR331DI && handle->bcd_device < 0x0620)
+ ||(handle->id_product == SCM_SCR335 && handle->bcd_device < 0x0514)
+ ||(handle->id_product == SCM_SPR532 && handle->bcd_device < 0x0504)
+ ||(handle->id_product == SCM_SCR3320 && handle->bcd_device < 0x0522)
))
{
DEBUGOUT ("enabling workaround for buggy SCM readers\n");
@@ -1136,16 +1146,20 @@ scan_or_find_usb_device (int scan_mode,
{
ifcdesc = (interface->altsetting + set_no);
/* The second condition is for older SCM SPR 532 who did
- not know about the assigned CCID class. Instead of
- trying to interpret the strings we simply check the
- product ID. */
+ not know about the assigned CCID class. The third
+ condition does the same for a Cherry SmartTerminal
+ ST-2000. Instead of trying to interpret the strings
+ we simply check the product ID. */
if (ifcdesc && ifcdesc->extra
&& ((ifcdesc->bInterfaceClass == 11
&& ifcdesc->bInterfaceSubClass == 0
&& ifcdesc->bInterfaceProtocol == 0)
|| (ifcdesc->bInterfaceClass == 255
&& dev->descriptor.idVendor == VENDOR_SCM
- && dev->descriptor.idProduct == 0xe003)))
+ && dev->descriptor.idProduct == SCM_SPR532)
+ || (ifcdesc->bInterfaceClass == 255
+ && dev->descriptor.idVendor == VENDOR_CHERRY
+ && dev->descriptor.idProduct == CHERRY_ST2000)))
{
idev = usb_open (dev);
if (!idev)
@@ -3080,7 +3094,8 @@ ccid_transceive_secure (ccid_driver_t handle,
Lc byte to the APDU. It seems that it will be replaced with
the actual length instead of being appended before the APDU
is send to the card. */
- cherry_mode = 1;
+ if (handle->id_product != CHERRY_ST2000)
+ cherry_mode = 1;
break;
default:
return CCID_DRIVER_ERR_NOT_SUPPORTED;