Check-in [f276873873]
Overview
Comment:Updated to not set "Le" when asking to sign/decrypt (discovered from ActivClient APDU dump)

Reverted last commit where reads of 0 bytes were converted to no-ops

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:f27687387394cbb14222b94ac945068ba07de174
User & Date: rkeene on 2010-05-17 20:20:16
Other Links: manifest | tags
Context
2010-05-17
21:39
Updated to deal with reads of unknown size check-in: a42647e45a user: rkeene tags: trunk
20:20
Updated to not set "Le" when asking to sign/decrypt (discovered from ActivClient APDU dump)

Reverted last commit where reads of 0 bytes were converted to no-ops check-in: f276873873 user: rkeene tags: trunk

19:53
Updated to treat a request of read of 0 bytes as a no-op. check-in: 45212cc4ca user: rkeene tags: trunk
Changes

Modified cackey.c from [84da4e7494] to [c23e82a84b].

  1161   1161   		}
  1162   1162   	}
  1163   1163   
  1164   1164   	if (major_rc == 0x61) {
  1165   1165   		/* We need to READ */
  1166   1166   		CACKEY_DEBUG_PRINTF("Buffer read required");
  1167   1167   
  1168         -		if (minor_rc == 0x00) {
  1169         -			CACKEY_DEBUG_PRINTF("Read of 0 bytes is a no-op, returning in success.");
  1170         -
  1171         -			return(CACKEY_PCSC_S_OK);
  1172         -		}
  1173         -
  1174   1168   		pcsc_getresp_ret = cackey_send_apdu(slot, GSCIS_CLASS_ISO7816, GSCIS_INSTR_GET_RESPONSE, 0x00, 0x00, 0, NULL, minor_rc, respcode, respdata, &tmp_respdata_len);
  1175   1169   		if (pcsc_getresp_ret != CACKEY_PCSC_S_OK) {
  1176   1170   			CACKEY_DEBUG_PRINTF("Buffer read failed!  Returning in failure");
  1177   1171   
  1178   1172   			/* End Smartcard Transaction */
  1179   1173   			cackey_end_transaction(slot);
  1180   1174   
................................................................................
  1854   1848   
  1855   1849   	if (buflen > 255) {
  1856   1850   		CACKEY_DEBUG_PRINTF("Error.  buflen is greater than 255 (buflen = %lu)", (unsigned long) buflen);
  1857   1851   
  1858   1852   		return(-1);
  1859   1853   	}
  1860   1854   
  1861         -	if (outbuflen > 253) {
  1862         -		le = 253;
  1863         -	} else {
  1864         -		le = outbuflen;
  1865         -	}
  1866         -
  1867   1855   	if (slot == NULL) {
  1868   1856   		CACKEY_DEBUG_PRINTF("Error.  slot is NULL");
  1869   1857   
  1870   1858   		return(-1);
  1871   1859   	}
  1872   1860   
  1873   1861   	if (buf == NULL) {
................................................................................
  1948   1936   	cackey_select_file(slot, identity->pcsc_identity->file);
  1949   1937   
  1950   1938   	tmpbuf_s = tmpbuf;
  1951   1939   	while (tmpbuflen) {
  1952   1940   		if (tmpbuflen > 245) {
  1953   1941   			bytes_to_send = 245;
  1954   1942   			p1 = 0x80;
         1943  +			le = 0x00;
  1955   1944   		} else {
  1956   1945   			bytes_to_send = tmpbuflen;
  1957   1946   			p1 = 0x00;
         1947  +			le = 0x00;
  1958   1948   		}
  1959   1949   
  1960   1950   		send_ret = cackey_send_apdu(slot, GSCIS_CLASS_GLOBAL_PLATFORM, GSCIS_INSTR_SIGNDECRYPT, p1, 0x00, bytes_to_send, tmpbuf, le, &respcode, outbuf, &outbuflen);
  1961   1951   		if (send_ret != CACKEY_PCSC_S_OK) {
  1962   1952   			CACKEY_DEBUG_PRINTF("ADPU Sending Failed -- returning in error.");
  1963   1953   
  1964   1954   			if (respcode == 0x6982) {