Another fix with RAPDU in C0.
A STATUS_SLOT may be sent in between of consecutive C0. Thus, RAPDU shall be reset on every answer, even if it is partial. Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
f44658eb63
commit
fe53f9a729
1 changed files with 8 additions and 8 deletions
|
|
@ -261,9 +261,9 @@ static int usb_event_handle() {
|
|||
apdu.ne = 256;
|
||||
}
|
||||
}
|
||||
//printf("apdu.nc %d, apdu.ne %d\r\n",apdu.nc,apdu.ne);
|
||||
//printf("apdu.nc %ld, apdu.ne %ld\r\n",apdu.nc,apdu.ne);
|
||||
if (apdu.header[1] == 0xc0) {
|
||||
//printf("apdu.ne %d, apdu.rlen %d, bk %x\r\n",apdu.ne,apdu.rlen,rdata_bk);
|
||||
//printf("apdu.ne %ld, apdu.rlen %d, bk %x\r\n",apdu.ne,apdu.rlen,rdata_bk);
|
||||
timeout = 0;
|
||||
ccid_response = (struct ccid_header *)(rdata_gr-10);
|
||||
*(uint16_t *)rdata_gr = rdata_bk;
|
||||
|
|
@ -275,11 +275,6 @@ static int usb_event_handle() {
|
|||
ccid_response->abRFU0 = ccid_status;
|
||||
ccid_response->abRFU1 = 0;
|
||||
ccid_write_offset(apdu.rlen+2, rdata_gr-10-usb_get_tx());
|
||||
//Ended. Prepare next RAPDU
|
||||
apdu.sw = 0;
|
||||
apdu.rlen = 0;
|
||||
ccid_response = (struct ccid_header *)usb_get_tx();
|
||||
ccid_response->apdu = usb_get_tx()+10;
|
||||
}
|
||||
else {
|
||||
ccid_response->bMessageType = CCID_DATA_BLOCK_RET;
|
||||
|
|
@ -295,9 +290,14 @@ static int usb_event_handle() {
|
|||
rdata_gr[1] = 0;
|
||||
else
|
||||
rdata_gr[1] = apdu.rlen - apdu.ne;
|
||||
ccid_write_offset(apdu.ne+2, rdata_gr-10-usb_get_tx());
|
||||
ccid_write_offset(apdu.ne+2, rdata_gr-10-apdu.ne-usb_get_tx());
|
||||
apdu.rlen -= apdu.ne;
|
||||
}
|
||||
//Prepare next RAPDU
|
||||
apdu.sw = 0;
|
||||
apdu.rlen = 0;
|
||||
ccid_response = (struct ccid_header *)usb_get_tx();
|
||||
ccid_response->apdu = usb_get_tx()+10;
|
||||
}
|
||||
else {
|
||||
apdu.sw = 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue