This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/19460 ) Change subject: Fix returned data in case of command TPDU ...................................................................... Fix returned data in case of command TPDU When Lc>0 (command TPDU), our response always copied the command data in front of the response (which is a SW of 2 bytes in this case). This of course confuses the hell out of users. The response to a Lc>0 TPDU should be just the two-bytes status word. Introduce the use of msgb->l4h for the point in the buffer from where we receive data from the card. all bytes before l4h are transmitted to the card. Change-Id: Ie3fc7437d39dc330b9f2b7d7960ad2560b6be4b7 --- M ccid_common/ccid_slot_fsm.c M ccid_common/iso7816_fsm.c 2 files changed, 5 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/ccid_common/ccid_slot_fsm.c b/ccid_common/ccid_slot_fsm.c index 747fef3..4bd1b0d 100644 --- a/ccid_common/ccid_slot_fsm.c +++ b/ccid_common/ccid_slot_fsm.c @@ -172,7 +172,7 @@ tpdu = data; LOGPCS(cs, LOGL_DEBUG, "%s(event=%d, data=%s)\n", __func__, event, msgb_hexdump(tpdu)); - resp = ccid_gen_data_block(cs, ss->seq, CCID_CMD_STATUS_OK, 0, msgb_l2(tpdu), msgb_l2len(tpdu)); + resp = ccid_gen_data_block(cs, ss->seq, CCID_CMD_STATUS_OK, 0, msgb_l4(tpdu), msgb_l4len(tpdu)); ccid_slot_send_unbusy(cs, resp); msgb_free(tpdu); cs->event = 0; diff --git a/ccid_common/iso7816_fsm.c b/ccid_common/iso7816_fsm.c index c76d97d..2796d30 100644 --- a/ccid_common/iso7816_fsm.c +++ b/ccid_common/iso7816_fsm.c @@ -1175,9 +1175,13 @@ /* start transmission of a TPDU by sending the 5-byte header */ tfp->tpdu = (struct msgb *)data; OSMO_ASSERT(msgb_length(tfp->tpdu) >= sizeof(*tpduh)); + /* l2h = after the 5byte header */ tfp->tpdu->l2h = msgb_data(tfp->tpdu) + sizeof(*tpduh); + /* l4h = where we start to receive from the card */ + tfp->tpdu->l4h = msgb_l2(tfp->tpdu) + msgb_l2len(tfp->tpdu); if (msgb_l2len(tfp->tpdu)) { tfp->is_command = true; + /* l3h = used as 'next byte to write' pointer */ tfp->tpdu->l3h = tfp->tpdu->l2h; /* next tx byte == first byte of body */ } else tfp->is_command = false; -- To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/19460 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-Change-Id: Ie3fc7437d39dc330b9f2b7d7960ad2560b6be4b7 Gerrit-Change-Number: 19460 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200730/0e2385d2/attachment.htm>