lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

  • 1 participants
  • 97219 discussions
[M] Change in osmo-ttcn3-hacks[master]: RemSIM/server: Add test to verify maintenance mapping
by fixeria 05 Nov '26

05 Nov '26
Attention is currently required from: jolly. fixeria has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43838?usp=email ) Change subject: RemSIM/server: Add test to verify maintenance mapping ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43838?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I091dfe999b5b3473c67d6874ca31d238ee75b70e Gerrit-Change-Number: 43838 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Comment-Date: Thu, 05 Nov 2026 07:04:38 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in docker-playground[master]: redmine: update from 6.1.4 to 6.1.6
by fixeria 05 Nov '26

05 Nov '26
Attention is currently required from: laforge. fixeria has posted comments on this change by laforge. ( https://gerrit.osmocom.org/c/docker-playground/+/44020?usp=email ) Change subject: redmine: update from 6.1.4 to 6.1.6 ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/44020?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: Ia0176a37017d6d96b1c4c61e353b0bea3dc181b6 Gerrit-Change-Number: 44020 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Thu, 05 Nov 2026 07:00:25 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: udm: Fix TC_result_confirmation_inform expectancies
by pespin 04 Nov '26

04 Nov '26
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44029?usp=email ) Change subject: udm: Fix TC_result_confirmation_inform expectancies ...................................................................... udm: Fix TC_result_confirmation_inform expectancies open5gs-udmd was sending the wrong message, as reported in https://github.com/open5gs/open5gs/issues/4896 The issue has been fixed, to adapt the test to properly trigger the scenario and adapt expectancies. Change-Id: If0c7fcfb673717472345b28139e3b4f6a15ef213 --- M udm/ConnHdlr.ttcn 1 file changed, 39 insertions(+), 7 deletions(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve diff --git a/udm/ConnHdlr.ttcn b/udm/ConnHdlr.ttcn index db16dc8..0a7ab1c 100644 --- a/udm/ConnHdlr.ttcn +++ b/udm/ConnHdlr.ttcn @@ -286,17 +286,16 @@ var template (value) AuthEvent1 auth_event; auth_event := ts_AuthEvent1(nfInstanceId := g_pars.ausf_instance_id, - success := true, + success := false, timeStamp := "2026-10-20T11:58:44.069417+00:00", /* TODO: generate the now() timestamp string */ authType := ts_AuthType1(FiveG_AKA), - servingNetworkName := g_pars.serving_network); + servingNetworkName := g_pars.serving_network, + authRemovalInd := true); http2_tx := f_n13_prepare_individual_auth_event(auth_event); f_http2_adapter_connect_send_udm(http2_tx, idx := http2_tx.conn_id); - /* FIXME: This is probably incorrect, it should send a DELETE, but it's what open5gs-udmd is sending right now... - * See https://github.com/open5gs/open5gs/issues/4896 */ - as_Nudr_DR_put_authentication_status(); + as_Nudr_DR_delete_authentication_status(); /* 3GPP TS 29.503 Table 6.3.3.6.2.1-3 */ http2_exp_rx := @@ -358,7 +357,7 @@ } } -/* 3GPP TS 29.505 5.2.2.3.1 AuthenticationSubscription (PUT) */ +/* 3GPP TS 29.505 5.2.24.3.1 Resource: AuthenticationStatus (PUT) */ function f_tr_Nudr_DR_put_authentication_status() runs on ConnHdlr return template (present) HTTP2_Msg { var template (present) HTTP2_Msg http2_msg; @@ -373,7 +372,7 @@ return http2_msg; } -/* 3GPP TS 29.505 5.2.2 Resource: AuthenticationSubscription */ +/* 3GPP TS 29.505 5.2.24.3.1 Resource: AuthenticationStatus (PUT) */ altstep as_Nudr_DR_put_authentication_status() runs on ConnHdlr { var HTTP2_Msg http2_rx; @@ -391,4 +390,37 @@ } } +/* 3GPP TS 29.505 5.2.24.3.3 Resource: AuthenticationStatus (DELETE) */ +function f_tr_Nudr_DR_delete_authentication_status() +runs on ConnHdlr return template (present) HTTP2_Msg { + var template (present) HTTP2_Msg http2_msg; + var template (present) HTTP2_header_block hb; + var template (present) HTTP2_pseudo_headers pseudo_headers; + var template HTTP2_header_list headers := *; + + pseudo_headers := tr_HTTP2_pseudo_headers_Req(method := "DELETE", + path := tr_Nudr_DR_path_authentication_status(g_pars.imsi_str)); + hb := tr_HTTP2_header_block(pseudo_headers, headers); + http2_msg := tr_HTTP2_Msg(?, ?, hb := hb, body := omit); + return http2_msg; +} + +/* 3GPP TS 29.505 5.2.24.3.3 Resource: AuthenticationStatus (DELETE) */ +altstep as_Nudr_DR_delete_authentication_status() +runs on ConnHdlr { + var HTTP2_Msg http2_rx; + [] HTTP2_CONN[HTTP2_CONN_SCP].receive(f_tr_Nudr_DR_delete_authentication_status()) -> value http2_rx { + var template (value) HTTP2_Msg http2_tx; + http2_tx := ts_HTTP2_Msg_204_No_Content(http2_rx.conn_id, + http2_rx.stream_id, + headers := { + ts_HTTP2_Hdr_content_type("application/json") + }, + body := omit); + + HTTP2_CONN[HTTP2_CONN_SCP].send(http2_tx); + setverdict(pass); + } +} + } -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44029?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: If0c7fcfb673717472345b28139e3b4f6a15ef213 Gerrit-Change-Number: 44029 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: udm: Fix TC_result_confirmation_inform expectancies
by pespin 04 Nov '26

