perform_PC_to_RDR_Secure works, read actual PIN is still missing
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@17 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
21
ccid/ccid.h
21
ccid/ccid.h
@@ -653,6 +653,8 @@ perform_PC_to_RDR_Secure(const PC_to_RDR_Secure_t request,
|
|||||||
SCARD_E_READER_UNSUPPORTED, __constant_cpu_to_le32(0));
|
SCARD_E_READER_UNSUPPORTED, __constant_cpu_to_le32(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf(":");
|
||||||
|
|
||||||
__u8 PINMin, PINMax, bmPINLengthFormat, bmPINBlockString, bmFormatString;
|
__u8 PINMin, PINMax, bmPINLengthFormat, bmPINBlockString, bmFormatString;
|
||||||
__u8 *abPINApdu;
|
__u8 *abPINApdu;
|
||||||
uint32_t apdulen;
|
uint32_t apdulen;
|
||||||
@@ -668,8 +670,8 @@ perform_PC_to_RDR_Secure(const PC_to_RDR_Secure_t request,
|
|||||||
bmPINLengthFormat = verify->bmPINLengthFormat;
|
bmPINLengthFormat = verify->bmPINLengthFormat;
|
||||||
bmPINBlockString = verify->bmPINBlockString;
|
bmPINBlockString = verify->bmPINBlockString;
|
||||||
bmFormatString = verify->bmFormatString;
|
bmFormatString = verify->bmFormatString;
|
||||||
abPINApdu = (__u8*) (verify + sizeof(*verify));
|
abPINApdu = (__u8*) verify + sizeof(*verify);
|
||||||
apdulen = __le32_to_cpu(request.dwLength) - sizeof(*verify);
|
apdulen = __le32_to_cpu(request.dwLength) - sizeof(*verify) - sizeof(__u8);
|
||||||
break;
|
break;
|
||||||
case 0x01:
|
case 0x01:
|
||||||
// PIN Modification
|
// PIN Modification
|
||||||
@@ -680,8 +682,8 @@ perform_PC_to_RDR_Secure(const PC_to_RDR_Secure_t request,
|
|||||||
bmPINLengthFormat = modify->bmPINLengthFormat;
|
bmPINLengthFormat = modify->bmPINLengthFormat;
|
||||||
bmPINBlockString = modify->bmPINBlockString;
|
bmPINBlockString = modify->bmPINBlockString;
|
||||||
bmFormatString = modify->bmFormatString;
|
bmFormatString = modify->bmFormatString;
|
||||||
abPINApdu = (__u8*) (modify + sizeof(*modify));
|
abPINApdu = (__u8*) modify + sizeof(*modify);
|
||||||
apdulen = __le32_to_cpu(request.dwLength) - sizeof(*modify);
|
apdulen = __le32_to_cpu(request.dwLength) - sizeof(*modify) - sizeof(__u8);
|
||||||
break;
|
break;
|
||||||
case 0x04:
|
case 0x04:
|
||||||
// Cancel PIN function
|
// Cancel PIN function
|
||||||
@@ -691,9 +693,6 @@ perform_PC_to_RDR_Secure(const PC_to_RDR_Secure_t request,
|
|||||||
SCARD_E_READER_UNSUPPORTED, __constant_cpu_to_le32(0));
|
SCARD_E_READER_UNSUPPORTED, __constant_cpu_to_le32(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("verify=%d abPINApdu=%d sizoeof(verify)=%d\n", verify, abPINApdu, sizeof(*verify));
|
|
||||||
printf("%x %x %x %x %x %x\n", abPINApdu[0], abPINApdu[1], abPINApdu[2], abPINApdu[3], abPINApdu[4], abPINApdu[5]);
|
|
||||||
|
|
||||||
// copy the apdu
|
// copy the apdu
|
||||||
__u8 *apdu = (__u8*) malloc(apdulen);
|
__u8 *apdu = (__u8*) malloc(apdulen);
|
||||||
if (!apdu) {
|
if (!apdu) {
|
||||||
@@ -703,7 +702,7 @@ perform_PC_to_RDR_Secure(const PC_to_RDR_Secure_t request,
|
|||||||
memcpy(apdu, abPINApdu, apdulen);
|
memcpy(apdu, abPINApdu, apdulen);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
char *pin = "123456";
|
char *pin = "1234";
|
||||||
|
|
||||||
__u8 *p;
|
__u8 *p;
|
||||||
/* if system units are bytes or bits */
|
/* if system units are bytes or bits */
|
||||||
@@ -743,7 +742,6 @@ perform_PC_to_RDR_Secure(const PC_to_RDR_Secure_t request,
|
|||||||
p = apdu + 5 + 1;
|
p = apdu + 5 + 1;
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "warning: PIN Block too complex, aborting\n");
|
fprintf(stderr, "warning: PIN Block too complex, aborting\n");
|
||||||
fprintf(stderr, "%s:%d\n", __FILE__, __LINE__);
|
|
||||||
return get_RDR_to_PC_DataBlock(request.bSlot, request.bSeq,
|
return get_RDR_to_PC_DataBlock(request.bSlot, request.bSeq,
|
||||||
SCARD_F_INTERNAL_ERROR,
|
SCARD_F_INTERNAL_ERROR,
|
||||||
__constant_cpu_to_le32(0));
|
__constant_cpu_to_le32(0));
|
||||||
@@ -753,7 +751,6 @@ perform_PC_to_RDR_Secure(const PC_to_RDR_Secure_t request,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "warning: PIN Block too complex, aborting\n");
|
fprintf(stderr, "warning: PIN Block too complex, aborting\n");
|
||||||
fprintf(stderr, "%s:%d\n", __FILE__, __LINE__);
|
|
||||||
return get_RDR_to_PC_DataBlock(request.bSlot, request.bSeq,
|
return get_RDR_to_PC_DataBlock(request.bSlot, request.bSeq,
|
||||||
SCARD_F_INTERNAL_ERROR, __constant_cpu_to_le32(0));
|
SCARD_F_INTERNAL_ERROR, __constant_cpu_to_le32(0));
|
||||||
}
|
}
|
||||||
@@ -773,8 +770,6 @@ perform_PC_to_RDR_Secure(const PC_to_RDR_Secure_t request,
|
|||||||
p = apdu + 5 + 1 + justify;
|
p = apdu + 5 + 1 + justify;
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "warning: PIN Block too complex, aborting\n");
|
fprintf(stderr, "warning: PIN Block too complex, aborting\n");
|
||||||
fprintf(stderr, "%s:%d\n", __FILE__, __LINE__);
|
|
||||||
fprintf(stderr, "%x\n", bmFormatString);
|
|
||||||
return get_RDR_to_PC_DataBlock(request.bSlot, request.bSeq,
|
return get_RDR_to_PC_DataBlock(request.bSlot, request.bSeq,
|
||||||
SCARD_F_INTERNAL_ERROR,
|
SCARD_F_INTERNAL_ERROR,
|
||||||
__constant_cpu_to_le32(0));
|
__constant_cpu_to_le32(0));
|
||||||
@@ -843,8 +838,6 @@ perform_PC_to_RDR_Secure(const PC_to_RDR_Secure_t request,
|
|||||||
pin++;
|
pin++;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%x %x %x %x %x %x\n", apdu[0], apdu[1], apdu[2], apdu[3], apdu[4], apdu[5]);
|
|
||||||
|
|
||||||
|
|
||||||
DWORD dwRecvLength = MAX_BUFFER_SIZE;
|
DWORD dwRecvLength = MAX_BUFFER_SIZE;
|
||||||
*abDataOut = (__u8 *) malloc(dwRecvLength);
|
*abDataOut = (__u8 *) malloc(dwRecvLength);
|
||||||
|
|||||||
Reference in New Issue
Block a user