Diff

Differences From Artifact [77eca6ccda]:

To Artifact [fc1d1ef268]:


  1406   1406   
  1407   1407   		return(CACKEY_PCSC_E_GENERIC);
  1408   1408   	}
  1409   1409   
  1410   1410   	/* Determine which protocol to send using */
  1411   1411   	switch (slot->protocol) {
  1412   1412   		case SCARD_PROTOCOL_T0:
         1413  +			CACKEY_DEBUG_PRINTF("Protocol to send datagram is T=0");
         1414  +
  1413   1415   			pioSendPci = SCARD_PCI_T0;
  1414   1416   
  1415   1417   			break;
  1416   1418   		case SCARD_PROTOCOL_T1:
         1419  +			CACKEY_DEBUG_PRINTF("Protocol to send datagram is T=1");
         1420  +
  1417   1421   			pioSendPci = SCARD_PCI_T1;
  1418   1422   
  1419   1423   			break;
  1420   1424   		default:
  1421   1425   			CACKEY_DEBUG_PRINTF("Invalid protocol found, aborting.");
  1422   1426   
  1423   1427   			return(CACKEY_PCSC_E_GENERIC);
................................................................................
  1426   1430   	/* Transmit */
  1427   1431   	xmit_len = 0;
  1428   1432   	xmit_buf[xmit_len++] = class;
  1429   1433   	xmit_buf[xmit_len++] = instruction;
  1430   1434   	xmit_buf[xmit_len++] = p1;
  1431   1435   	xmit_buf[xmit_len++] = p2;
  1432   1436   	if (data) {
  1433         -		if (lc > 256) {
         1437  +		if (lc > 255) {
         1438  +			CACKEY_DEBUG_PRINTF("CAUTION!  Using an Lc greater than 255 is untested.  Lc = %u", lc);
         1439  +
  1434   1440   			xmit_buf[xmit_len++] = 0x80; /* XXX UNTESTED */
  1435   1441   			xmit_buf[xmit_len++] = (lc & 0xff00) >> 8;
  1436   1442   			xmit_buf[xmit_len++] = lc & 0xff;
  1437   1443   		} else {
  1438   1444   			xmit_buf[xmit_len++] = lc;
  1439   1445   		}
  1440   1446   		for (idx = 0; idx < lc; idx++) {
  1441   1447   			xmit_buf[xmit_len++] = data[idx];
  1442   1448   		}
  1443   1449   	}
  1444   1450   
  1445   1451   	if (le != 0x00) {
  1446   1452   		if (le > 256) {
         1453  +			CACKEY_DEBUG_PRINTF("CAUTION!  Using an Le greater than 256 is untested.  Le = %u", le);
         1454  +
  1447   1455   			xmit_buf[xmit_len++] = 0x80; /* XXX UNTESTED */
  1448   1456   			xmit_buf[xmit_len++] = (le & 0xff00) >> 8;
  1449   1457   			xmit_buf[xmit_len++] = le & 0xff;
  1450   1458   		} else if (le == 256) {
  1451   1459   			xmit_buf[xmit_len++] = 0x00;
  1452   1460   		} else {
  1453   1461   			xmit_buf[xmit_len++] = le;
................................................................................
  1694   1702   	max_offset = count;
  1695   1703   	max_count = CACKEY_APDU_MTU;
  1696   1704   
  1697   1705   	cmd[2] = oid[0];
  1698   1706   	cmd[3] = oid[1];
  1699   1707   	cmd[4] = oid[2];
  1700   1708   
  1701         -	send_ret = cackey_send_apdu(slot, GSCIS_CLASS_ISO7816, NISTSP800_73_3_INSTR_GET_DATA, 0x3F, 0xFF, sizeof(cmd), cmd, count, &respcode, buffer, &count);
         1709  +	send_ret = cackey_send_apdu(slot, GSCIS_CLASS_ISO7816, NISTSP800_73_3_INSTR_GET_DATA, 0x3F, 0xFF, sizeof(cmd), cmd, 256, &respcode, buffer, &count);
  1702   1710   
  1703   1711   	if (send_ret == CACKEY_PCSC_E_RETRY) {
  1704   1712   		CACKEY_DEBUG_PRINTF("ADPU Sending failed, retrying read buffer");
  1705   1713   
  1706   1714   		return(cackey_get_data(slot, buffer, init_count, oid));
  1707   1715   	}
  1708   1716