Fix chaining more than 2 chunks.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2022-10-30 23:41:56 +01:00
parent b2c2980d73
commit 74210d7af0
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3

View file

@ -90,6 +90,10 @@ size_t apdu_process(const uint8_t *buffer, size_t buffer_size) {
*(uint16_t *)rdata_gr = rdata_bk;
if (apdu.rlen <= apdu.ne) {
driver_exec_finished_cont(apdu.rlen+2, rdata_gr-usb_get_tx());
//Prepare next RAPDU
apdu.sw = 0;
apdu.rlen = 0;
usb_prepare_response();
}
else {
rdata_gr += apdu.ne;
@ -102,10 +106,6 @@ size_t apdu_process(const uint8_t *buffer, size_t buffer_size) {
driver_exec_finished_cont(apdu.ne+2, rdata_gr-apdu.ne-usb_get_tx());
apdu.rlen -= apdu.ne;
}
//Prepare next RAPDU
apdu.sw = 0;
apdu.rlen = 0;
usb_prepare_response();
return 0;
}
else {