diff --git a/src/apdu.c b/src/apdu.c index aa69c4c..ac2274f 100644 --- a/src/apdu.c +++ b/src/apdu.c @@ -72,7 +72,7 @@ uint16_t apdu_process(uint8_t itf, const uint8_t *buffer, uint16_t buffer_size) if (buffer_size == 7) { apdu.ne = (apdu.header[5] << 8) | apdu.header[6]; if (apdu.ne == 0) { - //apdu.ne = 65536; // All underlying architecture assumes payloads are 65535 as max + apdu.ne = 65536; } } else { @@ -82,7 +82,7 @@ uint16_t apdu_process(uint8_t itf, const uint8_t *buffer, uint16_t buffer_size) if (apdu.nc + 7 + 2 == buffer_size) { apdu.ne = (apdu.header[buffer_size - 2] << 8) | apdu.header[buffer_size - 1]; if (apdu.ne == 0) { - //apdu.ne = 65536; + apdu.ne = 65536; } } } diff --git a/src/apdu.h b/src/apdu.h index afeb1c0..a68c7cb 100644 --- a/src/apdu.h +++ b/src/apdu.h @@ -83,8 +83,8 @@ extern app_t *current_app; PACK(struct apdu { uint8_t *header; - uint16_t nc; - uint16_t ne; + uint32_t nc; + uint32_t ne; uint8_t *data; uint16_t sw; uint8_t *rdata; diff --git a/src/usb/emulation/emulation.c b/src/usb/emulation/emulation.c index f93943d..66a8645 100644 --- a/src/usb/emulation/emulation.c +++ b/src/usb/emulation/emulation.c @@ -264,7 +264,7 @@ int driver_process_usb_packet_emul(uint8_t itf, uint16_t len) { apdu_finish(); if (sent > 0) { uint16_t ret = apdu_next(); - DEBUG_PAYLOAD(rdata, ret); + DEBUG_PAYLOAD(apdu.rdata, ret); emul_write(itf, ret); } }