laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/37536?usp=email )
Change subject: pySim.ota: Add construct definition for SIM File + TK Param definition ......................................................................
pySim.ota: Add construct definition for SIM File + TK Param definition
Change-Id: Ie5aa2babaf66af49eb5223e5e9d4451089baf055 --- M pySim/ota.py 1 file changed, 22 insertions(+), 2 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve
diff --git a/pySim/ota.py b/pySim/ota.py index 751461a..bb5a1f6 100644 --- a/pySim/ota.py +++ b/pySim/ota.py @@ -1,6 +1,6 @@ """Code related to SIM/UICC OTA according to TS 102 225 + TS 31.115."""
-# (C) 2021-2023 by Harald Welte laforge@osmocom.org +# (C) 2021-2024 by Harald Welte laforge@osmocom.org # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ import struct from typing import Optional, Tuple from construct import Enum, Int8ub, Int16ub, Struct, Bytes, GreedyBytes, BitsInteger, BitStruct -from construct import Flag, Padding, Switch, this +from construct import Flag, Padding, Switch, this, PrefixedArray, GreedyRange
from pySim.construct import * from pySim.utils import b2h @@ -99,6 +99,17 @@ 'tar'/Bytes(3), 'secured_data'/GreedyBytes)
+# TS 102 226 Section 8.2.1.3.2.1 +SimFileAccessAndToolkitAppSpecParams = Struct('access_domain'/Prefixed(Int8ub, GreedyBytes), + 'prio_level_of_tk_app_inst'/Int8ub, + 'max_num_of_timers'/Int8ub, + 'max_text_length_for_menu_entry'/Int8ub, + 'menu_entries'/PrefixedArray(Int8ub, Struct('id'/Int8ub, + 'pos'/Int8ub)), + 'max_num_of_channels'/Int8ub, + 'msl'/Prefixed(Int8ub, GreedyBytes), + 'tar_values'/Prefixed(Int8ub, GreedyRange(Bytes(3)))) + class OtaKeyset: """The OTA related data (key material, counter) to be used in encrypt/decrypt.""" def __init__(self, algo_crypt: str, kic_idx: int, kic: bytes,