<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/simtrace2/+/23636">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Revert "add library providing ISO 7816-3 utilities"<br><br>This reverts commit 4a29f64cbe12ca9fbddd66ae10b614388fef5e9b.<br><br>The code replicates to a large extent what is already present in iso7816_fidi.c<br>and I have serious doubts about the correctness of the computation in<br>its iso7816_3_calculate_wt() function.<br><br>Change-Id: I80dab4401d13306d573a6a35ce8729d2acc141e4<br>---<br>D firmware/libcommon/include/iso7816_3.h<br>D firmware/libcommon/source/iso7816_3.c<br>2 files changed, 0 insertions(+), 229 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/36/23636/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/firmware/libcommon/include/iso7816_3.h b/firmware/libcommon/include/iso7816_3.h</span><br><span>deleted file mode 100644</span><br><span>index e6c1b4f..0000000</span><br><span>--- a/firmware/libcommon/include/iso7816_3.h</span><br><span>+++ /dev/null</span><br><span>@@ -1,70 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-/*</span><br><span style="color: hsl(0, 100%, 40%);">- * Copyright (C) 2019 sysmocom -s.f.m.c. GmbH, Author: Kevin Redon <kredon@sysmocom.de></span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * This program is free software; you can redistribute it and/or</span><br><span style="color: hsl(0, 100%, 40%);">- * modify it under the terms of the GNU General Public License</span><br><span style="color: hsl(0, 100%, 40%);">- * as published by the Free Software Foundation; either version 2</span><br><span style="color: hsl(0, 100%, 40%);">- * of the License, or (at your option) any later version.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(0, 100%, 40%);">- * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(0, 100%, 40%);">- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(0, 100%, 40%);">- * GNU General Public License for more details.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * You should have received a copy of the GNU General Public License</span><br><span style="color: hsl(0, 100%, 40%);">- * along with this program; if not, write to the Free Software</span><br><span style="color: hsl(0, 100%, 40%);">- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.</span><br><span style="color: hsl(0, 100%, 40%);">-*/</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/* this library provides utilities to handle the ISO-7816 part 3 communication aspects (e.g. related</span><br><span style="color: hsl(0, 100%, 40%);">- * to F and D) */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#pragma once</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#include <stdint.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <stdbool.h></span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! default clock rate conversion integer Fd.</span><br><span style="color: hsl(0, 100%, 40%);">- *  ISO/IEC 7816-3:2006(E) section 8.1 */</span><br><span style="color: hsl(0, 100%, 40%);">-#define ISO7816_3_DEFAULT_FD 372</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! default baud rate adjustment factor Dd.</span><br><span style="color: hsl(0, 100%, 40%);">- *  ISO/IEC 7816-3:2006(E) section 8.1 */</span><br><span style="color: hsl(0, 100%, 40%);">-#define ISO7816_3_DEFAULT_DD 1</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! default clock rate conversion integer Fi.</span><br><span style="color: hsl(0, 100%, 40%);">- *  ISO/IEC 7816-3:2006(E) section 8.3</span><br><span style="color: hsl(0, 100%, 40%);">- *  \note non-default value is optionally specified in TA1 */</span><br><span style="color: hsl(0, 100%, 40%);">-#define ISO7816_3_DEFAULT_FI 372</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! default baud rate adjustment factor Di.</span><br><span style="color: hsl(0, 100%, 40%);">- *  ISO/IEC 7816-3:2006(E) section 8.3</span><br><span style="color: hsl(0, 100%, 40%);">- *  \note non-default value is optionally specified in TA1 */</span><br><span style="color: hsl(0, 100%, 40%);">-#define ISO7816_3_DEFAULT_DI 1</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! default maximum clock frequency, in Hz.</span><br><span style="color: hsl(0, 100%, 40%);">- *  ISO/IEC 7816-3:2006(E) section 8.3</span><br><span style="color: hsl(0, 100%, 40%);">- *  \note non-default value is optionally specified in TA1 */</span><br><span style="color: hsl(0, 100%, 40%);">-#define ISO7816_3_DEFAULT_FMAX 5000000UL</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! default Waiting Integer (WI) value for T=0.</span><br><span style="color: hsl(0, 100%, 40%);">- *  ISO/IEC 7816-3:2006(E) section 10.2</span><br><span style="color: hsl(0, 100%, 40%);">- *  \note non-default value is optionally specified in TC2 */</span><br><span style="color: hsl(0, 100%, 40%);">-#define ISO7816_3_DEFAULT_WI 10</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! default Waiting Time (WT) value, in ETU.</span><br><span style="color: hsl(0, 100%, 40%);">- *  ISO/IEC 7816-3:2006(E) section 8.1</span><br><span style="color: hsl(0, 100%, 40%);">- *  \note depends on Fi, Di, and WI if protocol T=0 is selected */</span><br><span style="color: hsl(0, 100%, 40%);">-#define ISO7816_3_DEFAULT_WT 9600</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-extern const uint16_t iso7816_3_fi_table[];</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-extern const uint32_t iso7816_3_fmax_table[];</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-extern const uint8_t iso7816_3_di_table[];</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-bool iso7816_3_valid_f(uint16_t f);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-bool iso7816_3_valid_d(uint8_t d);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-int32_t iso7816_3_calculate_wt(uint8_t wi, uint16_t fi, uint8_t di, uint16_t f, uint8_t d);</span><br><span>diff --git a/firmware/libcommon/source/iso7816_3.c b/firmware/libcommon/source/iso7816_3.c</span><br><span>deleted file mode 100644</span><br><span>index ccdff68..0000000</span><br><span>--- a/firmware/libcommon/source/iso7816_3.c</span><br><span>+++ /dev/null</span><br><span>@@ -1,159 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-/*</span><br><span style="color: hsl(0, 100%, 40%);">- * Copyright (C) 2019 sysmocom -s.f.m.c. GmbH, Author: Kevin Redon <kredon@sysmocom.de></span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * This program is free software; you can redistribute it and/or</span><br><span style="color: hsl(0, 100%, 40%);">- * modify it under the terms of the GNU General Public License</span><br><span style="color: hsl(0, 100%, 40%);">- * as published by the Free Software Foundation; either version 2</span><br><span style="color: hsl(0, 100%, 40%);">- * of the License, or (at your option) any later version.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(0, 100%, 40%);">- * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(0, 100%, 40%);">- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(0, 100%, 40%);">- * GNU General Public License for more details.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * You should have received a copy of the GNU General Public License</span><br><span style="color: hsl(0, 100%, 40%);">- * along with this program; if not, write to the Free Software</span><br><span style="color: hsl(0, 100%, 40%);">- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.</span><br><span style="color: hsl(0, 100%, 40%);">-*/</span><br><span style="color: hsl(0, 100%, 40%);">-#include <stdint.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <stddef.h></span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#include "utils.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "iso7816_3.h"</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! Table of clock rate conversion integer F indexed by Fi.</span><br><span style="color: hsl(0, 100%, 40%);">- *  \note Fi is indicated in TA1, but the same table is used for F and Fn during PPS</span><br><span style="color: hsl(0, 100%, 40%);">- *  ISO/IEC 7816-3:2006(E) table 7 */</span><br><span style="color: hsl(0, 100%, 40%);">-const uint16_t iso7816_3_fi_table[16] = {</span><br><span style="color: hsl(0, 100%, 40%);">-   372, 372, 558, 744, 1116, 1488, 1860, 0,</span><br><span style="color: hsl(0, 100%, 40%);">-        0, 512, 768, 1024, 1536, 2048, 0, 0</span><br><span style="color: hsl(0, 100%, 40%);">-};</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! Table of maximum clock frequency f_max in Hz indexed by Fi.</span><br><span style="color: hsl(0, 100%, 40%);">- *  ISO/IEC 7816-3:2006(E) table 7</span><br><span style="color: hsl(0, 100%, 40%);">- *  \note f_max is indicated in TA1, but the same table is used for F and Fn during PPS */</span><br><span style="color: hsl(0, 100%, 40%);">-const uint32_t iso7816_3_fmax_table[16] = {</span><br><span style="color: hsl(0, 100%, 40%);">-     4000000, 5000000, 6000000, 8000000, 12000000, 16000000, 20000000, 0,</span><br><span style="color: hsl(0, 100%, 40%);">-    0, 5000000, 7500000, 10000000, 15000000, 20000000, 0, 0</span><br><span style="color: hsl(0, 100%, 40%);">-};</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! Table encoding the baud rate adjust integer D indexed by Di.</span><br><span style="color: hsl(0, 100%, 40%);">- *  ISO/IEC 7816-3:2006(E) table 8</span><br><span style="color: hsl(0, 100%, 40%);">- *  \note Di is indicated in TA1, but the same table is used for D and Dn during PPS */</span><br><span style="color: hsl(0, 100%, 40%);">-const uint8_t iso7816_3_di_table[16] = {</span><br><span style="color: hsl(0, 100%, 40%);">-      0, 1, 2, 4, 8, 16, 32, 64,</span><br><span style="color: hsl(0, 100%, 40%);">-      12, 20, 0, 0, 0, 0, 0, 0,</span><br><span style="color: hsl(0, 100%, 40%);">-};</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/* All values are based on the Elementary Time Unit (ETU), defined in ISO/IEC 7816-3 section 7.1</span><br><span style="color: hsl(0, 100%, 40%);">- * this is the time required to transmit a bit, and is calculated as follows:</span><br><span style="color: hsl(0, 100%, 40%);">- *      1 ETU = (F / D) x (1 / f)</span><br><span style="color: hsl(0, 100%, 40%);">- * where:</span><br><span style="color: hsl(0, 100%, 40%);">- * - F is the clock rate conversion integer</span><br><span style="color: hsl(0, 100%, 40%);">- * - D is the baud rate adjustment factor</span><br><span style="color: hsl(0, 100%, 40%);">- * - f is the clock frequency</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * The possible F, f(max), and D values are defined in ISO/IEC 7816-3 table 7 and 8</span><br><span style="color: hsl(0, 100%, 40%);">- * - the initial value for F (after reset) is Fd = 372</span><br><span style="color: hsl(0, 100%, 40%);">- * - the initial value for D (after reset) is Dd = 1</span><br><span style="color: hsl(0, 100%, 40%);">- * - the initial maximum frequency f(max) is 5 MHz</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * The card must measure the ETU based on the clock signal provided by the reader</span><br><span style="color: hsl(0, 100%, 40%);">- * one ETU (e.g. 1 bit) takes F/D clock cycles, which the card must count</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * The card can indicate an alternative set of supported values Fi (with corresponding f(max)) and</span><br><span style="color: hsl(0, 100%, 40%);">- * Di for higher baud rate in TA1 in the ATR (see ISO/IEC 7816-3 section 8.3)</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * These values are selected according to ISO/IEC 7816-3 section 6.3.1:</span><br><span style="color: hsl(0, 100%, 40%);">- * - card in specific mode: they are enforced if TA2 is present (the reader can deactivate the card</span><br><span style="color: hsl(0, 100%, 40%);">- *   if it does not support these values)</span><br><span style="color: hsl(0, 100%, 40%);">- * - card in negotiable mode:</span><br><span style="color: hsl(0, 100%, 40%);">- * -- they can be selected by the reader using the Protocol and Parameters Selection (PPS) procedure</span><br><span style="color: hsl(0, 100%, 40%);">- * -- the first offered protocol and default values are used when no PPS is started</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * PPS is done with Fd and Dd (see ISO/IEC 7816-3 section 9) the reader can propose any F and D</span><br><span style="color: hsl(0, 100%, 40%);">- * values between from Fd to Fi, and from Dd to Di (Fi and Di are indicated in TA1) the in PPS</span><br><span style="color: hsl(0, 100%, 40%);">- * agreed values F and D are called Fn and Dn and are applied after a successful exchange,</span><br><span style="color: hsl(0, 100%, 40%);">- * corresponding to PPS1_Response bit 5</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * The F and D values must be provided to the SAM3S USART peripheral (after reset and PPS)</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! Verify if the clock rate conversion integer F value is valid.</span><br><span style="color: hsl(0, 100%, 40%);">- *  \param[in] f F value to be validated</span><br><span style="color: hsl(0, 100%, 40%);">- *  \return if F value is valid</span><br><span style="color: hsl(0, 100%, 40%);">- *  \note only values in ISO/IEC 7816-3:2006(E) table 7 are valid */</span><br><span style="color: hsl(0, 100%, 40%);">-bool iso7816_3_valid_f(uint16_t f)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-        if (0 == f) {</span><br><span style="color: hsl(0, 100%, 40%);">-           return false;</span><br><span style="color: hsl(0, 100%, 40%);">-   }</span><br><span style="color: hsl(0, 100%, 40%);">-       uint8_t i = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-  for (i = 0; i < ARRAY_SIZE(iso7816_3_fi_table) && iso7816_3_fi_table[i] != f; i++);</span><br><span style="color: hsl(0, 100%, 40%);">-  return (i < ARRAY_SIZE(iso7816_3_fi_table) && iso7816_3_fi_table[i] == f);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! Verify if the baud rate adjustment factor D value is valid.</span><br><span style="color: hsl(0, 100%, 40%);">- *  \param[in] d D value to be validated</span><br><span style="color: hsl(0, 100%, 40%);">- *  \return if D value is valid</span><br><span style="color: hsl(0, 100%, 40%);">- *  \note only values in ISO/IEC 7816-3:2006(E) table 8 are valid */</span><br><span style="color: hsl(0, 100%, 40%);">-bool iso7816_3_valid_d(uint8_t d)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-      if (0 == d) {</span><br><span style="color: hsl(0, 100%, 40%);">-           return false;</span><br><span style="color: hsl(0, 100%, 40%);">-   }</span><br><span style="color: hsl(0, 100%, 40%);">-       uint8_t i = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-  for (i = 0; i < ARRAY_SIZE(iso7816_3_di_table) && iso7816_3_di_table[i] != d; i++);</span><br><span style="color: hsl(0, 100%, 40%);">-  return (i < ARRAY_SIZE(iso7816_3_di_table) && iso7816_3_di_table[i] == d);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/* The ETU is not only used to define the baud rate, but also the Waiting Time (WT) (see ISO/IEC</span><br><span style="color: hsl(0, 100%, 40%);">- * 7816-3 section 8.1)</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * when exceeding WT without card response, the reader flags the card as unresponsive, and resets it</span><br><span style="color: hsl(0, 100%, 40%);">- * this can be used by the card to indicate errors or unsupported operations if the card requires</span><br><span style="color: hsl(0, 100%, 40%);">- * more time to respond, it shall send a procedure byte to restart WT WT is calculated as follows</span><br><span style="color: hsl(0, 100%, 40%);">- * (for T=0, see ISO/IEC 7816-3 section 10.2): WT = WI x 960 x (Fi / f(max)) where</span><br><span style="color: hsl(0, 100%, 40%);">- * - WI is encoded in TC2 in the ATR (10 if absent)</span><br><span style="color: hsl(0, 100%, 40%);">- * - WI does not depend on D/Di (used for the ETU)</span><br><span style="color: hsl(0, 100%, 40%);">- * - after reset WT is 9600 ETU</span><br><span style="color: hsl(0, 100%, 40%);">- * - WI (e.g. the new WT) is applied when T=0 is used (after 6.3.1), even if Fi is not Fn (this WT</span><br><span style="color: hsl(0, 100%, 40%);">- *   extension is important to know for the reader so to have the right timeout)</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! Calculate Waiting Time (WT) in units of ETU.</span><br><span style="color: hsl(0, 100%, 40%);">- *  \param[in] wi Waiting Integer</span><br><span style="color: hsl(0, 100%, 40%);">- *  \param[in] fi clock rate conversion integer Fi value</span><br><span style="color: hsl(0, 100%, 40%);">- *  \param[in] di baud rate adjustment factor Di value</span><br><span style="color: hsl(0, 100%, 40%);">- *  \param[in] f clock rate conversion integer F value</span><br><span style="color: hsl(0, 100%, 40%);">- *  \param[in] d baud rate adjustment factor D value</span><br><span style="color: hsl(0, 100%, 40%);">- *  \return Waiting Time WT, in ETU, or < 0 on error (see code for return codes)</span><br><span style="color: hsl(0, 100%, 40%);">- *  \note this should happen after reset and T=0 protocol select (through PPS or implicit)</span><br><span style="color: hsl(0, 100%, 40%);">- *  ISO/IEC 7816-3:2006(E) section 8.1 and 10.2 */</span><br><span style="color: hsl(0, 100%, 40%);">-int32_t iso7816_3_calculate_wt(uint8_t wi, uint16_t fi, uint8_t di, uint16_t f, uint8_t d)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-      /* sanity checks */</span><br><span style="color: hsl(0, 100%, 40%);">-     if (0 == wi)</span><br><span style="color: hsl(0, 100%, 40%);">-            return -1;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-      if (!iso7816_3_valid_f(fi))</span><br><span style="color: hsl(0, 100%, 40%);">-             return -2;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-      if (!iso7816_3_valid_d(di))</span><br><span style="color: hsl(0, 100%, 40%);">-             return -3;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-      if (!iso7816_3_valid_f(f))</span><br><span style="color: hsl(0, 100%, 40%);">-              return -4;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-      if (!iso7816_3_valid_d(d))</span><br><span style="color: hsl(0, 100%, 40%);">-              return -5;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-      if (f > fi)</span><br><span style="color: hsl(0, 100%, 40%);">-          return -6;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-      if (d > di)</span><br><span style="color: hsl(0, 100%, 40%);">-          return -7;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-      /* see 7816-3 Section 10.2 */</span><br><span style="color: hsl(0, 100%, 40%);">-   return wi * 960UL * (fi/f) * (di/d); // calculate timeout value in ETU</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/simtrace2/+/23636">change 23636</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/simtrace2/+/23636"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: simtrace2 </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I80dab4401d13306d573a6a35ce8729d2acc141e4 </div>
<div style="display:none"> Gerrit-Change-Number: 23636 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>