04 Nov '26
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44029?usp=email ) Change subject: udm: Fix TC_result_confirmation_inform expectancies ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44029?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: If0c7fcfb673717472345b28139e3b4f6a15ef213 Gerrit-Change-Number: 44029 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 04 Nov 2026 20:51:11 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in osmo-hlr[master]: tests/db_upgrade: fix test failure with sqlite3 >= 3.54.0
by pespin 04 Nov '26

04 Nov '26
Attention is currently required from: fixeria, lynxis lazus, osmith. pespin has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-hlr/+/44028?usp=email ) Change subject: tests/db_upgrade: fix test failure with sqlite3 >= 3.54.0 ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/44028?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Change-Id: I7353988516b274eb228818e694dbe857509cf536 Gerrit-Change-Number: 44028 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Wed, 04 Nov 2026 20:41:14 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in pysim[master]: esim.saip: keep keyAccess and keyCounterValue of security domain keys
by laforge 04 Nov '26

04 Nov '26
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/44011?usp=email ) Change subject: esim.saip: keep keyAccess and keyCounterValue of security domain keys ...................................................................... esim.saip: keep keyAccess and keyCounterValue of security domain keys SecurityDomainKey only stored the usage qualifier, KID, KVN and key components, and ProfileElementSD._pre_encode() rebuilds keyList from it, so a non-default keyAccess and any keyCounterValue were lost on re-encode. Store both. keyAccess is only written if it is not '00'. The counter is an integer, encoded with the length of the protocol the KVN is reserved for (SAIP section 8.6.3: 2, 3 and 5 bytes for SCP02, SCP03 and SCP80, on the KVN ranges listed in global_platform/uicc.py), also when it was decoded with another length. A counter on any other KVN raises ValueError. The folder osmocom-pysim-saip-sd-key-access-counter of hampushellsberg-dev/PySIM-upstream-patches on GitHub has the analysis and a repro. Change-Id: I7df8ef6f2c81cd8544a04dbf7ff5d096685103e3 --- M pySim/esim/saip/__init__.py M tests/unittests/test_esim_saip.py 2 files changed, 70 insertions(+), 6 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved dexter: Looks good to me, but someone else must approve diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py index 5966897..e18ac8a 100644 --- a/pySim/esim/saip/__init__.py +++ b/pySim/esim/saip/__init__.py @@ -1153,11 +1153,28 @@ class SecurityDomainKey: """Representation of a key used for SCP access to a security domain.""" def __init__(self, key_version_number: int, key_id: int, key_usage_qualifier: dict, - key_components: List[SecurityDomainKeyComponent]): + key_components: List[SecurityDomainKeyComponent], key_access: int = 0, + key_counter_value: Optional[int] = None): self.key_usage_qualifier = key_usage_qualifier self.key_identifier = key_id self.key_version_number = key_version_number self.key_components = key_components + self.key_access = key_access + self.key_counter_value = key_counter_value + + @staticmethod + def counter_len_for_kvn(kvn: int) -> int: + """Return the counter length of the protocol a KVN is reserved for (see the KVN table in + pySim.global_platform.uicc). Raises ValueError if that is not SCP80, SCP02 or SCP03.""" + # SAIP section 8.6.3: the default counter is '0000' for SCP02, '000000' for SCP03 and + # '0000000000' for SCP80 + if kvn in range(0x01, 0x10): + return 5 # SCP80 + if kvn in range(0x20, 0x30) or kvn == 0xff: + return 2 # SCP02 + if kvn in range(0x30, 0x40): + return 3 # SCP03 + raise ValueError('KVN 0x%02x is not reserved for SCP80, SCP02 or SCP03, its key counter length is unknown' % kvn) def __repr__(self) -> str: return 'SdKey(KVN=0x%02x, ID=0x%02x, Usage=0x%x, Comp=%s)' % (self.key_version_number, @@ -1168,18 +1185,32 @@ @classmethod def from_saip_dict(cls, saip: dict) -> 'SecurityDomainKey': """Construct instance from the dict as generated by SAIP asn.1 decoder.""" + counter = saip.get('keyCounterValue', None) inst = cls(int.from_bytes(saip['keyVersionNumber'], "big"), int.from_bytes(saip['keyIdentifier'], "big"), KeyUsageQualifier.parse(saip['keyUsageQualifier']), - [SecurityDomainKeyComponent.from_saip_dict(x) for x in saip['keyComponents']]) + [SecurityDomainKeyComponent.from_saip_dict(x) for x in saip['keyComponents']], + key_access=int.from_bytes(saip.get('keyAccess', b'\x00'), "big"), + key_counter_value=int.from_bytes(counter, "big") if counter is not None else None) return inst def to_saip_dict(self) -> dict: """Express instance in the dict format required by SAIP asn.1 encoder.""" - return {'keyUsageQualifier': KeyUsageQualifier.build(self.key_usage_qualifier), - 'keyIdentifier': bytes([self.key_identifier]), - 'keyVersionNumber': bytes([self.key_version_number]), - 'keyComponents': [k.to_saip_dict() for k in self.key_components]} + ret = {'keyUsageQualifier': KeyUsageQualifier.build(self.key_usage_qualifier), + 'keyIdentifier': bytes([self.key_identifier]), + 'keyVersionNumber': bytes([self.key_version_number]), + 'keyComponents': [k.to_saip_dict() for k in self.key_components]} + # keyAccess is DEFAULT '00', keyCounterValue OPTIONAL + if self.key_access: + ret['keyAccess'] = bytes([self.key_access]) + if self.key_counter_value is not None: + counter_len = self.counter_len_for_kvn(self.key_version_number) + try: + ret['keyCounterValue'] = self.key_counter_value.to_bytes(counter_len, "big") + except OverflowError as e: + raise ValueError('key counter %d of KVN 0x%02x does not fit in %d bytes' + % (self.key_counter_value, self.key_version_number, counter_len)) from e + return ret def get_key_component(self, key_type): for kc in self.key_components: diff --git a/tests/unittests/test_esim_saip.py b/tests/unittests/test_esim_saip.py index 4a02b71..50cb9d5 100755 --- a/tests/unittests/test_esim_saip.py +++ b/tests/unittests/test_esim_saip.py @@ -63,6 +63,39 @@ pes = ProfileElementSequence.from_der(der) self.assertEqual(pes.to_der(), der) + def test_sd_key_access_and_counter(self): + """Test that keyAccess and keyCounterValue of a security domain key survive a re-encode.""" + decoded = copy.deepcopy(self.pes.get_pe_for_type('securityDomain').decoded) + # KVN 0x01: SCP80 keyset, five byte counter + decoded['keyList'][0]['keyAccess'] = b'\x01' + decoded['keyList'][0]['keyCounterValue'] = h2b('0000000001') + der = asn1.encode('ProfileElement', ('securityDomain', decoded)) + pe = ProfileElement.from_der(der) + self.assertEqual(pe.keys[0].key_access, 1) + self.assertEqual(pe.keys[0].key_counter_value, 1) + self.assertEqual(pe.to_der(), der) + + def test_sd_key_counter_len(self): + """Test that a key counter is encoded with the length of the protocol its KVN is reserved for.""" + key = self.pes.get_pe_for_type('securityDomain').keys[0] + def counter(kvn: int, value: int = 1) -> str: + sd_key = SecurityDomainKey(kvn, key.key_identifier, key.key_usage_qualifier, key.key_components, + key_counter_value=value) + return b2h(sd_key.to_saip_dict()['keyCounterValue']) + self.assertEqual(counter(0x01), '0000000001') # SCP80 + self.assertEqual(counter(0x20), '0001') # SCP02 + self.assertEqual(counter(0xff), '0001') # SCP02 + self.assertEqual(counter(0x30), '000001') # SCP03 + # KVN 0x70 is not reserved for SCP80, SCP02 or SCP03; 0x1000000 needs more than 3 bytes + for kvn, value in ((0x70, 1), (0x30, 0x1000000)): + with self.assertRaises(ValueError): + counter(kvn, value) + # a decoded counter of another length re-encodes with the length of its KVN + decoded = copy.deepcopy(self.pes.get_pe_for_type('securityDomain').decoded) + decoded['keyList'][3]['keyCounterValue'] = h2b('0001') # KVN 0x02: SCP80 + pe = ProfileElement.from_der(asn1.encode('ProfileElement', ('securityDomain', decoded))) + self.assertEqual(pe.keys[3].to_saip_dict()['keyCounterValue'], h2b('0000000001')) + def test_sequence_helpers(self): """Verify that the convenience helpers worked as expected.""" self.assertEqual([x.type for x in self.pes.pe_list], self.expected_pet_list) -- To view, visit https://gerrit.osmocom.org/c/pysim/+/44011?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I7df8ef6f2c81cd8544a04dbf7ff5d096685103e3 Gerrit-Change-Number: 44011 Gerrit-PatchSet: 3 Gerrit-Owner: hampushellsberg <hampushellsberg(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
1 0
0 0
[M] Change in pysim[master]: esim.saip: keep keyAccess and keyCounterValue of security domain keys
by laforge 04 Nov '26

