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/.
Hoernchen gerrit-no-reply at lists.osmocom.orgHoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/20063 ) Change subject: ccid fsm: handle special 0 == 256 byte value ...................................................................... ccid fsm: handle special 0 == 256 byte value Outgoing (=from the card) transfers have a special 0 == 256 byte meaning. Change-Id: Ifb960b3e0f221962e977083f7ddea14dd0c8f29b --- M ccid_common/iso7816_fsm.c 1 file changed, 11 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/63/20063/1 diff --git a/ccid_common/iso7816_fsm.c b/ccid_common/iso7816_fsm.c index 3e78fc8..6e39142 100644 --- a/ccid_common/iso7816_fsm.c +++ b/ccid_common/iso7816_fsm.c @@ -1246,6 +1246,8 @@ struct osmo_fsm_inst *parent_fi = fi->proc.parent; struct iso7816_3_priv *ip = get_iso7816_3_priv(parent_fi); uint8_t byte; + /* 7816-3 10.3.2 special case outgoing transfer 0 means 256 */ + int special_rx_val = tpduh->p3 == 0 ? 256 : tpduh->p3; switch (event) { case ISO7816_E_RX_SINGLE: @@ -1276,11 +1278,11 @@ card_uart_tx(ip->uart, msgb_l2(tfp->tpdu), msgb_l2len(tfp->tpdu), true); osmo_fsm_inst_state_chg(fi, TPDU_S_TX_REMAINING, 0, 0); } else { - card_uart_set_rx_threshold(ip->uart, tpduh->p3); - card_uart_ctrl(ip->uart, CUART_CTL_RX_TIMER_HINT, tpduh->p3); + card_uart_set_rx_threshold(ip->uart, special_rx_val); + card_uart_ctrl(ip->uart, CUART_CTL_RX_TIMER_HINT, special_rx_val); /* 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) + if (special_rx_val == 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); @@ -1357,14 +1359,17 @@ struct iso7816_3_priv *ip = get_iso7816_3_priv(parent_fi); int rc; + /* 7816-3 10.3.2 special case outgoing transfer 0 means 256 */ + int special_rx_val = tpduh->p3 == 0 ? 256 : tpduh->p3; + switch (event) { case ISO7816_E_RX_COMPL: /* retrieve pending byte(s) */ - rc = card_uart_rx(ip->uart, msgb_l2(tfp->tpdu), tpduh->p3); + rc = card_uart_rx(ip->uart, msgb_l2(tfp->tpdu), special_rx_val); OSMO_ASSERT(rc > 0); msgb_put(tfp->tpdu, rc); - if (msgb_l2len(tfp->tpdu) != tpduh->p3) { - LOGPFSML(fi, LOGL_ERROR, "expected %u bytes; read %d\n", tpduh->p3, + if (msgb_l2len(tfp->tpdu) != special_rx_val) { + LOGPFSML(fi, LOGL_ERROR, "expected %u bytes; read %d\n", special_rx_val, msgb_l2len(tfp->tpdu)); } card_uart_set_rx_threshold(ip->uart, 1); -- To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/20063 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: Ifb960b3e0f221962e977083f7ddea14dd0c8f29b Gerrit-Change-Number: 20063 Gerrit-PatchSet: 1 Gerrit-Owner: Hoernchen <ewild at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200910/c29b8a42/attachment.htm>