lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/simtrace2/+/43128?usp=email )

 (

1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
 )Change subject: firmware: card_emu: fix 7816-3 10.3.2 0=256 case
......................................................................

firmware: card_emu: fix 7816-3 10.3.2 0=256 case

add_tpdu_byte() accumulates bytes received from the reader, but passes
reader_to_card = 0, but ISO 7816-3 10.3.2 says P3 == 0 means 256 not 0

Only reachable with P3 == 0 in a receive data phase, but
simtrace2-cardem-pcsc only requests PB_AND_RX when there is command data.

Fix this anyway.

Change-Id: I0fa4741bc1293549816595e6b4e8af9e22bcfbc1
---
M firmware/libcommon/source/card_emu.c
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  lynxis lazus: Looks good to me, approved




diff --git a/firmware/libcommon/source/card_emu.c 
b/firmware/libcommon/source/card_emu.c
index a1d4483..72da9d8 100644
--- a/firmware/libcommon/source/card_emu.c
+++ b/firmware/libcommon/source/card_emu.c
@@ -745,7 +745,8 @@
 {
        struct msgb *msg;
        struct cardemu_usb_msg_rx_data *rd;
-       unsigned int num_data_bytes = t0_num_data_bytes(ch->tpdu.hdr[_P3], 0);
+       /* these are bytes the reader sends to us, so P3 is a literal count */
+       unsigned int num_data_bytes = t0_num_data_bytes(ch->tpdu.hdr[_P3], 1);

        /* ensure we have a buffer */
        if (!ch->uart_rx_msg) {

--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/43128?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I0fa4741bc1293549816595e6b4e8af9e22bcfbc1
Gerrit-Change-Number: 43128
Gerrit-PatchSet: 3
Gerrit-Owner: Hoernchen <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: lynxis lazus <[email protected]>

Reply via email to