fixed bugs for pin modification

git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@519 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
frankmorgner
2011-09-02 15:38:01 +00:00
parent 326904b2de
commit e1e359b440
2 changed files with 11 additions and 3 deletions

View File

@@ -284,6 +284,7 @@ main(int argc, char *argv[])
memcpy(&modify_ctl, recvbuf+i+2, 4);
}
}
if (0 == pace_ctl) {
printf("Reader does not support PACE\n");
goto err;
@@ -292,6 +293,8 @@ main(int argc, char *argv[])
pace_ctl = ntohl(pace_ctl);
modify_ctl = ntohl(modify_ctl);
#define TESTPACE 1
#ifdef TESTPACE
recvlen = sizeof(recvbuf);
sendbuf[0] = 0x01; /* idxFunction = GetReadersPACECapabilities */
sendbuf[1] = 0x00; /* lengthInputData */
@@ -338,6 +341,7 @@ main(int argc, char *argv[])
printf("Established PACE channel returned in %.0fs.\n",
difftime(t_end, t_start));
#endif
#ifdef SIMULATE_TA_CA
@@ -396,17 +400,18 @@ main(int argc, char *argv[])
}
#endif
#define MODIFY_PIN 1
#ifdef MODIFY_PIN
if (0 == modify_ctl) {
printf("Reader does not support MODIFY_PIN_DIRECT\n");
goto err;
}
BYTE = bufs2[] = {0x15, 0x05, 0x82, 0x08, 0x00, 0x00, 0x00, 0x06, 0x06,
BYTE bufs2[] = {0x15, 0x05, 0x82, 0x08, 0x00, 0x00, 0x00, 0x06, 0x06,
0x01, 0x02, 0x02, 0x09, 0x04, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x05,
0x00, 0x00, 0x00, 0x00, 0x2C, 0x02, 0x03, 0x00};
recvlen = sizeof(recvbuf);
rv = SCardControl(hCard, modify_ioctl, bufs2,
r = SCardControl(hCard, modify_ctl, bufs2,
sizeof bufs2, recvbuf, sizeof recvbuf, &recvlen);
#endif

View File

@@ -703,7 +703,8 @@ write_pin_length(sc_apdu_t *apdu, const struct sc_pin_cmd_pin *pin,
if (!apdu || !apdu->data || !pin || apdu->datalen <= pin->length_offset ||
!sc_result) {
*sc_result = SC_ERROR_INVALID_ARGUMENTS;
if (sc_result)
*sc_result = SC_ERROR_INVALID_ARGUMENTS;
return 0;
}
@@ -1504,6 +1505,8 @@ int ccid_parse_bulkout(const __u8* inbuf, size_t inlen, __u8** outbuf)
if (!inbuf)
return 0;
bin_log(ctx, SC_LOG_DEBUG_VERBOSE, "CCID input", inbuf, inlen);
switch (*inbuf) {
case 0x62:
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "PC_to_RDR_IccPowerOn");