Change in osmo-ccid-firmware[master]: iso7816_fsm: Fix TPDUs wih Le == 1 (single byte reads)

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.org
Wed Sep 2 18:15:35 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/19947 )

Change subject: iso7816_fsm: Fix TPDUs wih Le == 1 (single byte reads)
......................................................................

iso7816_fsm: Fix TPDUs wih Le == 1 (single byte reads)

If we expect only a single byte in response to the TPDU header,
the cuart driver sends us RX_SINGLE events, not RX_COMPLETE events.

Change-Id: I3f025bc88b9aacc07ae87307328cec56efbac2ab
Closes: OS#4741
---
M ccid_common/iso7816_fsm.c
1 file changed, 8 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/ccid_common/iso7816_fsm.c b/ccid_common/iso7816_fsm.c
index 307dac3..02e7c0d 100644
--- a/ccid_common/iso7816_fsm.c
+++ b/ccid_common/iso7816_fsm.c
@@ -1273,7 +1273,12 @@
 			} else {
 				card_uart_set_rx_threshold(ip->uart, tpduh->p3);
 				card_uart_ctrl(ip->uart, CUART_CTL_RX_TIMER_HINT, tpduh->p3);
-				osmo_fsm_inst_state_chg(fi, TPDU_S_RX_REMAINING, 0, 0);
+				/* if the expected length is only one byte, cuart will issue
+				 * TPDU_S_RX_SINGLE instead of TPDU_S_RX_REMAINING (OS#4741) */
+				if (tpduh->p3 == 1)
+					osmo_fsm_inst_state_chg(fi, TPDU_S_RX_SINGLE, 0, 0);
+				else
+					osmo_fsm_inst_state_chg(fi, TPDU_S_RX_REMAINING, 0, 0);
 			}
 		} else if (byte == (tpduh->ins ^ 0xFF)) {
 			/* transmit/recieve single byte then wait for proc */
@@ -1521,7 +1526,8 @@
 		.name = "RX_SINGLE",
 		.in_event_mask = S(ISO7816_E_RX_SINGLE),
 		.out_state_mask = S(TPDU_S_INIT) |
-				  S(TPDU_S_PROCEDURE),
+				  S(TPDU_S_PROCEDURE) |
+				  S(TPDU_S_SW1),
 		.action = tpdu_s_rx_single_action,
 	},
 	[TPDU_S_SW1] = {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/19947
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: I3f025bc88b9aacc07ae87307328cec56efbac2ab
Gerrit-Change-Number: 19947
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/20200902/ffd4177f/attachment.htm>


More information about the gerrit-log mailing list