laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/42049?usp=email )

Change subject: fix wait time extension handling
......................................................................

fix wait time extension handling

wait time ext byte was mishandled as sw1 and sw2, which broke transfers that 
took a long time, i.e. crypto ops during esim interactions.

Closes: SYS#7869
Change-Id: I7527a4337ae857b9b2a4e982606fac770e677d73
---
M ccid_common/iso7816_fsm.c
1 file changed, 14 insertions(+), 6 deletions(-)

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




diff --git a/ccid_common/iso7816_fsm.c b/ccid_common/iso7816_fsm.c
index 7b0ea5f..a035148 100644
--- a/ccid_common/iso7816_fsm.c
+++ b/ccid_common/iso7816_fsm.c
@@ -1488,12 +1488,19 @@
        case ISO7816_E_RX_SINGLE:
                byte = get_rx_byte_evt(fi->proc.parent, data);
                LOGPFSML(fi, LOGL_DEBUG, "Received 0x%02x from UART\n", byte);
-               /* record byte */
-               //msgb_apdu_sw(tfp->apdu) = byte << 8;
-               msgb_put_u8(tfp->tpdu, byte);
-               card_uart_set_rx_threshold(ip->uart, 1);
-               card_uart_ctrl(ip->uart, CUART_CTL_RX_TIMER_HINT, 1);
-               osmo_fsm_inst_state_chg(fi, TPDU_S_SW2, 0, 0);
+               if (byte == 0x60) {
+                       /* NULL: wait for actual SW1 */
+                       card_uart_set_rx_threshold(ip->uart, 1);
+                       card_uart_ctrl(ip->uart, CUART_CTL_RX_TIMER_HINT, 1);
+                       osmo_fsm_inst_state_chg(fi, TPDU_S_SW1, 0, 0);
+               } else {
+                       /* record byte */
+                       //msgb_apdu_sw(tfp->apdu) = byte << 8;
+                       msgb_put_u8(tfp->tpdu, byte);
+                       card_uart_set_rx_threshold(ip->uart, 1);
+                       card_uart_ctrl(ip->uart, CUART_CTL_RX_TIMER_HINT, 1);
+                       osmo_fsm_inst_state_chg(fi, TPDU_S_SW2, 0, 0);
+               }
                break;
        default:
                OSMO_ASSERT(0);
@@ -1615,6 +1622,7 @@
                .name = "SW1",
                .in_event_mask = S(ISO7816_E_RX_SINGLE),
                .out_state_mask = S(TPDU_S_INIT) |
+                                 S(TPDU_S_SW1) |
                                  S(TPDU_S_SW2),
                .action = tpdu_s_sw1_action,
        },

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

Gerrit-MessageType: merged
Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: I7527a4337ae857b9b2a4e982606fac770e677d73
Gerrit-Change-Number: 42049
Gerrit-PatchSet: 4
Gerrit-Owner: Hoernchen <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: jolly <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>

Reply via email to