mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-06-10 11:59:05 +02:00
Fixed chained response.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
13
src/apdu.c
13
src/apdu.c
@@ -47,7 +47,6 @@ int process_apdu() {
|
|||||||
memcpy(apdu.data, chain_buf, chain_ptr - chain_buf);
|
memcpy(apdu.data, chain_buf, chain_ptr - chain_buf);
|
||||||
apdu.nc += chain_ptr - chain_buf;
|
apdu.nc += chain_ptr - chain_buf;
|
||||||
is_chaining = false;
|
is_chaining = false;
|
||||||
DEBUG_DATA(apdu.data, apdu.nc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (INS(apdu) == 0xA4 && P1(apdu) == 0x04 && (P2(apdu) == 0x00 || P2(apdu) == 0x4)) { //select by AID
|
if (INS(apdu) == 0xA4 && P1(apdu) == 0x04 && (P2(apdu) == 0x00 || P2(apdu) == 0x4)) { //select by AID
|
||||||
@@ -131,16 +130,16 @@ uint16_t apdu_process(uint8_t itf, const uint8_t *buffer, uint16_t buffer_size)
|
|||||||
#ifndef ENABLE_EMULATION
|
#ifndef ENABLE_EMULATION
|
||||||
#ifdef USB_ITF_HID
|
#ifdef USB_ITF_HID
|
||||||
if (itf == ITF_HID) {
|
if (itf == ITF_HID) {
|
||||||
driver_exec_finished_cont_hid(apdu.rlen + 2, rdata_gr - usb_get_tx(itf));
|
driver_exec_finished_cont_hid(apdu.rlen + 2, rdata_gr - (usb_get_tx(itf) + 34));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef USB_ITF_CCID
|
#ifdef USB_ITF_CCID
|
||||||
if (itf == ITF_CCID || itf == ITF_WCID) {
|
if (itf == ITF_CCID || itf == ITF_WCID) {
|
||||||
driver_exec_finished_cont_ccid(itf, apdu.rlen + 2, rdata_gr - usb_get_tx(itf));
|
driver_exec_finished_cont_ccid(itf, apdu.rlen + 2, rdata_gr - (usb_get_tx(itf) + 34));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
driver_exec_finished_cont_emul(itf, apdu.rlen + 2, (uint16_t)(rdata_gr - usb_get_tx(itf)));
|
driver_exec_finished_cont_emul(itf, apdu.rlen + 2, (uint16_t)(rdata_gr - (usb_get_tx(itf)) + 34));
|
||||||
#endif
|
#endif
|
||||||
//Prepare next RAPDU
|
//Prepare next RAPDU
|
||||||
apdu.sw = 0;
|
apdu.sw = 0;
|
||||||
@@ -160,16 +159,16 @@ uint16_t apdu_process(uint8_t itf, const uint8_t *buffer, uint16_t buffer_size)
|
|||||||
#ifndef ENABLE_EMULATION
|
#ifndef ENABLE_EMULATION
|
||||||
#ifdef USB_ITF_HID
|
#ifdef USB_ITF_HID
|
||||||
if (itf == ITF_HID) {
|
if (itf == ITF_HID) {
|
||||||
driver_exec_finished_cont_hid(apdu.ne + 2, rdata_gr - apdu.ne - usb_get_tx(itf));
|
driver_exec_finished_cont_hid(apdu.ne + 2, rdata_gr - apdu.ne - (usb_get_tx(itf) + 34));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef USB_ITF_CCID
|
#ifdef USB_ITF_CCID
|
||||||
if (itf == ITF_CCID || itf == ITF_WCID) {
|
if (itf == ITF_CCID || itf == ITF_WCID) {
|
||||||
driver_exec_finished_cont_ccid(itf, apdu.ne + 2, rdata_gr - apdu.ne - usb_get_tx(itf));
|
driver_exec_finished_cont_ccid(itf, apdu.ne + 2, rdata_gr - apdu.ne - (usb_get_tx(itf) + 34));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
driver_exec_finished_cont_emul(itf, (uint16_t)(apdu.ne + 2), (uint16_t)(rdata_gr - apdu.ne - usb_get_tx(itf)));
|
driver_exec_finished_cont_emul(itf, (uint16_t)(apdu.ne + 2), (uint16_t)(rdata_gr - apdu.ne - (usb_get_tx(itf) + 34)));
|
||||||
#endif
|
#endif
|
||||||
apdu.rlen -= (uint16_t)apdu.ne;
|
apdu.rlen -= (uint16_t)apdu.ne;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user