04 Nov '26
Attention is currently required from: hampushellsberg, lynxis lazus. laforge has posted comments on this change by hampushellsberg. ( https://gerrit.osmocom.org/c/pysim/+/44011?usp=email ) Change subject: esim.saip: keep keyAccess and keyCounterValue of security domain keys ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/44011?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I7df8ef6f2c81cd8544a04dbf7ff5d096685103e3 Gerrit-Change-Number: 44011 Gerrit-PatchSet: 3 Gerrit-Owner: hampushellsberg <hampushellsberg(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Attention: hampushellsberg <hampushellsberg(a)gmail.com> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Wed, 04 Nov 2026 13:22:37 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in pysim[master]: esim.saip: derive nb_rec from efFileSize when the descriptor omits it
by laforge 04 Nov '26

04 Nov '26
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/43984?usp=email ) Change subject: esim.saip: derive nb_rec from efFileSize when the descriptor omits it ...................................................................... esim.saip: derive nb_rec from efFileSize when the descriptor omits it File.from_template copies the template's record count, so a profile whose fileDescriptor carries no number of records but declares a larger efFileSize kept the template default (EF.MSISDN: one 24-byte record from FilesUsimOptional against a 68-byte, two-record file). ETSI TS 102 222 sizes a linear fixed EF as record length times record count; when the descriptor is silent the declared size is the count. The folder osmocom-pysim-saip-record-count of hampushellsberg-dev/PySIM-upstream-patches on GitHub has the analysis and a repro. Change-Id: I191b234446c278a5252a903d170c3336d9e0c1ba --- M pySim/esim/saip/__init__.py 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: neels: Looks good to me, approved laforge: Looks good to me, but someone else must approve dexter: Looks good to me, approved Jenkins Builder: Verified diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py index 2833fd0..5966897 100644 --- a/pySim/esim/saip/__init__.py +++ b/pySim/esim/saip/__init__.py @@ -366,8 +366,8 @@ if fd_dec['record_len']: self.rec_len = fd_dec['record_len'] if efFileSize: - if self.rec_len and self.nb_rec == None: - # compute the number of records from file size and record length + if self.rec_len and not fd_dec['num_of_rec']: + # the profile's size wins over a template count when the descriptor omits it self.nb_rec = self._file_size // self.rec_len if fdb_dec['structure'] == 'linear_fixed': self.file_type = 'LF' -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43984?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I191b234446c278a5252a903d170c3336d9e0c1ba Gerrit-Change-Number: 43984 Gerrit-PatchSet: 4 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-CC: hampushellsberg <hampushellsberg(a)gmail.com>
1 0
0 0
[S] Change in pysim[master]: esim.saip: split a fillFileOffset beyond the range of UInt16
by laforge 04 Nov '26

