- ccid-emulator: propagating PACE capabilities to ccid descriptor of
- ccid-test: IOCTL_FEATURE_IFD_PIN_PROPERTIES is currently hardcoded and should be replaced by the value from GET_FEATURE_REQUEST - pcsclite_trunk.patch: fixed propagation of data from SCardControl to SecurePINSpecialVerify and SecurePINSpecialCapabilities git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@154 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
Index: PCSC/src/PCSC/reader.h.in
|
Index: PCSC/src/PCSC/reader.h.in
|
||||||
===================================================================
|
===================================================================
|
||||||
--- PCSC/src/PCSC/reader.h.in (Revision 4999)
|
--- PCSC/src/PCSC/reader.h.in (Revision 4993)
|
||||||
+++ PCSC/src/PCSC/reader.h.in (Arbeitskopie)
|
+++ PCSC/src/PCSC/reader.h.in (Arbeitskopie)
|
||||||
@@ -121,6 +121,7 @@
|
@@ -121,6 +121,7 @@
|
||||||
#define FEATURE_IFD_DISPLAY_PROPERTIES 0x11
|
#define FEATURE_IFD_DISPLAY_PROPERTIES 0x11
|
||||||
@@ -12,13 +12,13 @@ Index: PCSC/src/PCSC/reader.h.in
|
|||||||
* "IFDs with Secure Pin Entry Capabilities" */
|
* "IFDs with Secure Pin Entry Capabilities" */
|
||||||
Index: Drivers/ccid/src/ifdhandler.c
|
Index: Drivers/ccid/src/ifdhandler.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- Drivers/ccid/src/ifdhandler.c (Revision 4999)
|
--- Drivers/ccid/src/ifdhandler.c (Revision 4993)
|
||||||
+++ Drivers/ccid/src/ifdhandler.c (Arbeitskopie)
|
+++ Drivers/ccid/src/ifdhandler.c (Arbeitskopie)
|
||||||
@@ -1384,6 +1384,16 @@
|
@@ -1384,6 +1384,16 @@
|
||||||
iBytesReturned += sizeof(PCSC_TLV_STRUCTURE);
|
iBytesReturned += sizeof(PCSC_TLV_STRUCTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ if (ccid_descriptor -> bPINSupport & CCID_CLASS_PIN_SPECIAL)
|
+ if (ccid_descriptor -> bPINSupport & CCID_CLASS_PIN_SPECIAL_CAPABILITIES)
|
||||||
+ {
|
+ {
|
||||||
+ pcsc_tlv -> tag = FEATURE_EXECUTE_PACE;
|
+ pcsc_tlv -> tag = FEATURE_EXECUTE_PACE;
|
||||||
+ pcsc_tlv -> length = 0x04; /* always 0x04 */
|
+ pcsc_tlv -> length = 0x04; /* always 0x04 */
|
||||||
@@ -31,18 +31,36 @@ Index: Drivers/ccid/src/ifdhandler.c
|
|||||||
/* We can always forward wLcdLayout */
|
/* We can always forward wLcdLayout */
|
||||||
pcsc_tlv -> tag = FEATURE_IFD_PIN_PROPERTIES;
|
pcsc_tlv -> tag = FEATURE_IFD_PIN_PROPERTIES;
|
||||||
pcsc_tlv -> length = 0x04; /* always 0x04 */
|
pcsc_tlv -> length = 0x04; /* always 0x04 */
|
||||||
@@ -1548,6 +1558,16 @@
|
@@ -1548,6 +1558,34 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ if (IOCTL_FEATURE_EXECUTE_PACE == dwControlCode)
|
+ if (IOCTL_FEATURE_EXECUTE_PACE == dwControlCode)
|
||||||
+ {
|
+ {
|
||||||
+ unsigned int iBytesReturned;
|
+ if (TxLength < 3 || !TxBuffer) {
|
||||||
|
+ DEBUG_INFO("PACE Command refused by driver");
|
||||||
|
+ return_value = IFD_COMMUNICATION_ERROR;
|
||||||
|
+ } else {
|
||||||
|
+ unsigned int iBytesReturned;
|
||||||
|
+ uint16_t lengthInputData;
|
||||||
+
|
+
|
||||||
+ iBytesReturned = RxLength;
|
+ iBytesReturned = RxLength;
|
||||||
+ return_value = SecurePINSpecialVerify(reader_index, TxBuffer, TxLength,
|
+ lengthInputData = (uint16_t *) TxBuffer + 1;
|
||||||
+ RxBuffer, &iBytesReturned);
|
+ if (*TxBuffer == 1) {
|
||||||
+ *pdwBytesReturned = iBytesReturned;
|
+ return_value = SecurePINSpecialCapabilities(reader_index,
|
||||||
|
+ TxBuffer + 3, lengthInputData,
|
||||||
|
+ RxBuffer, &iBytesReturned);
|
||||||
|
+ *pdwBytesReturned = iBytesReturned;
|
||||||
|
+ } else if (*TxBuffer == 2) {
|
||||||
|
+ return_value = SecurePINSpecialVerify(reader_index,
|
||||||
|
+ TxBuffer + 3, lengthInputData,
|
||||||
|
+ RxBuffer, &iBytesReturned);
|
||||||
|
+ *pdwBytesReturned = iBytesReturned;
|
||||||
|
+ } else {
|
||||||
|
+ DEBUG_INFO("PACE Command refused by driver");
|
||||||
|
+ return_value = IFD_COMMUNICATION_ERROR;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
if (IFD_SUCCESS != return_value)
|
if (IFD_SUCCESS != return_value)
|
||||||
@@ -50,7 +68,7 @@ Index: Drivers/ccid/src/ifdhandler.c
|
|||||||
|
|
||||||
Index: Drivers/ccid/src/commands.c
|
Index: Drivers/ccid/src/commands.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- Drivers/ccid/src/commands.c (Revision 4999)
|
--- Drivers/ccid/src/commands.c (Revision 4993)
|
||||||
+++ Drivers/ccid/src/commands.c (Arbeitskopie)
|
+++ Drivers/ccid/src/commands.c (Arbeitskopie)
|
||||||
@@ -68,7 +68,13 @@
|
@@ -68,7 +68,13 @@
|
||||||
unsigned int tx_length, unsigned char tx_buffer[], unsigned int *rx_length,
|
unsigned int tx_length, unsigned char tx_buffer[], unsigned int *rx_length,
|
||||||
@@ -190,7 +208,7 @@ Index: Drivers/ccid/src/commands.c
|
|||||||
+
|
+
|
||||||
Index: Drivers/ccid/src/commands.h
|
Index: Drivers/ccid/src/commands.h
|
||||||
===================================================================
|
===================================================================
|
||||||
--- Drivers/ccid/src/commands.h (Revision 4999)
|
--- Drivers/ccid/src/commands.h (Revision 4993)
|
||||||
+++ Drivers/ccid/src/commands.h (Arbeitskopie)
|
+++ Drivers/ccid/src/commands.h (Arbeitskopie)
|
||||||
@@ -37,6 +37,14 @@
|
@@ -37,6 +37,14 @@
|
||||||
unsigned char TxBuffer[], unsigned int TxLength,
|
unsigned char TxBuffer[], unsigned int TxLength,
|
||||||
@@ -209,19 +227,24 @@ Index: Drivers/ccid/src/commands.h
|
|||||||
unsigned char RxBuffer[], unsigned int *RxLength);
|
unsigned char RxBuffer[], unsigned int *RxLength);
|
||||||
Index: Drivers/ccid/src/ccid.h
|
Index: Drivers/ccid/src/ccid.h
|
||||||
===================================================================
|
===================================================================
|
||||||
--- Drivers/ccid/src/ccid.h (Revision 4999)
|
--- Drivers/ccid/src/ccid.h (Revision 4993)
|
||||||
+++ Drivers/ccid/src/ccid.h (Arbeitskopie)
|
+++ Drivers/ccid/src/ccid.h (Arbeitskopie)
|
||||||
@@ -144,6 +144,7 @@
|
@@ -142,8 +142,10 @@
|
||||||
|
#define CCID_CLASS_EXCHANGE_MASK 0x00070000
|
||||||
|
|
||||||
/* Features from bPINSupport */
|
/* Features from bPINSupport */
|
||||||
#define CCID_CLASS_PIN_VERIFY 0x01
|
-#define CCID_CLASS_PIN_VERIFY 0x01
|
||||||
#define CCID_CLASS_PIN_MODIFY 0x02
|
-#define CCID_CLASS_PIN_MODIFY 0x02
|
||||||
+#define CCID_CLASS_PIN_SPECIAL 0x10
|
+#define CCID_CLASS_PIN_VERIFY 0x01
|
||||||
|
+#define CCID_CLASS_PIN_MODIFY 0x02
|
||||||
|
+#define CCID_CLASS_PIN_SPECIAL_CAPABILITIES 0x10
|
||||||
|
+#define CCID_CLASS_PIN_SPECIAL_EXECUTE 0x11
|
||||||
|
|
||||||
/* See CCID specs ch. 4.2.1 */
|
/* See CCID specs ch. 4.2.1 */
|
||||||
#define CCID_ICC_PRESENT_ACTIVE 0x00 /* 00 0000 00 */
|
#define CCID_ICC_PRESENT_ACTIVE 0x00 /* 00 0000 00 */
|
||||||
Index: Drivers/ccid/src/ccid_ifdhandler.h
|
Index: Drivers/ccid/src/ccid_ifdhandler.h
|
||||||
===================================================================
|
===================================================================
|
||||||
--- Drivers/ccid/src/ccid_ifdhandler.h (Revision 4999)
|
--- Drivers/ccid/src/ccid_ifdhandler.h (Revision 4993)
|
||||||
+++ Drivers/ccid/src/ccid_ifdhandler.h (Arbeitskopie)
|
+++ Drivers/ccid/src/ccid_ifdhandler.h (Arbeitskopie)
|
||||||
@@ -37,6 +37,8 @@
|
@@ -37,6 +37,8 @@
|
||||||
SCARD_CTL_CODE(FEATURE_IFD_PIN_PROPERTIES + CLASS2_IOCTL_MAGIC)
|
SCARD_CTL_CODE(FEATURE_IFD_PIN_PROPERTIES + CLASS2_IOCTL_MAGIC)
|
||||||
|
|||||||
@@ -23,6 +23,9 @@
|
|||||||
#include <winscard.h>
|
#include <winscard.h>
|
||||||
#include <reader.h>
|
#include <reader.h>
|
||||||
|
|
||||||
|
/* XXX IOCTL_FEATURE_IFD_PIN_PROPERTIES */
|
||||||
|
const static DWORD feature_execute_pace = 0x42330020;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -87,17 +90,21 @@ main(int argc, char *argv[])
|
|||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
|
||||||
rv = SCardControl(hCard, FEATURE_EXECUTE_PACE, pbSendBufferCapabilities,
|
rv = SCardControl(hCard, feature_execute_pace,
|
||||||
sizeof(pbSendBufferCapabilities), pbRecvBuffer,
|
pbSendBufferCapabilities, sizeof(pbSendBufferCapabilities),
|
||||||
sizeof(pbRecvBuffer), &dwRecvLength);
|
pbRecvBuffer, sizeof(pbRecvBuffer), &dwRecvLength);
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
printf("GetReadersPACECapabilities successfull, received %d bytes\n",
|
||||||
|
dwRecvLength);
|
||||||
|
|
||||||
rv = SCardControl(hCard, FEATURE_EXECUTE_PACE, pbSendBufferEstablish,
|
rv = SCardControl(hCard, feature_execute_pace,
|
||||||
sizeof(pbSendBufferEstablish), pbRecvBuffer,
|
pbSendBufferEstablish, sizeof(pbSendBufferEstablish),
|
||||||
sizeof(pbRecvBuffer), &dwRecvLength);
|
pbRecvBuffer, sizeof(pbRecvBuffer), &dwRecvLength);
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
printf("EstablishPACEChannel successfull, received %d bytes\n",
|
||||||
|
dwRecvLength);
|
||||||
|
|
||||||
|
|
||||||
rv = SCardDisconnect(hCard, SCARD_LEAVE_CARD);
|
rv = SCardDisconnect(hCard, SCARD_LEAVE_CARD);
|
||||||
|
|||||||
@@ -77,7 +77,8 @@ ccid_desc = {
|
|||||||
0x00FF), // Number of characters per line
|
0x00FF), // Number of characters per line
|
||||||
//.bPINSupport = 0,
|
//.bPINSupport = 0,
|
||||||
.bPINSupport = 0x1| // PIN Verification supported
|
.bPINSupport = 0x1| // PIN Verification supported
|
||||||
0x2, // PIN Modification supported
|
0x2| // PIN Modification supported
|
||||||
|
0x10, // PIN Special supported
|
||||||
.bMaxCCIDBusySlots = 0x01,
|
.bMaxCCIDBusySlots = 0x01,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1075,8 +1076,9 @@ perform_unknown(const __u8 *in, __u8 **out, size_t *outlen)
|
|||||||
result->bMessageType = 0x84;
|
result->bMessageType = 0x84;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sc_debug(ctx, "Unknown message type in request. "
|
sc_debug(ctx, "Unknown message type in request (0x%02x). "
|
||||||
"Using bMessageType=0x%2x for output.", 0);
|
"Using bMessageType=0x%02x for output.",
|
||||||
|
request->bMessageType, 0);
|
||||||
result->bMessageType = 0;
|
result->bMessageType = 0;
|
||||||
}
|
}
|
||||||
result->dwLength = __constant_cpu_to_le32(0);
|
result->dwLength = __constant_cpu_to_le32(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user