Check-in [a42647e45a]
Overview
Comment:Updated to deal with reads of unknown size
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a42647e45aca2e4830d7aecc124246f125b7a6fa
User & Date: rkeene on 2010-05-17 21:39:00
Other Links: manifest | tags
Context
2010-05-17
21:50
Corrected issue with sign/decrypt buffer sizes check-in: 9aa715ce7f user: rkeene tags: trunk
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

Changes

Modified cackey.c from [c23e82a84b] to [ace314276a].

  1144   1144   
  1145   1145   		bytes_to_copy = *respdata_len;
  1146   1146   
  1147   1147   		if (recv_len < bytes_to_copy) {
  1148   1148   			bytes_to_copy = recv_len;
  1149   1149   		}
  1150   1150   
  1151         -		CACKEY_DEBUG_PRINTF("Copying %lu bytes to the buffer", (unsigned long) bytes_to_copy);
         1151  +		CACKEY_DEBUG_PRINTF("Copying %lu bytes to the buffer (recv'd %lu bytes, but only %lu bytes left in our buffer)", (unsigned long) bytes_to_copy, (unsigned long) recv_len, (unsigned long) *respdata_len);
  1152   1152   
  1153   1153   		memcpy(respdata, recv_buf, bytes_to_copy);
  1154   1154   		respdata += bytes_to_copy;
  1155   1155   
  1156   1156   		*respdata_len = bytes_to_copy;
  1157   1157   		tmp_respdata_len -= bytes_to_copy;
  1158   1158   	} else {
................................................................................
  1160   1160   			CACKEY_DEBUG_PRINTF("Throwing away %lu bytes, nowhere to put them!", (unsigned long) recv_len);
  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  +
         1168  +		if (minor_rc == 0x00) {
         1169  +			minor_rc = 253;
         1170  +		}
  1167   1171   
  1168   1172   		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);
  1169   1173   		if (pcsc_getresp_ret != CACKEY_PCSC_S_OK) {
  1170   1174   			CACKEY_DEBUG_PRINTF("Buffer read failed!  Returning in failure");
  1171   1175   
  1172   1176   			/* End Smartcard Transaction */
  1173   1177   			cackey_end_transaction(slot);