04 Nov '26
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/44010?usp=email ) Change subject: esim.saip: split a fillFileOffset beyond the range of UInt16 ...................................................................... esim.saip: split a fillFileOffset beyond the range of UInt16 fillFileOffset is a UInt16 (SAIP section 8.3.2), but file_content_to_tuples() emitted a gap of any length as a single offset. Split longer gaps into steps of at most 0xffff. The folder osmocom-pysim-saip-optimised-body-encoding of hampushellsberg-dev/PySIM-upstream-patches on GitHub has the analysis. Change-Id: Iddd98b7f54abaebfdbf6682a8635339d13cf56e3 --- M pySim/esim/saip/__init__.py M tests/unittests/test_esim_saip.py 2 files changed, 19 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified dexter: Looks good to me, approved laforge: Looks good to me, but someone else must approve diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py index 60da704..86f0a39 100644 --- a/pySim/esim/saip/__init__.py +++ b/pySim/esim/saip/__init__.py @@ -524,7 +524,12 @@ for block in non_matching_blocks: # fillFileOffset moves the pointer relative to its current position, and # fillFileContent leaves it after the last byte written (SAIP section 8.3.5) - ret.append(('fillFileOffset', block.a - cur)) + offset = block.a - cur + # fillFileOffset is a UInt16 (SAIP section 8.3.2): a longer move takes several + while offset > 0xffff: + ret.append(('fillFileOffset', 0xffff)) + offset -= 0xffff + ret.append(('fillFileOffset', offset)) ret.append(('fillFileContent', self.body[block.a:block.a+block.size])) cur = block.a + block.size return ret diff --git a/tests/unittests/test_esim_saip.py b/tests/unittests/test_esim_saip.py index 75a38f4..e6f9882 100755 --- a/tests/unittests/test_esim_saip.py +++ b/tests/unittests/test_esim_saip.py @@ -125,6 +125,19 @@ pes.append(inst) pes.to_der() +class FileContentTest(unittest.TestCase): + def test_fill_file_offset_fits_uint16(self): + # fillFileOffset is a UInt16 (SAIP 8.3.2): a longer gap takes several steps + template = templates.FileTemplate(0x6f99, 'EF.TEST', 'TR', None, 70000, 5, None, None) + body = bytearray(b'\xff' * 70000) + body[66000] = 0x00 + f = File('test', [('fileDescriptor', {})], template) + f.body = bytes(body) + tuples = f.file_content_to_tuples(optimize=True) + offsets = [v for k, v in tuples if k == 'fillFileOffset'] + self.assertEqual(offsets, [0xffff, 66000 - 0xffff]) + self.assertEqual(f.file_content_from_tuples(tuples), bytes(body)) + class OidTest(unittest.TestCase): def test_cmp(self): self.assertTrue(oid.OID('1.0') > oid.OID('0.9')) -- To view, visit https://gerrit.osmocom.org/c/pysim/+/44010?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Iddd98b7f54abaebfdbf6682a8635339d13cf56e3 Gerrit-Change-Number: 44010 Gerrit-PatchSet: 2 Gerrit-Owner: hampushellsberg <hampushellsberg(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
1 0
0 0
[S] Change in pysim[master]: esim.saip: fix decoding of rfu PEs with an empty body
by laforge 04 Nov '26

