Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 474406
Collapse All | Expand All

(-)file_not_specified_in_diff (-15 / +56 lines)
Line  Link Here
0
-- ccid-1.4.11-orig/src/commands.c
0
++ ccid-1.4.11/src/commands.c
Lines 1151-1158 RESPONSECODE CmdXfrBlock(unsigned int re Link Here
1151
			break;
1151
			break;
1152
1152
1153
		case CCID_CLASS_SHORT_APDU:
1153
		case CCID_CLASS_SHORT_APDU:
1154
			return_value = CmdXfrBlockTPDU_T0(reader_index,
1154
			if ((CARDMAN3121 == ccid_descriptor->readerID) && (protocol == T_1))
1155
				tx_length, tx_buffer, rx_length, rx_buffer);
1155
				return_value = CmdXfrBlockTPDU_T1(reader_index, tx_length,
1156
					tx_buffer, rx_length, rx_buffer);
1157
			else
1158
				return_value = CmdXfrBlockTPDU_T0(reader_index,
1159
					tx_length, tx_buffer, rx_length, rx_buffer);
1160
1156
			break;
1161
			break;
1157
1162
1158
		case CCID_CLASS_EXTENDED_APDU:
1163
		case CCID_CLASS_EXTENDED_APDU:
Lines 1188-1194 RESPONSECODE CmdXfrBlock(unsigned int re Link Here
1188
RESPONSECODE CCID_Transmit(unsigned int reader_index, unsigned int tx_length,
1193
RESPONSECODE CCID_Transmit(unsigned int reader_index, unsigned int tx_length,
1189
	const unsigned char tx_buffer[], unsigned short rx_length, unsigned char bBWI)
1194
	const unsigned char tx_buffer[], unsigned short rx_length, unsigned char bBWI)
1190
{
1195
{
1191
	unsigned char cmd[10+tx_length];	/* CCID + APDU buffer */
1196
	unsigned char cmd[11+tx_length];	/* CCID + APDU buffer */
1197
	size_t cmdlen;
1192
	_ccid_descriptor *ccid_descriptor = get_ccid_descriptor(reader_index);
1198
	_ccid_descriptor *ccid_descriptor = get_ccid_descriptor(reader_index);
1193
	status_t ret;
1199
	status_t ret;
1194
1200
Lines 1235-1251 RESPONSECODE CCID_Transmit(unsigned int Link Here
1235
	}
1241
	}
1236
#endif
1242
#endif
1237
1243
1238
	cmd[0] = 0x6F; /* XfrBlock */
1244
	if ((CARDMAN3121 == ccid_descriptor->readerID)
1239
	i2dw(tx_length, cmd+1);	/* APDU length */
1245
	    && (SCARD_PROTOCOL_T1 == ccid_descriptor->cardProtocol))
1240
	cmd[5] = ccid_descriptor->bCurrentSlotIndex;	/* slot number */
1246
	{
1241
	cmd[6] = (*ccid_descriptor->pbSeq)++;
1247
		cmd[0] = 0x6B; 					/* Escape */
1242
	cmd[7] = bBWI;	/* extend block waiting timeout */
1248
		i2dw(tx_length+1, cmd+1);			/* APDU length */
1243
	cmd[8] = rx_length & 0xFF;	/* Expected length, in character mode only */
1249
		cmd[5] = ccid_descriptor->bCurrentSlotIndex;	/* slot number */
1244
	cmd[9] = (rx_length >> 8) & 0xFF;
1250
		cmd[6] = (*ccid_descriptor->pbSeq)++;
1251
		cmd[7] = cmd[8] = cmd[9] = 0x00; 		/* RFU */
1252
		cmd[10] = 0x1A; 				/* custom cmd "send TPDU" */
1253
1254
		cmdlen = 11;
1255
	}
1256
	else
1257
	{
1258
		cmd[0] = 0x6F; /* XfrBlock */
1259
		i2dw(tx_length, cmd+1);	/* APDU length */
1260
		cmd[5] = ccid_descriptor->bCurrentSlotIndex;	/* slot number */
1261
		cmd[6] = (*ccid_descriptor->pbSeq)++;
1262
		cmd[7] = bBWI;	/* extend block waiting timeout */
1263
		cmd[8] = rx_length & 0xFF;	/* Expected length, in character mode only */
1264
		cmd[9] = (rx_length >> 8) & 0xFF;
1265
1266
		cmdlen = 10;
1267
	}
1245
1268
1246
	memcpy(cmd+10, tx_buffer, tx_length);
1269
	memcpy(cmd+cmdlen, tx_buffer, tx_length);
1247
1270
1248
	ret = WritePort(reader_index, 10+tx_length, cmd);
1271
	ret = WritePort(reader_index, cmdlen+tx_length, cmd);
1249
	CHECK_STATUS(ret)
1272
	CHECK_STATUS(ret)
1250
1273
1251
	return IFD_SUCCESS;
1274
	return IFD_SUCCESS;
Lines 1260-1266 RESPONSECODE CCID_Transmit(unsigned int Link Here
1260
RESPONSECODE CCID_Receive(unsigned int reader_index, unsigned int *rx_length,
1283
RESPONSECODE CCID_Receive(unsigned int reader_index, unsigned int *rx_length,
1261
	unsigned char rx_buffer[], unsigned char *chain_parameter)
1284
	unsigned char rx_buffer[], unsigned char *chain_parameter)
1262
{
1285
{
1263
	unsigned char cmd[10+CMD_BUF_SIZE];	/* CCID + APDU buffer */
1286
	unsigned char cmd[11+CMD_BUF_SIZE];	/* CCID + APDU buffer */
1264
	unsigned int length;
1287
	unsigned int length;
1265
	RESPONSECODE return_value = IFD_SUCCESS;
1288
	RESPONSECODE return_value = IFD_SUCCESS;
1266
	status_t ret;
1289
	status_t ret;
Lines 1453-1459 time_request: Link Here
1453
1476
1454
	length = dw2i(cmd, 1);
1477
	length = dw2i(cmd, 1);
1455
	if (length <= *rx_length)
1478
	if (length <= *rx_length)
1479
	{
1456
		*rx_length = length;
1480
		*rx_length = length;
1481
1482
		if ((CARDMAN3121 == ccid_descriptor->readerID)
1483
		    && (SCARD_PROTOCOL_T1 == ccid_descriptor->cardProtocol))
1484
			*rx_length--;
1485
	}
1457
	else
1486
	else
1458
	{
1487
	{
1459
		DEBUG_CRITICAL2("overrun by %d bytes", length - *rx_length);
1488
		DEBUG_CRITICAL2("overrun by %d bytes", length - *rx_length);
Lines 1468-1474 time_request: Link Here
1468
		return_value = IFD_COMMUNICATION_ERROR;
1497
		return_value = IFD_COMMUNICATION_ERROR;
1469
	}
1498
	}
1470
	else
1499
	else
1471
		memcpy(rx_buffer, cmd+10, length);
1500
	{
1501
		if ((CARDMAN3121 == ccid_descriptor->readerID)
1502
		    && (SCARD_PROTOCOL_T1 == ccid_descriptor->cardProtocol))
1503
			memcpy(rx_buffer, cmd+11, length-1);
1504
		else
1505
			memcpy(rx_buffer, cmd+10, length);
1506
	}
1472
1507
1473
	/* Extended case?
1508
	/* Extended case?
1474
	 * Only valid for RDR_to_PC_DataBlock frames */
1509
	 * Only valid for RDR_to_PC_DataBlock frames */
Lines 1650-1655 static RESPONSECODE CmdXfrBlockTPDU_T0(u Link Here
1650
		}
1685
		}
1651
		else
1686
		else
1652
#endif
1687
#endif
1688
		if (CARDMAN3121 == ccid_descriptor->readerID)
1689
		{
1690
			DEBUG_CRITICAL3("Ignoring dwMaxCCDMessageLength (tx=%d, max=%d)",
1691
				tx_length, ccid_descriptor->dwMaxCCIDMessageLength-10);
1692
		}
1693
		else
1653
		{
1694
		{
1654
			DEBUG_CRITICAL3("Command too long (%d bytes) for max: %d bytes",
1695
			DEBUG_CRITICAL3("Command too long (%d bytes) for max: %d bytes",
1655
				tx_length, ccid_descriptor->dwMaxCCIDMessageLength-10);
1696
				tx_length, ccid_descriptor->dwMaxCCIDMessageLength-10);

Return to bug 474406