mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-31 16:23:02 +01:00
Support extended APDU exchange level somehow.
* ccid-driver.c (ccid_transceive_apdu_level): Permit sending packet where apdulen <= 289. Support receiving packets in a chain.
This commit is contained in:
parent
239659d3a0
commit
37fadead90
@ -2590,8 +2590,8 @@ ccid_transceive_apdu_level (ccid_driver_t handle,
|
|||||||
|
|
||||||
/* The maximum length for a short APDU T=1 block is 261. For an
|
/* The maximum length for a short APDU T=1 block is 261. For an
|
||||||
extended APDU T=1 block the maximum length 65544; however
|
extended APDU T=1 block the maximum length 65544; however
|
||||||
extended APDU exchange level is not yet supported. */
|
extended APDU exchange level is not fully supported yet. */
|
||||||
if (apdulen > 261)
|
if (apdulen > 289)
|
||||||
return CCID_DRIVER_ERR_INV_VALUE; /* Invalid length. */
|
return CCID_DRIVER_ERR_INV_VALUE; /* Invalid length. */
|
||||||
|
|
||||||
msg[0] = PC_to_RDR_XfrBlock;
|
msg[0] = PC_to_RDR_XfrBlock;
|
||||||
@ -2614,8 +2614,51 @@ ccid_transceive_apdu_level (ccid_driver_t handle,
|
|||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
if (msg[9] == 1)
|
||||||
|
{
|
||||||
|
size_t total_msglen = msglen;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
unsigned char status;
|
||||||
|
|
||||||
|
msg = recv_buffer + total_msglen;
|
||||||
|
|
||||||
|
msg[0] = PC_to_RDR_XfrBlock;
|
||||||
|
msg[5] = 0; /* slot */
|
||||||
|
msg[6] = seqno = handle->seqno++;
|
||||||
|
msg[7] = bwi; /* bBWI */
|
||||||
|
msg[8] = 0x10; /* Request next data block */
|
||||||
|
msg[9] = 0;
|
||||||
|
set_msg_len (msg, 0);
|
||||||
|
msglen = 10;
|
||||||
|
|
||||||
|
rc = bulk_out (handle, msg, msglen, 0);
|
||||||
|
if (rc)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
rc = bulk_in (handle, msg, sizeof recv_buffer - total_msglen, &msglen,
|
||||||
|
RDR_to_PC_DataBlock, seqno, 5000, 0);
|
||||||
|
if (rc)
|
||||||
|
return rc;
|
||||||
|
status = msg[9];
|
||||||
|
memmove (msg, msg+10, msglen - 10);
|
||||||
|
total_msglen += msglen - 10;
|
||||||
|
if (total_msglen >= sizeof recv_buffer)
|
||||||
|
return CCID_DRIVER_ERR_OUT_OF_CORE;
|
||||||
|
|
||||||
|
if (status == 0x02)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
apdu = recv_buffer + 10;
|
||||||
|
apdulen = total_msglen - 10;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
apdu = msg + 10;
|
apdu = msg + 10;
|
||||||
apdulen = msglen - 10;
|
apdulen = msglen - 10;
|
||||||
|
}
|
||||||
|
|
||||||
if (resp)
|
if (resp)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user