04 Nov '26
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/44012?usp=email ) Change subject: esim.saip: fix decoding of rfu PEs with an empty body ...................................................................... esim.saip: fix decoding of rfu PEs with an empty body rfu1..rfu5 are PE-Dummy, an empty SEQUENCE. from_der() creates a generic ProfileElement for them and sets the type afterwards, but the constructor treated the empty dict like a new PE and derived a header name from the unset type, so a profile with such a PE failed to load with an AttributeError. Only create a header if 'decoded' is None, as documented. The folder osmocom-pysim-saip-empty-pe-body of hampushellsberg-dev/PySIM-upstream-patches on GitHub has the analysis and a repro. Change-Id: Ic47f74e8c111643c4ba435a9bac6aa9838bd3584 --- M pySim/esim/saip/__init__.py M tests/unittests/test_esim_saip.py 2 files changed, 18 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified dexter: Looks good to me, approved diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py index 86f0a39..2833fd0 100644 --- a/pySim/esim/saip/__init__.py +++ b/pySim/esim/saip/__init__.py @@ -582,7 +582,8 @@ pe_sequence: back-reference to the PE-Sequence of which we're part of """ self.pe_sequence = pe_sequence - if decoded: + # PE-Dummy (rfu1..rfu5) decodes to an empty dict; only a new PE gets a header + if decoded is not None: self.decoded = decoded else: self.decoded = OrderedDict() diff --git a/tests/unittests/test_esim_saip.py b/tests/unittests/test_esim_saip.py index e6f9882..4a02b71 100755 --- a/tests/unittests/test_esim_saip.py +++ b/tests/unittests/test_esim_saip.py @@ -47,6 +47,22 @@ self.assertEqual(reenc_tlv, first_tlv) + def test_rfu_pe(self): + """Test that an rfu PE (PE-Dummy, an empty SEQUENCE without header) decodes and re-encodes.""" + rfu_der = asn1.encode('ProfileElement', ('rfu1', {})) + pe = ProfileElement.from_der(rfu_der) + self.assertEqual(pe.type, 'rfu1') + self.assertEqual(pe.to_der(), rfu_der) + # within a sequence: insert it before the trailing PE-End + tlvs = [] + remainder = self.per_input + while len(remainder): + first_tlv, remainder = bertlv_first_segment(remainder) + tlvs.append(first_tlv) + der = b''.join(tlvs[:-1]) + rfu_der + tlvs[-1] + pes = ProfileElementSequence.from_der(der) + self.assertEqual(pes.to_der(), der) + def test_sequence_helpers(self): """Verify that the convenience helpers worked as expected.""" self.assertEqual([x.type for x in self.pes.pe_list], self.expected_pet_list) -- To view, visit https://gerrit.osmocom.org/c/pysim/+/44012?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Ic47f74e8c111643c4ba435a9bac6aa9838bd3584 Gerrit-Change-Number: 44012 Gerrit-PatchSet: 2 Gerrit-Owner: hampushellsberg <hampushellsberg(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • ...
  • 9722
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.