Hoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/43171?usp=email )
Change subject: tlv: preserve the comprehension bit
......................................................................
tlv: preserve the comprehension bit
The comprehension bit is data, not part of the tag: TS 101 220 7.1.1
defines it as an instruction to the receiver for treating
IEs it does not understand, which is why is_tag_compatible() masks it when
matching -> _encode_tag() re-emits the class tag, but ComprTlvMeta
forces CR, so decode(x)/encode() did not round trip properly
for IEs without the bit set
That is not hypothetical!
GP Amendment B administration session parameters stored by UICCs in an EF
carry the CAT TLVs inside tag 0x84 with the bit mixed:
- set on Command details and Device identities
- clear on the optional ones
That means reading and writing the same data led to not writing the
same data at all!
The cleanest fix here is to tri-state COMPR_TLV_IE.comprehension:
- None for an IE built from scratch which encode as before
- True/False for one parsed from a file which will now properly roundtrip.
_encode_tag() properly passes the flag to comprehensiontlv_encode_tag()
explicitly instead of deriving it from the int:
The int can't express "CR clear" for a one-byte tag at all, and
silently drops the flag for a two-byte one....
While at it fix ComprTlvMeta which would destroy two-byte tags
instead of setting the flag, currently tag=0x8123 -> 0x81a3.
Change-Id: Ifae37785e2a586d9130d154bc7244f35fa6f2a55
---
M src/osmocom/tlv.py
M tests/test_tlv.py
2 files changed, 63 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/python/pyosmocom refs/changes/71/43171/1
diff --git a/src/osmocom/tlv.py b/src/osmocom/tlv.py
index ada7380..9ca8728 100644
--- a/src/osmocom/tlv.py
+++ b/src/osmocom/tlv.py
@@ -635,20 +635,28 @@
if x.tag:
# we currently assume that the tag values always have the comprehension bit set;
# let's fix it up if a derived class has forgotten about that
- if x.tag > 0xff and x.tag & 0x8000 == 0:
- print("Fixing up COMPR_TLV_IE class %s: tag=0x%x has no comprehension bit" % (name, x.tag))
- x.tag = x.tag | 0x8000
+ if x.tag > 0xff:
+ # two byte tag: the comprehension bit is 0x8000!
+ if x.tag & 0x8000 == 0:
+ print("Fixing up COMPR_TLV_IE class %s: tag=0x%x has no comprehension bit" % (name, x.tag))
+ x.tag = x.tag | 0x8000
elif x.tag & 0x80 == 0:
print("Fixing up COMPR_TLV_IE class %s: tag=0x%x has no comprehension bit" % (name, x.tag))
x.tag = x.tag | 0x80
return x
class COMPR_TLV_IE(TLV_IE, metaclass=ComprTlvMeta):
- """TLV_IE formated as COMPREHENSION-TLV as described in ETSI TS 101 220."""
+ """TLV_IE formated as COMPREHENSION-TLV as described in ETSI TS 101 220.
+ - parsed IEs remember the bit and are emitted unchanged
+ - constructed IEs leave self.comprehension == None
+ and encode from class tag with forced CR by ComprTlvMeta with default "always CR" assumption
+ """
def __init__(self, **kwargs):
super().__init__(**kwargs)
- self.comprehension = False
+ # None: not parsed from file etc, so encode from the class tag
+ # True/False: as received
+ self.comprehension = None
@classmethod
def _decode_tag(cls, do: bytes) -> Tuple[dict, bytes]:
@@ -662,6 +670,19 @@
def _parse_len(cls, do: bytes) -> Tuple[int, bytes]:
return bertlv_parse_len(do)
+ @staticmethod
+ def _cr_mask(tag: int) -> int:
+ # The raw tag is always 0x7f_xx_xx for the 3 byte variant
+ return 0x8000 if tag > 0xffff else 0x80
+
+ def from_tlv(self, do: bytes, context: dict = {}):
+ """Record the comprehension bit and decode as usual."""
+ if len(do):
+ rawtag, _remainder = self._parse_tag_raw(do)
+ if rawtag:
+ self.comprehension = bool(rawtag & self._cr_mask(rawtag))
+ return super().from_tlv(do, context=context)
+
def is_tag_compatible(self, rawtag: int) -> bool:
"""Override is_tag_compatible as we need to mask out the
comprehension bit when doing compares."""
@@ -672,7 +693,14 @@
return ctag & 0x7f == rawtag & 0x7f
def _encode_tag(self) -> bytes:
- return comprehensiontlv_encode_tag(self._compute_tag())
+ # The class tag has a forced CR bit by ComprTlvMeta, so comprehensiontlv_encode_tag()
+ # gets bare tag + our explicit flag.
+ # The tag here is _just_ the class tag like 0x8123, not the raw tag like 0x7f8123
+ # so we check for 0xff and NOT 0xffff as above.
+ tag = self._compute_tag()
+ bit = 0x8000 if tag > 0xff else 0x80
+ compr = self.comprehension if self.comprehension is not None else bool(tag & bit)
+ return comprehensiontlv_encode_tag({'tag': tag & ~bit, 'comprehension': compr})
def _encode_len(self, val: bytes) -> bytes:
return bertlv_encode_len(len(val))
diff --git a/tests/test_tlv.py b/tests/test_tlv.py
index 6d33492..4d06d1d 100755
--- a/tests/test_tlv.py
+++ b/tests/test_tlv.py
@@ -18,7 +18,7 @@
import unittest
from construct import Int8ub, GreedyBytes
-from osmocom.tlv import COMPACT_TLV_IE, IE, TLV_IE_Collection, Transcodable, flatten_dict_lists, camel_to_snake
+from osmocom.tlv import COMPACT_TLV_IE, COMPR_TLV_IE, IE, TLV_IE_Collection, Transcodable, flatten_dict_lists, camel_to_snake
from osmocom.tlv import bertlv_encode_len, bertlv_parse_len, bertlv_parse_one, bertlv_parse_tag
from osmocom.tlv import comprehensiontlv_encode_tag, comprehensiontlv_parse_tag
from osmocom.tlv import dgi_encode_len, dgi_parse_len
@@ -74,6 +74,34 @@
res = comprehensiontlv_encode_tag({'tag': 0x1234, 'comprehension':True})
self.assertEqual(res, b'\x7f\x92\x34')
+ def test_ComprTlvIeCrRoundTrip(self):
+ """comprehension bit is data (TS 101 220 7.1.1) and has to survive decode/encode round trips.
+ It is clear in stored files, e.g. GP Amd B administration session parameters in a card EF
+ """
+ class MyIE(COMPR_TLV_IE, tag=0xbe):
+ _construct = GreedyBytes
+
+ for encoded in (b'\xbe\x02\xca\xfe', b'\x3e\x02\xca\xfe'):
+ ie = MyIE()
+ ie.from_tlv(encoded)
+ self.assertEqual(ie.to_tlv(), encoded)
+
+ # ...but an IE we build from scratch still encodes from the class tag (CR set)
+ ie = MyIE()
+ ie.from_bytes(b'\xca\xfe')
+ self.assertIsNone(ie.comprehension)
+ self.assertEqual(ie.to_tlv(), b'\xbe\x02\xca\xfe')
+
+ def test_ComprTlvIeCrRoundTripTwoByteTag(self):
+ """check that we do not mangle two byte tags"""
+ class MyLongIE(COMPR_TLV_IE, tag=0x8123):
+ _construct = GreedyBytes
+
+ for encoded in (b'\x7f\x81\x23\x01\xff', b'\x7f\x01\x23\x01\xff'):
+ ie = MyLongIE()
+ ie.from_tlv(encoded)
+ self.assertEqual(ie.to_tlv(), encoded)
+
class TestDgiTlv(unittest.TestCase):
def test_DgiTlvLenEnc(self):
self.assertEqual(dgi_encode_len(10), b'\x0a')
--
To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/43171?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: python/pyosmocom
Gerrit-Branch: master
Gerrit-Change-Id: Ifae37785e2a586d9130d154bc7244f35fa6f2a55
Gerrit-Change-Number: 43171
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de>
Attention is currently required from: pespin.
fixeria has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-trx/+/43108?usp=email )
Change subject: libosmo-trx/client: add TRXC client (command queue) API
......................................................................
Patch Set 3:
(1 comment)
File libosmo-trx/src/trxc_client.c:
https://gerrit.osmocom.org/c/osmo-trx/+/43108/comment/005a5f69_0cfa9b1d?usp… :
PS3, Line 474: sf->cb(client, 0, sf->cb_data);
> By freeing "sf" after the cb, you may end up in a double free if the user callback frees the "client […]
Many things can go wrong if the callback free()s the client - this is currently not supported and calling `osmo_trxc_client_free()` would result in an assertion failure `OSMO_ASSERT(!client->in_rx)`.
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43108?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I817e394f74a10e3adae4a0b58342c82acdf0794e
Gerrit-Change-Number: 43108
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 06 Aug 2026 13:53:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Attention is currently required from: jolly.
pespin has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/42817?usp=email )
Change subject: Add VTY test for "listen" node of osmo-stp VTY config
......................................................................
Patch Set 4: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/42817?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: Ia1ceb5f0374f47ff269b557be30fc4d59550d1a6
Gerrit-Change-Number: 42817
Gerrit-PatchSet: 4
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
Gerrit-Comment-Date: Thu, 06 Aug 2026 08:31:03 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43170?usp=email )
Change subject: deps: fetch/clone: retry with backoff time
......................................................................
deps: fetch/clone: retry with backoff time
Replace the previous logic of running the whole Makefile again on any
failure, with wrapping all git clone and fetch commands in a new
retry_with_backoff_time function that actually sleeps before retrying
(a random amount of seconds to make less requests at once), and retries
up to 5 times, each time with likely more sleep time.
With this change it is more likely to succeed and we have less confusing
output as deps/Makefile will not run twice if it fails for any reason
(e.g. a syntax error).
Change-Id: I317c0357ff330a0626a622dadd1e44ba65b99545
---
M Makefile
M deps/update.sh
2 files changed, 29 insertions(+), 6 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
diff --git a/Makefile b/Makefile
index 9cafa4c..b58fcf3 100644
--- a/Makefile
+++ b/Makefile
@@ -77,10 +77,8 @@
default: deps all
-# Eclipse GitLab has rate limiting and sometimes to many concurrent conns fail.
-# If -jN fails, retry with -j1.
.make.deps: deps/Makefile
- ($(MAKE) $(PARALLEL_MAKE) -C deps || $(MAKE) -j1 -C deps)
+ $(MAKE) $(PARALLEL_MAKE) -C deps
touch $@
.PHONY: deps
diff --git a/deps/update.sh b/deps/update.sh
index 64c5b54..1307045 100755
--- a/deps/update.sh
+++ b/deps/update.sh
@@ -14,6 +14,31 @@
esac
}
+# Eclipse GitLab has rate limiting and sometimes too many concurrent
+# connections fail. If that happens, sleep and try again in a few (random)
+# seconds, to give less concurrent load to the server.
+retry_with_backoff_time() {
+ local max=5
+ local sec
+ local i
+
+ for i in $(seq 1 $max); do
+ if "$@"; then
+ return
+ fi
+
+ if [ $i -lt $max ]; then
+ sec=$(($i * $(shuf -i 1-10 -n1)))
+ echo "[$DIR] Failed ($i/$max), retrying in ${sec}s..."
+ sleep $sec
+ else
+ echo "[$DIR] Failed ($i/$max), giving up!"
+ exit 1
+ fi
+ echo "[$DIR] Retrying: $@"
+ done
+}
+
update_url() {
local current="$(git -C "$DIR" remote get-url origin)"
local full_url="$(get_full_url)"
@@ -21,7 +46,7 @@
if [ "$current" != "$full_url" ]; then
echo "[$DIR] Updating URL to $full_url"
git -C "$DIR" remote set-url origin "$full_url"
- git -C "$DIR" fetch
+ retry_with_backoff_time git -C "$DIR" fetch
fi
}
@@ -29,7 +54,7 @@
update_url
else
echo "[$DIR] Initial git clone"
- git clone -q "$(get_full_url)"
+ retry_with_backoff_time git clone -q "$(get_full_url)"
fi
cd "$DIR"
@@ -41,7 +66,7 @@
if ! git cat-file -e "$COMMIT"; then
echo "[$DIR] Missing $COMMIT, fetching git repository"
- git fetch
+ retry_with_backoff_time git fetch
fi
if git rev-parse -q "origin/$COMMIT" 1>/dev/null 2>&1; then
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43170?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I317c0357ff330a0626a622dadd1e44ba65b99545
Gerrit-Change-Number: 43170
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43169?usp=email )
Change subject: deps: avoid redirect with eclipse gitlab
......................................................................
deps: avoid redirect with eclipse gitlab
Use ".git" at the end of gitlab URLs to avoid the redirects, e.g.:
warning: redirecting to https://gitlab.eclipse.org/eclipse/titan/titan.ProtocolModules.M3UA.git/
This is not just a cosmetic improvement that gets rid of these warnings,
but it actually has the effect that we make less requests to the gitlab
eclipse server and are less likely to trigger the rate limiting. On my
machine I do trigger it with "make deps" without this patch, and with
this patch I don't.
Change-Id: I4cfb625e0d09e2bbcab2eef89b521f94c9b6c42c
---
M deps/update.sh
1 file changed, 13 insertions(+), 2 deletions(-)
Approvals:
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/deps/update.sh b/deps/update.sh
index 332ce23..64c5b54 100755
--- a/deps/update.sh
+++ b/deps/update.sh
@@ -3,9 +3,20 @@
COMMIT="$2"
URL_PREFIX="$3"
+get_full_url() {
+ case "$URL_PREFIX" in
+ *gitlab*)
+ echo "$URL_PREFIX"/"$DIR".git
+ ;;
+ *)
+ echo "$URL_PREFIX"/"$DIR"
+ ;;
+ esac
+}
+
update_url() {
local current="$(git -C "$DIR" remote get-url origin)"
- local full_url="$URL_PREFIX"/"$DIR"
+ local full_url="$(get_full_url)"
if [ "$current" != "$full_url" ]; then
echo "[$DIR] Updating URL to $full_url"
@@ -18,7 +29,7 @@
update_url
else
echo "[$DIR] Initial git clone"
- git clone -q "$URL_PREFIX"/"$DIR"
+ git clone -q "$(get_full_url)"
fi
cd "$DIR"
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43169?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I4cfb625e0d09e2bbcab2eef89b521f94c9b6c42c
Gerrit-Change-Number: 43169
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43167?usp=email )
Change subject: deps: move "git clone" logic into update.sh
......................................................................
deps: move "git clone" logic into update.sh
Prepare to have more logic for cloning and updating git repositories in
the script, see follow-up patches. The purpose of this patch series is
to fix the rate limiting errors we are seeing from gitlab eclipse, that
lead to aborts of our ttcn3 jobs:
[titan.ProtocolModules.ROSE] Updating URL to https://gitlab.eclipse.org/eclipse/titan/titan.ProtocolModules.ROSE
remote: You have reached the limit of requests you can make to Eclipse GitLab. This could be caused by too many open tabs, which query the GitLab server in the background. Please close unused tabs, or put them to sleep so they don't issue requests needlessly.
fatal: unable to access 'https://gitlab.eclipse.org/eclipse/titan/titan.ProtocolModules.M3UA/': The requested URL returned error: 429
make[1]: *** [Makefile:174: titan.ProtocolModules.M3UA/update] Error 128
Change-Id: I7c1647edd11afac657acaf6add08903373eae585
---
M deps/Makefile
M deps/update.sh
2 files changed, 15 insertions(+), 8 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
diff --git a/deps/Makefile b/deps/Makefile
index 306f1b2..4a6bd90 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -135,12 +135,8 @@
$(1)_HEAD!= if [ -d $(1) ]; then cd $(1) && git describe --tags 2>/dev/null || git rev-parse HEAD; fi
$(1)_MODIFIED!= if [ -d $(1) ]; then cd $(1) && git diff --quiet --exit-code || echo -n "1"; fi
-$(1):
- @echo "[$(1)] Initial git clone"
- @git clone -q $(2)/$(1)
-
.PHONY: $(1)/update
-$(1)/update: $(1)
+$(1)/update:
ifeq ($$($(1)_MODIFIED),1)
@echo "WARNING: $(1) skipped because it contains uncommitted modifications!"
else
@@ -149,16 +145,21 @@
@cd $(1) && git remote set-url origin $(2)/$(1) && git fetch
endif
ifneq ($$($(1)_HEAD),$($(1)_commit))
- @./update.sh "$(1)" "$($(1)_commit)"
+ @./update.sh "$(1)" "$($(1)_commit)" "$(2)"
endif
endif
.PHONY: $(1)/clean
-$(1)/clean: $(1)
+$(1)/clean:
ifeq ($$($(1)_MODIFIED),1)
@echo "WARNING: $(1) skipped because it contains uncommitted modifications!"
else
- cd $(1) && git fetch && git checkout -q -f "$($(1)_commit)" && git reset --hard
+ if [ -d $(1) ]; then \
+ cd $(1) && \
+ git fetch && \
+ git checkout -q -f "$($(1)_commit)" && \
+ git reset --hard; \
+ fi
endif
.PHONY: $(1)/distclean
diff --git a/deps/update.sh b/deps/update.sh
index 8099ed7..4a52279 100755
--- a/deps/update.sh
+++ b/deps/update.sh
@@ -1,6 +1,12 @@
#!/bin/sh -e
DIR="$1"
COMMIT="$2"
+URL_PREFIX="$3"
+
+if ! [ -d "$DIR" ]; then
+ echo "[$DIR] Initial git clone"
+ git clone -q "$URL_PREFIX"/"$DIR"
+fi
cd "$DIR"
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43167?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I7c1647edd11afac657acaf6add08903373eae585
Gerrit-Change-Number: 43167
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/simtrace2/+/43124?usp=email )
Change subject: firmware: iso7816_3: fix F/D ratio for Di 8 and 9
......................................................................
firmware: iso7816_3: fix F/D ratio for Di 8 and 9
iso7816_3_compute_fd_ratio() multiplied F by D for every d_index >= 8,
presumably because the upper half of ISO 7816-3 Table 8 encodes 1/D.
But 7816-3 2006 and 1997 differ!
That assumption is only true for the range 1010..1111, which in the
2006 version is RFU. Indices 1000 and 1001 are Di = 12 and Di = 20,
see iso7816_3_di_table[].
So right now Fi=372/Di=12 -> 372 * 12 = 4464 instead of 372 / 12 =
31.
In the cemu value is rejected in emu_update_fidi()
and the old baud rate is silently kept.
In the sniffer update_fidi() programs US_FIDI as
4464 & 0x7ff = 368, which is garbage.
Use F/D for indices 1..9 and keep the legacy 1/D reading only for the RFU
range, where we cant really do anything useful anyway.
Change-Id: I44d6451d8b04aea2b0db7291b06a812afe84e52f
---
M firmware/libcommon/source/iso7816_fidi.c
1 file changed, 7 insertions(+), 3 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
Jenkins Builder: Verified
lynxis lazus: Looks good to me, approved
diff --git a/firmware/libcommon/source/iso7816_fidi.c b/firmware/libcommon/source/iso7816_fidi.c
index 024663b..4e87dbd 100644
--- a/firmware/libcommon/source/iso7816_fidi.c
+++ b/firmware/libcommon/source/iso7816_fidi.c
@@ -48,9 +48,13 @@
if (d == 0)
return -EINVAL;
- /* See table 7 of ISO 7816-3: From 1000 on we divide by 1/d,
- * which equals a multiplication by d */
- if (d_index < 8)
+ /* DI defined in Table 8 of ISO/IEC 7816-3:2006
+ * has values 0001..1001 as div 1, 2, 4, 8, 16, 32, 64, 12, 20
+ * so indices 1..9 are all divisors and the ratio is F/D.
+ * But Indices 1010..1111 are RFU in the 2006 edition!
+ * 1997 used those for 1/2 .. 1/64, where dividing by 1/d equals multiplying by d.
+ * Keep that legacy interpretation for the RFU range only. */
+ if (d_index < 10)
ret = f / d;
else
ret = f * d;
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/43124?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I44d6451d8b04aea2b0db7291b06a812afe84e52f
Gerrit-Change-Number: 43124
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>