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 -----
  • 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

January 2026

  • 1 participants
  • 1508 discussions
[L] Change in pysim[master]: add test_configurable_parameters.py
by neels 07 Jan '26

07 Jan '26
Attention is currently required from: neels. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/pysim/+/40823?usp=email to look at the new patch set (#5). Change subject: add test_configurable_parameters.py ...................................................................... add test_configurable_parameters.py Change-Id: Ia55f0d11f8197ca15a948a83a34b3488acf1a0b4 --- M pySim/esim/saip/personalization.py A tests/unittests/smdpp_data A tests/unittests/test_configurable_parameters.py A tests/unittests/xo/test_configurable_parameters 4 files changed, 632 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/23/40823/5 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/40823?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Ia55f0d11f8197ca15a948a83a34b3488acf1a0b4 Gerrit-Change-Number: 40823 Gerrit-PatchSet: 5 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
1 0
0 0
[S] Change in pysim[master]: personalization.ConfigurableParameter: fix BytesIO() input
by neels 07 Jan '26

07 Jan '26
Attention is currently required from: neels. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/pysim/+/40824?usp=email to look at the new patch set (#4). The following approvals got outdated and were removed: Verified-1 by Jenkins Builder Change subject: personalization.ConfigurableParameter: fix BytesIO() input ...................................................................... personalization.ConfigurableParameter: fix BytesIO() input Change-Id: I0ad160eef9015e76eef10baee7c6b606fe249123 --- M pySim/esim/saip/personalization.py M tests/unittests/test_configurable_parameters.py M tests/unittests/xo/test_configurable_parameters 3 files changed, 44 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/24/40824/4 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/40824?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I0ad160eef9015e76eef10baee7c6b606fe249123 Gerrit-Change-Number: 40824 Gerrit-PatchSet: 4 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
1 0
0 0
[M] Change in pysim[master]: personalization: add int as input type for BinaryParameter
by neels 07 Jan '26

07 Jan '26
Attention is currently required from: neels. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/pysim/+/40825?usp=email to look at the new patch set (#4). Change subject: personalization: add int as input type for BinaryParameter ...................................................................... personalization: add int as input type for BinaryParameter Change-Id: I31d8142cb0847a8b291f8dc614d57cb4734f0190 --- M pySim/esim/saip/personalization.py M tests/unittests/test_configurable_parameters.py M tests/unittests/xo/test_configurable_parameters 3 files changed, 186 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/25/40825/4 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/40825?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I31d8142cb0847a8b291f8dc614d57cb4734f0190 Gerrit-Change-Number: 40825 Gerrit-PatchSet: 4 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
1 0
0 0
[XL] Change in pysim[master]: generate sdkey classes from a list
by neels 07 Jan '26

07 Jan '26
neels has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/pysim/+/41771?usp=email ) Change subject: generate sdkey classes from a list ...................................................................... generate sdkey classes from a list Change-Id: Ic92ddea6e1fad8167ea75baf78ffc3eb419838c4 --- M pySim/esim/saip/personalization.py M tests/unittests/test_configurable_parameters.py M tests/unittests/test_esim_saip.py M tests/unittests/xo/test_configurable_parameters 4 files changed, 2,238 insertions(+), 62 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/71/41771/2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/41771?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Ic92ddea6e1fad8167ea75baf78ffc3eb419838c4 Gerrit-Change-Number: 41771 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-CC: Jenkins Builder
1 0
0 0
[L] Change in pysim[master]: SdKey params: add KVN to SdKey names
by neels 07 Jan '26

07 Jan '26
Attention is currently required from: neels. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/pysim/+/41772?usp=email to look at the new patch set (#2). The following approvals got outdated and were removed: Verified-1 by Jenkins Builder Change subject: SdKey params: add KVN to SdKey names ...................................................................... SdKey params: add KVN to SdKey names "SCP80-KVN01" is much more clear than "SCP80-01". So many things could be 01. Change-Id: Ie296a438efd4737b39eaf133288ceed51bd593bc --- M pySim/esim/saip/personalization.py M tests/unittests/xo/test_configurable_parameters 2 files changed, 497 insertions(+), 497 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/72/41772/2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/41772?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Ie296a438efd4737b39eaf133288ceed51bd593bc Gerrit-Change-Number: 41772 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
1 0
0 0
[XS] Change in pysim[master]: fix typo in doc TuakNumberOfKeccak
by neels 07 Jan '26

07 Jan '26
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/41769?usp=email ) Change subject: fix typo in doc TuakNumberOfKeccak ...................................................................... fix typo in doc TuakNumberOfKeccak Change-Id: Ie6f2260d5632dea7409cffd3afa7c8d0b1986a7c --- M pySim/esim/saip/personalization.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/69/41769/1 diff --git a/pySim/esim/saip/personalization.py b/pySim/esim/saip/personalization.py index a1df068..3a77990 100644 --- a/pySim/esim/saip/personalization.py +++ b/pySim/esim/saip/personalization.py @@ -391,7 +391,7 @@ if len(self.input_value) != 80: raise ValueError('Length of value must be 80 octets') class TuakNumberOfKeccak(AlgoConfig, key='numberOfKeccak'): - """Number of iterations of Keccak-f[1600] permuitation as recomended by Section 7.2 of 3GPP TS 35.231. + """Number of iterations of Keccak-f[1600] permutation as recomended by Section 7.2 of 3GPP TS 35.231. The default value by 3GPP is 1.""" def validate(self): if not isinstance(self.input_value, int): -- To view, visit https://gerrit.osmocom.org/c/pysim/+/41769?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Ie6f2260d5632dea7409cffd3afa7c8d0b1986a7c Gerrit-Change-Number: 41769 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
1 0
0 0
[S] Change in pysim[master]: saip/param_source: try to not repeat random values
by neels 07 Jan '26

07 Jan '26
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/41770?usp=email ) Change subject: saip/param_source: try to not repeat random values ...................................................................... saip/param_source: try to not repeat random values Change-Id: I4fa743ef5677580f94b9df16a5051d1d178edeb0 --- M pySim/esim/saip/param_source.py 1 file changed, 23 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/70/41770/1 diff --git a/pySim/esim/saip/param_source.py b/pySim/esim/saip/param_source.py index f5d2a35..1e5c92e 100644 --- a/pySim/esim/saip/param_source.py +++ b/pySim/esim/saip/param_source.py @@ -100,6 +100,7 @@ 'return a different sequence of random decimal digits each' is_abstract = False name = 'random decimal digits' + used_keys = set() def __init__(self, num_digits, first_value, last_value): """ @@ -118,7 +119,16 @@ self.val_first_last = (first_value, last_value) def get_next(self, csv_row:dict=None): - val = self.random_impl.randint(*self.val_first_last) + # try to generate random digits that are always different from previously produced random bytes + attempts = 10 + while True: + val = self.random_impl.randint(*self.val_first_last) + if val in RandomDigitSource.used_keys: + attempts -= 1 + if attempts: + continue + RandomDigitSource.used_keys.add(val) + break return self.val_to_digit(val) def val_to_digit(self, val:int): @@ -144,6 +154,7 @@ 'return a different sequence of random hexadecimal digits each' is_abstract = False name = 'random hexadecimal digits' + used_keys = set() def __init__(self, num_digits): 'see from_str()' @@ -156,7 +167,17 @@ self.num_digits = num_digits def get_next(self, csv_row:dict=None): - val = self.random_impl.randbytes(self.num_digits // 2) + # try to generate random bytes that are always different from previously produced random bytes + attempts = 10 + while True: + val = self.random_impl.randbytes(self.num_digits // 2) + if val in RandomHexDigitSource.used_keys: + attempts -= 1 + if attempts: + continue + RandomHexDigitSource.used_keys.add(val) + break + return b2h(val) @classmethod -- To view, visit https://gerrit.osmocom.org/c/pysim/+/41770?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I4fa743ef5677580f94b9df16a5051d1d178edeb0 Gerrit-Change-Number: 41770 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
1 0
0 0
[XS] Change in pysim[master]: SdKey params: add KVN to SdKey names
by neels 07 Jan '26

07 Jan '26
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/41772?usp=email ) Change subject: SdKey params: add KVN to SdKey names ...................................................................... SdKey params: add KVN to SdKey names "SCP80-KVN01" is much more clear than "SCP80-01". So many things could be 01. Change-Id: Ie296a438efd4737b39eaf133288ceed51bd593bc --- M pySim/esim/saip/personalization.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/72/41772/1 diff --git a/pySim/esim/saip/personalization.py b/pySim/esim/saip/personalization.py index 085559d..1796e45 100644 --- a/pySim/esim/saip/personalization.py +++ b/pySim/esim/saip/personalization.py @@ -772,7 +772,7 @@ return # leaf node. create a new class with all the accumulated vals - parts = [name, f'{kvn:02x}',] + labels + parts = [name, f'KVN{kvn:02x}',] + labels cls_label = '-'.join(p for p in parts if p) parts = ['Sd', 'Key', name, f'Kvn{kvn:02x}'] + labels -- To view, visit https://gerrit.osmocom.org/c/pysim/+/41772?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Ie296a438efd4737b39eaf133288ceed51bd593bc Gerrit-Change-Number: 41772 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
1 0
0 0
[M] Change in pysim[master]: generate sdkey classes from a list
by neels 07 Jan '26

07 Jan '26
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/41771?usp=email ) Change subject: generate sdkey classes from a list ...................................................................... generate sdkey classes from a list Change-Id: Ic92ddea6e1fad8167ea75baf78ffc3eb419838c4 --- M pySim/esim/saip/personalization.py M tests/unittests/test_esim_saip.py 2 files changed, 174 insertions(+), 61 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/71/41771/1 diff --git a/pySim/esim/saip/personalization.py b/pySim/esim/saip/personalization.py index f8f524e..085559d 100644 --- a/pySim/esim/saip/personalization.py +++ b/pySim/esim/saip/personalization.py @@ -46,17 +46,6 @@ file.append(('fillFileContent', new_content)) return file -class ClassVarMeta(abc.ABCMeta): - """Metaclass that puts all additional keyword-args into the class. We use this to have one - class definition for something like a PIN, and then have derived classes for PIN1, PIN2, ...""" - def __new__(metacls, name, bases, namespace, **kwargs): - #print("Meta_new_(metacls=%s, name=%s, bases=%s, namespace=%s, kwargs=%s)" % (metacls, name, bases, namespace, kwargs)) - x = super().__new__(metacls, name, bases, namespace) - for k, v in kwargs.items(): - setattr(x, k, v) - setattr(x, 'name', camel_to_snake(name)) - return x - def file_tuples_content_as_bytes(l: List[Tuple]) -> Optional[bytes]: """linearize a list of fillFileContent / fillFileOffset tuples into a stream of bytes.""" stream = io.BytesIO() @@ -627,12 +616,14 @@ yield (international, digits) -class SdKey(BinaryParam, metaclass=ClassVarMeta): - """Configurable Security Domain (SD) Key. Value is presented as bytes.""" +class SdKey(BinaryParam): + """Configurable Security Domain (SD) Key. Value is presented as bytes. + Non-abstract implementations are generated in SdKey.generate_sd_key_classes""" # these will be set by subclasses key_type = None - key_id = None kvn = None + reserved_kvn = tuple() # tuple of all reserved kvn for a given SCPxx + key_id = None key_usage_qual = None @classmethod @@ -650,7 +641,7 @@ key = SecurityDomainKey( key_version_number=cls.kvn, key_id=cls.key_id, - key_usage_qualifier=KeyUsageQualifier.build(cls.key_usage_qual), + key_usage_qualifier=cls.key_usage_qual, key_components=set_components, ) pe.add_key(key) @@ -671,60 +662,145 @@ if kc: yield { cls.name: b2h(kc) } -class SdKeyScp80_01(SdKey, kvn=0x01, key_type=0x88, permitted_len=[16,24,32]): # AES key type - pass -class SdKeyScp80_01Kic(SdKeyScp80_01, key_id=0x01, key_usage_qual=0x18): # FIXME: ordering? - pass -class SdKeyScp80_01Kid(SdKeyScp80_01, key_id=0x02, key_usage_qual=0x14): - pass -class SdKeyScp80_01Kik(SdKeyScp80_01, key_id=0x03, key_usage_qual=0x48): - pass -class SdKeyScp81_01(SdKey, kvn=0x81): # FIXME - pass -class SdKeyScp81_01Psk(SdKeyScp81_01, key_id=0x01, key_type=0x85, key_usage_qual=0x3C): - pass -class SdKeyScp81_01Dek(SdKeyScp81_01, key_id=0x02, key_type=0x88, key_usage_qual=0x48): - pass + NO_OP = (('', {})) -class SdKeyScp02_20(SdKey, kvn=0x20, key_type=0x88, permitted_len=[16,24,32]): # AES key type - pass -class SdKeyScp02_20Enc(SdKeyScp02_20, key_id=0x01, key_usage_qual=0x18): - pass -class SdKeyScp02_20Mac(SdKeyScp02_20, key_id=0x02, key_usage_qual=0x14): - pass -class SdKeyScp02_20Dek(SdKeyScp02_20, key_id=0x03, key_usage_qual=0x48): - pass + LEN_128 = (16,) + LEN_128_192_256 = (16, 24, 32) + LEN_128_256 = (16, 32) -class SdKeyScp03_30(SdKey, kvn=0x30, key_type=0x88, permitted_len=[16,24,32]): # AES key type - pass -class SdKeyScp03_30Enc(SdKeyScp03_30, key_id=0x01, key_usage_qual=0x18): - pass -class SdKeyScp03_30Mac(SdKeyScp03_30, key_id=0x02, key_usage_qual=0x14): - pass -class SdKeyScp03_30Dek(SdKeyScp03_30, key_id=0x03, key_usage_qual=0x48): - pass + DES = ('DES', dict(key_type=KeyType.des, allow_len=LEN_128) ) + AES = ('AES', dict(key_type=KeyType.aes, allow_len=LEN_128_192_256) ) -class SdKeyScp03_31(SdKey, kvn=0x31, key_type=0x88, permitted_len=[16,24,32]): # AES key type - pass -class SdKeyScp03_31Enc(SdKeyScp03_31, key_id=0x01, key_usage_qual=0x18): - pass -class SdKeyScp03_31Mac(SdKeyScp03_31, key_id=0x02, key_usage_qual=0x14): - pass -class SdKeyScp03_31Dek(SdKeyScp03_31, key_id=0x03, key_usage_qual=0x48): - pass + ENC = ('ENC', dict(key_id=0x01, key_usage_qual=0x18) ) + MAC = ('MAC', dict(key_id=0x02, key_usage_qual=0x14) ) + DEK = ('DEK', dict(key_id=0x03, key_usage_qual=0x48) ) -class SdKeyScp03_32(SdKey, kvn=0x32, key_type=0x88, permitted_len=[16,24,32]): # AES key type - pass -class SdKeyScp03_32Enc(SdKeyScp03_32, key_id=0x01, key_usage_qual=0x18): - pass -class SdKeyScp03_32Mac(SdKeyScp03_32, key_id=0x02, key_usage_qual=0x14): - pass -class SdKeyScp03_32Dek(SdKeyScp03_32, key_id=0x03, key_usage_qual=0x48): - pass + TLSPSK_PSK = ('TLSPSK', dict(key_type=KeyType.tls_psk, key_id=0x01, key_usage_qual=0x3c, allow_len=LEN_128_192_256) ) + TLSPSK_DEK = ('DEK', dict(key_type=KeyType.des, key_id=0x02, key_usage_qual=0x48, allow_len=LEN_128) ) + + # THIS IS THE LIST that controls which SdKeyXxx subclasses exist: + SD_KEY_DEFS = ( + # name KVN x variants x variants + ('SCP02', (0x20, 0x21, 0x22, 0xff), (AES, ), (ENC, MAC, DEK) ), + ('SCP03', (0x30, 0x31, 0x32), (AES, ), (ENC, MAC, DEK) ), + ('SCP80', (0x01, 0x02, 0x03), (DES, AES), (ENC, MAC, DEK) ), + ('SCP81', (0x40, 0x41, 0x42), (TLSPSK_PSK, TLSPSK_DEK, ), ), + ) + + @classmethod + def generate_sd_key_classes(cls, sd_key_defs=SD_KEY_DEFS): + '''This generates python classes to be exported in this module, as subclasses of class SdKey. + + We create SdKey subclasses dynamically from a list. + You can list all of them via: + from pySim.esim.saip.personalization import SdKey + SdKey.get_all_implementations() + or + print('\n'.join(sorted(f'{x.__name__}\t{x.name}' for x in SdKey.get_all_implementations()))) + + at time of writing this comment, this prints: + + SdKeyScp02Kvn20AesDek SCP02-KVN20-AES-DEK + SdKeyScp02Kvn20AesEnc SCP02-KVN20-AES-ENC + SdKeyScp02Kvn20AesMac SCP02-KVN20-AES-MAC + SdKeyScp02Kvn21AesDek SCP02-KVN21-AES-DEK + SdKeyScp02Kvn21AesEnc SCP02-KVN21-AES-ENC + SdKeyScp02Kvn21AesMac SCP02-KVN21-AES-MAC + SdKeyScp02Kvn22AesDek SCP02-KVN22-AES-DEK + SdKeyScp02Kvn22AesEnc SCP02-KVN22-AES-ENC + SdKeyScp02Kvn22AesMac SCP02-KVN22-AES-MAC + SdKeyScp02KvnffAesDek SCP02-KVNff-AES-DEK + SdKeyScp02KvnffAesEnc SCP02-KVNff-AES-ENC + SdKeyScp02KvnffAesMac SCP02-KVNff-AES-MAC + SdKeyScp03Kvn30AesDek SCP03-KVN30-AES-DEK + SdKeyScp03Kvn30AesEnc SCP03-KVN30-AES-ENC + SdKeyScp03Kvn30AesMac SCP03-KVN30-AES-MAC + SdKeyScp03Kvn31AesDek SCP03-KVN31-AES-DEK + SdKeyScp03Kvn31AesEnc SCP03-KVN31-AES-ENC + SdKeyScp03Kvn31AesMac SCP03-KVN31-AES-MAC + SdKeyScp03Kvn32AesDek SCP03-KVN32-AES-DEK + SdKeyScp03Kvn32AesEnc SCP03-KVN32-AES-ENC + SdKeyScp03Kvn32AesMac SCP03-KVN32-AES-MAC + SdKeyScp80Kvn01AesDek SCP80-KVN01-AES-DEK + SdKeyScp80Kvn01AesEnc SCP80-KVN01-AES-ENC + SdKeyScp80Kvn01AesMac SCP80-KVN01-AES-MAC + SdKeyScp80Kvn01DesDek SCP80-KVN01-DES-DEK + SdKeyScp80Kvn01DesEnc SCP80-KVN01-DES-ENC + SdKeyScp80Kvn01DesMac SCP80-KVN01-DES-MAC + SdKeyScp80Kvn02AesDek SCP80-KVN02-AES-DEK + SdKeyScp80Kvn02AesEnc SCP80-KVN02-AES-ENC + SdKeyScp80Kvn02AesMac SCP80-KVN02-AES-MAC + SdKeyScp80Kvn02DesDek SCP80-KVN02-DES-DEK + SdKeyScp80Kvn02DesEnc SCP80-KVN02-DES-ENC + SdKeyScp80Kvn02DesMac SCP80-KVN02-DES-MAC + SdKeyScp80Kvn03AesDek SCP80-KVN03-AES-DEK + SdKeyScp80Kvn03AesEnc SCP80-KVN03-AES-ENC + SdKeyScp80Kvn03AesMac SCP80-KVN03-AES-MAC + SdKeyScp80Kvn03DesDek SCP80-KVN03-DES-DEK + SdKeyScp80Kvn03DesEnc SCP80-KVN03-DES-ENC + SdKeyScp80Kvn03DesMac SCP80-KVN03-DES-MAC + SdKeyScp81Kvn40Dek SCP81-KVN40-DEK + SdKeyScp81Kvn40Tlspsk SCP81-KVN40-TLSPSK + SdKeyScp81Kvn41Dek SCP81-KVN41-DEK + SdKeyScp81Kvn41Tlspsk SCP81-KVN41-TLSPSK + SdKeyScp81Kvn42Dek SCP81-KVN42-DEK + SdKeyScp81Kvn42Tlspsk SCP81-KVN42-TLSPSK + ''' + def camel(s): + return s[:1].upper() + s[1:].lower() + def do_variants(name, kvn, remaining_variants, labels=[], attrs={}): + 'recurse to unfold as many variants as there may be' + if remaining_variants: + # not a leaf node, collect more labels and attrs + variants = remaining_variants[0] + remaining_variants = remaining_variants[1:] + + for label, valdict in variants: + # pass copies to recursion + inner_labels = list(labels) + inner_attrs = dict(attrs) + + inner_labels.append(label) + inner_attrs.update(valdict) + do_variants(name, kvn, remaining_variants, + labels=inner_labels, + attrs=inner_attrs) + return + + # leaf node. create a new class with all the accumulated vals + parts = [name, f'{kvn:02x}',] + labels + cls_label = '-'.join(p for p in parts if p) + + parts = ['Sd', 'Key', name, f'Kvn{kvn:02x}'] + labels + clsname = ''.join(camel(p) for p in parts) + + max_key_len = attrs.get('allow_len')[-1] + + attrs.update({ + 'name' : cls_label, + 'is_abstract': False, + 'kvn': kvn, + 'default_value': f'00*{max_key_len}', + }) + + # below line is like + # class SdKeyScpNNKvnXXYyyZzz(SdKey): + # <set attrs> + globals()[clsname] = type(clsname, (cls,), attrs) + + + for items in sd_key_defs: + name, kvns = items[:2] + variants = items[2:] + for kvn in kvns: + do_variants(name, kvn, variants) + +# this creates all of the classes named like SdKeyScp02Kvn20AesDek to be published in this python module: +SdKey.generate_sd_key_classes() def obtain_all_pe_from_pelist(l: List[ProfileElement], wanted_type: str) -> ProfileElement: return (pe for pe in l if pe.type == wanted_type) diff --git a/tests/unittests/test_esim_saip.py b/tests/unittests/test_esim_saip.py index e7e324d..fd6a1a9 100755 --- a/tests/unittests/test_esim_saip.py +++ b/tests/unittests/test_esim_saip.py @@ -63,6 +63,43 @@ # TODO: we don't actually test the results here, but we just verify there is no exception pes.to_der() + def test_personalization2(self): + """Test some of the personalization operations.""" + cls = SdKeyScp80Kvn01DesEnc + pes = ProfileElementSequence.from_der(self.per_input) + prev_val = tuple(cls.get_values_from_pes(pes)) + print(f'{prev_val=}') + self.assertTrue(prev_val) + + set_val = '42342342342342342342342342342342' + param = cls(set_val) + param.validate() + param.apply(pes) + + get_val1 = tuple(cls.get_values_from_pes(pes)) + print(f'{get_val1=} {set_val=}') + self.assertEqual(get_val1, ({cls.name: set_val},)) + + get_val1b = tuple(cls.get_values_from_pes(pes)) + print(f'{get_val1b=} {set_val=}') + self.assertEqual(get_val1b, ({cls.name: set_val},)) + + der = pes.to_der() + + get_val1c = tuple(cls.get_values_from_pes(pes)) + print(f'{get_val1c=} {set_val=}') + self.assertEqual(get_val1c, ({cls.name: set_val},)) + + # assertTrue to not dump the entire der. + # Expecting the modified DER to be different. If this assertion fails, then no change has happened in the output + # DER and the ConfigurableParameter subclass is buggy. + self.assertTrue(der != self.per_input) + + pes2 = ProfileElementSequence.from_der(der) + get_val2 = tuple(cls.get_values_from_pes(pes2)) + print(f'{get_val2=} {set_val=}') + self.assertEqual(get_val2, ({cls.name: set_val},)) + def test_constructor_encode(self): """Test that DER-encoding of PE created by "empty" constructor works without raising exception.""" for cls in [ProfileElementMF, ProfileElementPuk, ProfileElementPin, ProfileElementTelecom, -- To view, visit https://gerrit.osmocom.org/c/pysim/+/41771?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Ic92ddea6e1fad8167ea75baf78ffc3eb419838c4 Gerrit-Change-Number: 41771 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
1 0
0 0
[M] Change in pysim[master]: personalization: refactor ConfigurableParameter, Iccid, Imsi
by neels 07 Jan '26

