[Pcsclite-cvs-commit] r3356 - in /trunk/Drivers/ccid: examples/scardcontrol.c src/ccid.h src/ccid_ifdhandler.h src/ccid_usb.c src/commands.c src/ifdhandler.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Sat Mar 21 14:07:54 UTC 2009
Author: rousseau
Date: Sat Mar 21 14:07:54 2009
New Revision: 3356
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3356
Log:
add support of PIN_PROPERTIES_STRUCTURE structure and
FEATURE_IFD_PIN_PROPERTIES
Thanks to Martin Paljak for the patch
Modified:
trunk/Drivers/ccid/examples/scardcontrol.c
trunk/Drivers/ccid/src/ccid.h
trunk/Drivers/ccid/src/ccid_ifdhandler.h
trunk/Drivers/ccid/src/ccid_usb.c
trunk/Drivers/ccid/src/commands.c
trunk/Drivers/ccid/src/ifdhandler.c
Modified: trunk/Drivers/ccid/examples/scardcontrol.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/examples/scardcontrol.c?rev=3356&op=diff
==============================================================================
--- trunk/Drivers/ccid/examples/scardcontrol.c (original)
+++ trunk/Drivers/ccid/examples/scardcontrol.c Sat Mar 21 14:07:54 2009
@@ -1,6 +1,6 @@
/*
scardcontrol.c: sample code to use/test SCardControl() API
- Copyright (C) 2004-2008 Ludovic Rousseau
+ Copyright (C) 2004-2009 Ludovic Rousseau
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -300,7 +300,7 @@
printf(" Secure verify PIN\n");
pin_verify = (PIN_VERIFY_STRUCTURE *)bSendBuffer;
- /* PC/SC v2.0.2 Part 10 PIN verification data structure */
+ /* PC/SC v2.02.05 Part 10 PIN verification data structure */
pin_verify -> bTimerOut = 0x00;
pin_verify -> bTimerOut2 = 0x00;
pin_verify -> bmFormatString = 0x82;
@@ -433,7 +433,7 @@
* bConfirmPIN = 1, bNumberMessage = 2: "New Pin" "Confirm Pin"
* bConfirmPIN = 0, bNumberMessage = 1: "New Pin"
*/
- /* PC/SC v2.0.2 Part 10 PIN modification data structure */
+ /* PC/SC v2.02.05 Part 10 PIN modification data structure */
pin_modify -> bTimerOut = 0x00;
pin_modify -> bTimerOut2 = 0x00;
pin_modify -> bmFormatString = 0x82;
Modified: trunk/Drivers/ccid/src/ccid.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid.h?rev=3356&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid.h (original)
+++ trunk/Drivers/ccid/src/ccid.h Sat Mar 21 14:07:54 2009
@@ -1,6 +1,6 @@
/*
ccid.h: CCID structures
- Copyright (C) 2003 Ludovic Rousseau
+ Copyright (C) 2003-2009 Ludovic Rousseau
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -53,6 +53,11 @@
* PIN support of the reader (directly from Class Descriptor)
*/
char bPINSupport;
+
+ /*
+ * Display dimensions of the reader (directly from Class Descriptor)
+ */
+ unsigned int wLcdLayout;
/*
* Default Clock
Modified: trunk/Drivers/ccid/src/ccid_ifdhandler.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid_ifdhandler.h?rev=3356&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid_ifdhandler.h (original)
+++ trunk/Drivers/ccid/src/ccid_ifdhandler.h Sat Mar 21 14:07:54 2009
@@ -1,6 +1,6 @@
/*
ccid_ifdhandler.h: non-generic ifdhandler functions
- Copyright (C) 2004 Ludovic Rousseau
+ Copyright (C) 2004-2009 Ludovic Rousseau
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -31,6 +31,8 @@
SCARD_CTL_CODE(FEATURE_VERIFY_PIN_DIRECT + CLASS2_IOCTL_MAGIC)
#define IOCTL_FEATURE_MODIFY_PIN_DIRECT \
SCARD_CTL_CODE(FEATURE_MODIFY_PIN_DIRECT + CLASS2_IOCTL_MAGIC)
+#define IOCTL_FEATURE_IFD_PIN_PROPERTIES \
+ SCARD_CTL_CODE(FEATURE_IFD_PIN_PROPERTIES + CLASS2_IOCTL_MAGIC)
#define DRIVER_OPTION_CCID_EXCHANGE_AUTHORIZED 1
#define DRIVER_OPTION_GEMPC_TWIN_KEY_APDU 2
Modified: trunk/Drivers/ccid/src/ccid_usb.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid_usb.c?rev=3356&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c (original)
+++ trunk/Drivers/ccid/src/ccid_usb.c Sat Mar 21 14:07:54 2009
@@ -1,6 +1,6 @@
/*
ccid_usb.c: USB access routines using the libusb library
- Copyright (C) 2003-2008 Ludovic Rousseau
+ Copyright (C) 2003-2009 Ludovic Rousseau
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -507,6 +507,9 @@
(dev->descriptor.idVendor << 16) +
dev->descriptor.idProduct;
usbDevice[reader_index].ccid.dwFeatures = dw2i(usb_interface->altsetting->extra, 40);
+ usbDevice[reader_index].ccid.wLcdLayout =
+ (usb_interface->altsetting->extra[51] << 8) +
+ usb_interface->altsetting->extra[50];
usbDevice[reader_index].ccid.bPINSupport = usb_interface->altsetting->extra[52];
usbDevice[reader_index].ccid.dwMaxCCIDMessageLength = dw2i(usb_interface->altsetting->extra, 44);
usbDevice[reader_index].ccid.dwMaxIFSD = dw2i(usb_interface->altsetting->extra, 28);
Modified: trunk/Drivers/ccid/src/commands.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/commands.c?rev=3356&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/commands.c (original)
+++ trunk/Drivers/ccid/src/commands.c Sat Mar 21 14:07:54 2009
@@ -351,7 +351,7 @@
sdata, 3);
}
- /* Build a CCID block from a PC/SC V2.1.2 Part 10 block */
+ /* Build a CCID block from a PC/SC V2.02.05 Part 10 block */
for (a = 11, b = 0; b < TxLength; b++)
{
if (1 == b) /* bTimeOut2 field */
@@ -569,7 +569,7 @@
sdata, 3);
}
- /* Build a CCID block from a PC/SC V2.1.2 Part 10 block */
+ /* Build a CCID block from a PC/SC V2.02.05 Part 10 block */
/* Do adjustments as needed - CCID spec is not exact with some
* details in the format of the structure, per-reader adaptions
Modified: trunk/Drivers/ccid/src/ifdhandler.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ifdhandler.c?rev=3356&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ifdhandler.c (original)
+++ trunk/Drivers/ccid/src/ifdhandler.c Sat Mar 21 14:07:54 2009
@@ -1,6 +1,6 @@
/*
ifdhandler.c: IFDH API
- Copyright (C) 2003-2008 Ludovic Rousseau
+ Copyright (C) 2003-2009 Ludovic Rousseau
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -1190,7 +1190,7 @@
}
}
- /* Implement the PC/SC v2.1.2 Part 10 IOCTL mechanism */
+ /* Implement the PC/SC v2.02.05 Part 10 IOCTL mechanism */
/* Query for features */
if (CM_IOCTL_GET_FEATURE_REQUEST == dwControlCode)
@@ -1198,8 +1198,8 @@
unsigned int iBytesReturned = 0;
PCSC_TLV_STRUCTURE *pcsc_tlv = (PCSC_TLV_STRUCTURE *)RxBuffer;
- /* we need room for two records */
- if (RxLength < 2 * sizeof(PCSC_TLV_STRUCTURE))
+ /* we need room for three records */
+ if (RxLength < 3 * sizeof(PCSC_TLV_STRUCTURE))
return IFD_COMMUNICATION_ERROR;
/* We can only support direct verify and/or modify currently */
@@ -1224,9 +1224,41 @@
pcsc_tlv++;
iBytesReturned += sizeof(PCSC_TLV_STRUCTURE);
}
+
+#ifdef FEATURE_IFD_PIN_PROPERTIES
+ /* We can always forward wLcdLayout */
+ pcsc_tlv -> tag = FEATURE_IFD_PIN_PROPERTIES;
+ pcsc_tlv -> length = 0x04; /* always 0x04 */
+ pcsc_tlv -> value = htonl(IOCTL_FEATURE_IFD_PIN_PROPERTIES);
+
+ pcsc_tlv++;
+ iBytesReturned += sizeof(PCSC_TLV_STRUCTURE);
+#endif
+
*pdwBytesReturned = iBytesReturned;
return_value = IFD_SUCCESS;
}
+
+#ifdef FEATURE_IFD_PIN_PROPERTIES
+ /* Get PIN handling capabilities */
+ if (IOCTL_FEATURE_IFD_PIN_PROPERTIES == dwControlCode)
+ {
+ PIN_PROPERTIES_STRUCTURE *caps = (PIN_PROPERTIES_STRUCTURE *)RxBuffer;
+
+ if (RxLength < sizeof(PIN_PROPERTIES_STRUCTURE))
+ return IFD_COMMUNICATION_ERROR;
+
+ /* Only give the LCD size for now */
+ caps -> wLcdLayout = get_ccid_descriptor(reader_index) -> wLcdLayout;
+ caps -> wLcdMaxCharacters = 0x0000;
+ caps -> wLcdMaxLines = 0x0000;
+ caps -> bEntryValidationCondition = 0x07; /* Default */
+ caps -> bTimeOut2 = 0x00; /* We do not distinguish bTimeOut from TimeOut2 */
+
+ *pdwBytesReturned = sizeof(PCSC_TLV_STRUCTURE);
+ return_value = IFD_SUCCESS;
+ }
+#endif
/* Verify a PIN, plain CCID */
if (IOCTL_FEATURE_VERIFY_PIN_DIRECT == dwControlCode)
More information about the Pcsclite-cvs-commit
mailing list