Check-in [ab991c0450]
Overview
Comment:Removed retry on NOT_TRANSACTED
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ab991c0450843345b1224b745322aed2b02b93a7
User & Date: rkeene on 2010-05-23 04:00:48
Other Links: manifest | tags
Context
2010-05-23
04:17
Updated return code documentation check-in: f337c480d8 user: rkeene tags: trunk
04:00
Removed retry on NOT_TRANSACTED check-in: ab991c0450 user: rkeene tags: trunk
03:42
Updated to retry if got NOT_TRANSACTED

Fixed issue with retry in APDU transmit check-in: 7cc9fb64cc user: rkeene tags: trunk

Changes

Modified cackey.c from [c59120c23a] to [a75c87a979].

   156    156   #define GSCIS_TAG_CERTIFICATE         0x70
   157    157   #define GSCIS_TAG_CERT_ISSUE_DATE     0x71
   158    158   #define GSCIS_TAG_CERT_EXPIRE_DATE    0x72
   159    159   
   160    160   /** Applet IDs **/
   161    161   #define GSCIS_AID_CCC                 0xA0, 0x00, 0x00, 0x01, 0x16, 0xDB, 0x00
   162    162   
   163         -/* Do not set this above 252 */
   164         -#define CACKEY_APDU_MTU               128
          163  +/* Maximum size of data portion of APDUs */
          164  +/** Do not set this above 250 **/
          165  +#define CACKEY_APDU_MTU               250
   165    166   
   166    167   #ifdef CACKEY_DEBUG
   167    168   
   168    169   #  define CACKEY_DEBUG_PRINTF(x...) { fprintf(stderr, "%s():%i: ", __func__, __LINE__); fprintf(stderr, x); fprintf(stderr, "\n"); fflush(stderr); }
   169    170   #  define CACKEY_DEBUG_PRINTBUF(f, x, y) { unsigned char *TMPBUF; unsigned long idx; TMPBUF = (unsigned char *) (x); fprintf(stderr, "%s():%i: %s  (%s/%lu = {%02x", __func__, __LINE__, f, #x, (unsigned long) (y), TMPBUF[0]); for (idx = 1; idx < (y); idx++) { fprintf(stderr, ", %02x", TMPBUF[idx]); }; fprintf(stderr, "})\n"); fflush(stderr); }
   170    171   #  define CACKEY_DEBUG_PERROR(x) { fprintf(stderr, "%s():%i: ", __func__, __LINE__); perror(x); fflush(stderr); }
   171    172   #  define free(x) { CACKEY_DEBUG_PRINTF("FREE(%p) (%s)", x, #x); free(x); }
................................................................................
  1069   1070   		CACKEY_DEBUG_PRINTF("Sending APDU: <<censored>>");
  1070   1071   	} else {
  1071   1072   		CACKEY_DEBUG_PRINTBUF("Sending APDU:", xmit_buf, xmit_len);
  1072   1073   	}
  1073   1074   
  1074   1075   	recv_len = sizeof(recv_buf);
  1075   1076   	scard_xmit_ret = SCardTransmit(slot->pcsc_card, SCARD_PCI_T0, xmit_buf, xmit_len, SCARD_PCI_T1, recv_buf, &recv_len);
  1076         -	if (scard_xmit_ret == SCARD_E_NOT_TRANSACTED) {
  1077         -		CACKEY_DEBUG_PRINTF("Failed to send APDU to card (SCardTransmit() = SCARD_E_NOT_TRANSACTED), retrying...");
  1078         -
  1079         -		recv_len = sizeof(recv_buf);
  1080         -		scard_xmit_ret = SCardTransmit(slot->pcsc_card, SCARD_PCI_T0, xmit_buf, xmit_len, SCARD_PCI_T1, recv_buf, &recv_len);
  1081         -	}
  1082   1077   	if (scard_xmit_ret != SCARD_S_SUCCESS) {
  1083   1078   		CACKEY_DEBUG_PRINTF("Failed to send APDU to card (SCardTransmit() = %s/%lx)", CACKEY_DEBUG_FUNC_SCARDERR_TO_STR(scard_xmit_ret), (unsigned long) scard_xmit_ret);
  1084   1079   		CACKEY_DEBUG_PRINTF("Marking slot as having been reset");
  1085   1080   
  1086   1081   		slot->transaction_depth = 0;
  1087   1082   		slot->slot_reset = 1;
  1088   1083