07 Jan '26
Attention is currently required from: dexter, fixeria, laforge, neels. Hello Jenkins Builder, dexter, laforge, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/pysim/+/39742?usp=email to look at the new patch set (#12). The following approvals got outdated and were removed: Code-Review+1 by laforge, Code-Review+2 by neels, Verified+1 by Jenkins Builder The change is no longer submittable: Code-Review and Verified are unsatisfied now. Change subject: personalization: refactor ConfigurableParameter, Iccid, Imsi ...................................................................... personalization: refactor ConfigurableParameter, Iccid, Imsi Main points/rationales of the refactoring, details below: 1) common validation implementation 2) offer classmethods The new features are optional, and will be heavily used by batch personalization patches coming soon. Implement Iccid and Imsi to use the new way, with a common abstract DecimalParam implementation. So far leave the other parameter classes working as they always did, to follow suit in subsequent commits. Details: 1) common validation implementation: There are very common validation steps in the various parameter implementations. It is more convenient and much more readable to implement those once and set simple validation parameters per subclass. So there now is a validate_val() classmethod, which subclasses can use as-is to apply the validation parameters -- or subclasses can override their cls.validate_val() for specialized validation. (Those subclasses that this patch doesn't touch still override the self.validate() instance method. Hence they still work as before this patch, but don't use the new common features yet.) 2) offer stateless classmethods: It is useful for... - batch processing of multiple profiles (in upcoming patches) and - user input validation to be able to have classmethods that do what self.validate() and self.apply() do, but do not modify any self.* members. So far the paradigm was to create a class instance to keep state about the value. This remains available, but in addition we make available the paradigm of a singleton that is stateless (the classmethods). Using self.validate() and self.apply() still work the same as before this patch, i.e. via self.input_value and self.value -- but in addition, there are now classmethods that don't touch self.* members. Related: SYS#6768 Change-Id: I6522be4c463e34897ca9bff2309b3706a88b3ce8 --- M pySim/esim/saip/personalization.py 1 file changed, 186 insertions(+), 35 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/42/39742/12 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/39742?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I6522be4c463e34897ca9bff2309b3706a88b3ce8 Gerrit-Change-Number: 39742 Gerrit-PatchSet: 12 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> 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: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • ...
  • 151
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.