From 74210d7af04e169a8fe061fb88598a3dfeba93fe Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Sun, 30 Oct 2022 23:41:56 +0100 Subject: [PATCH] Fix chaining more than 2 chunks. Signed-off-by: Pol Henarejos --- src/apdu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/apdu.c b/src/apdu.c index 4699114..3902a01 100644 --- a/src/apdu.c +++ b/src/apdu.c @@ -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 {