Change in osmo-ccid-firmware[master]: t0: fix wtime calculation, for real this time

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
Sun Oct 18 10:37:29 UTC 2020


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

Change subject: t0: fix wtime calculation, for real this time
......................................................................

t0: fix wtime calculation, for real this time

ETU calculation is 1 etu = fi/di * 1/f as per chapter 7.1.

wtime/WWT is usually mentioned as being 9600 etu in iso 7816-3 - but
it's actually specified for t=0 as WT=WI*960*Fi/f in chapter 10.2 - no
di involved here, so the rightmost fraction is not ETU!

-> as soon as di is not 1 after a pps exchange the timeout value was off
by a factor of di if it was just used as a multiplier for ETU.

Change-Id: Icd4fa83e1177873e90200529331d3a1fce8be1c6
---
M ccid_common/ccid_slot_fsm.c
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/ccid_common/ccid_slot_fsm.c b/ccid_common/ccid_slot_fsm.c
index 2338919..18aa61f 100644
--- a/ccid_common/ccid_slot_fsm.c
+++ b/ccid_common/ccid_slot_fsm.c
@@ -246,6 +246,7 @@
 		uint16_t F = iso7816_3_fi_table[cs->proposed_pars.fi];
 		uint8_t D = iso7816_3_di_table[cs->proposed_pars.di];
 		uint32_t fmax = iso7816_3_fmax_table[cs->proposed_pars.fi];
+		uint8_t D_or_one = D > 0 ? D : 1;
 
 		/* 7816-3 5.2.3
 		 * No  information  shall  be  exchanged  when  switching  the
@@ -256,7 +257,7 @@
 		 */
 		card_uart_ctrl(ss->cuart, CUART_CTL_SET_CLOCK_FREQ, fmax);
 		card_uart_ctrl(ss->cuart, CUART_CTL_SET_FD, F/D);
-		card_uart_ctrl(ss->cuart, CUART_CTL_WTIME, cs->proposed_pars.t0.waiting_integer * 960);
+		card_uart_ctrl(ss->cuart, CUART_CTL_WTIME, cs->proposed_pars.t0.waiting_integer * 960 * D_or_one);
 
 		cs->pars = cs->proposed_pars;
 		resp = ccid_gen_parameters_t0(cs, ss->seq, CCID_CMD_STATUS_OK, 0);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/20691
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: Icd4fa83e1177873e90200529331d3a1fce8be1c6
Gerrit-Change-Number: 20691
Gerrit-PatchSet: 2
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
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/20201018/8b903200/attachment.htm>


More information about the gerrit-log mailing list