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

July 2023

  • 1 participants
  • 3051 discussions
[M] Change in pysim[master]: pySim/cards: Split legacy classes away from core SIM + UICC
by laforge 11 Jul '23

11 Jul '23
Attention is currently required from: laforge. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/pysim/+/33690 to look at the new patch set (#3). Change subject: pySim/cards: Split legacy classes away from core SIM + UICC ...................................................................... pySim/cards: Split legacy classes away from core SIM + UICC This introduces an internal split between * the code that is shared between pySim-shell and legacy tools, which is now in the new class hierarchy {Card,SimCard,UiccCard}Base * the code that is only used by legacy tools, which is using the old class names inherited from the *Base above All users still go through the legacy {Sim,Usim,Isim}Card classes, they will be adjusted in subsequent patches. Change-Id: Id36140675def5fc44eedce81fc7b09e0adc527e1 --- M pySim/cards.py 1 file changed, 99 insertions(+), 68 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/90/33690/3 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33690 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Id36140675def5fc44eedce81fc7b09e0adc527e1 Gerrit-Change-Number: 33690 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newpatchset
1 0
0 0
[M] Change in pysim[master]: Introduce concept of CardProfileAddon
by laforge 11 Jul '23

11 Jul '23
Attention is currently required from: laforge. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/pysim/+/33699 to look at the new patch set (#2). Change subject: Introduce concept of CardProfileAddon ...................................................................... Introduce concept of CardProfileAddon We have a strict "one CardProfile per card" rule. For a modern UICC without legacy SIM support, that works great, as all applications have AID and ADF and can hence be enumerated/detected that way. However, in reality there are mostly UICC that have legacy SIM, GSM-R or even CDMA support, all of which are not proper UICC applications for historical reasons. So instead of having hard-coded hacks in various places, let's introduce the new concept of a CardProfileAddon. Every profile can have any number of those. When building up the RuntimeState, we iterate over the CardProfile addons, and probe which of those are actually on the card. For those discovered, we add their files to the filesystem hierarchy. Change-Id: I5866590b6d48f85eb889c9b1b8ab27936d2378b9 --- M pySim-shell.py M pySim/cdma_ruim.py M pySim/filesystem.py M pySim/gsm_r.py M pySim/profile.py M pySim/ts_102_221.py M pySim/ts_51_011.py M pysim-testdata/fakemagicsim.ok M pysim-testdata/sysmosim-gr1.ok 9 files changed, 123 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/99/33699/2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33699 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I5866590b6d48f85eb889c9b1b8ab27936d2378b9 Gerrit-Change-Number: 33699 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newpatchset
1 0
0 0
[L] Change in osmo-bts[master]: osmo-bts-trx: implement CSD scheduling support
by fixeria 11 Jul '23

11 Jul '23
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/32727 ) Change subject: osmo-bts-trx: implement CSD scheduling support ...................................................................... Patch Set 14: (1 comment) Patchset: PS14: This change breaks FACCH/[FH] on TCH/A[FH]S channels, marking as WIP. -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32727 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I08ffbf8e79ce76a586d61f5463890c6e72a6d9b9 Gerrit-Change-Number: 32727 Gerrit-PatchSet: 14 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 11 Jul 2023 16:24:14 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
[M] Change in pysim[master]: pySim/cards: Split legacy classes away from core SIM + UICC
by laforge 11 Jul '23

11 Jul '23
Attention is currently required from: laforge. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/pysim/+/33690 to look at the new patch set (#2). Change subject: pySim/cards: Split legacy classes away from core SIM + UICC ...................................................................... pySim/cards: Split legacy classes away from core SIM + UICC This introduces an internal split between * the code that is shared between pySim-shell and legacy tools, which is now in the new class hierarchy {Card,SimCard,UiccCard}Base * the code that is only used by legacy tools, which is using the old class names inherited from the *Base above All users still go through the legacy {Sim,Usim,Isim}Card classes, they will be adjusted in subsequent patches. Change-Id: Id36140675def5fc44eedce81fc7b09e0adc527e1 --- M pySim/cards.py 1 file changed, 97 insertions(+), 67 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/90/33690/2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33690 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Id36140675def5fc44eedce81fc7b09e0adc527e1 Gerrit-Change-Number: 33690 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in pysim[master]: pySim/cards: Add type annotations
by laforge 11 Jul '23

11 Jul '23
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/33692 ) Change subject: pySim/cards: Add type annotations ...................................................................... pySim/cards: Add type annotations Change-Id: Id5752a64b59097584301c860ebf74d858ed3d240 --- M pySim/cards.py 1 file changed, 22 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/92/33692/1 diff --git a/pySim/cards.py b/pySim/cards.py index 07966d0..a9f2e59 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -24,13 +24,15 @@ from typing import Optional, Dict, Tuple from pySim.ts_102_221 import EF_DIR, EF_ICCID +from pySim.transport import LinkBase import abc from pySim.utils import * +from pySim.commands import Path class CardBase: """General base class for some kind of telecommunications card.""" - def __init__(self, scc): + def __init__(self, scc: LinkBase): self._scc = scc def reset(self): @@ -41,12 +43,12 @@ return None self._aids = [] - def set_apdu_parameter(self, cla, sel_ctrl): + def set_apdu_parameter(self, cla: Hexstr, sel_ctrl: Hexstr): """Set apdu parameters (class byte and selection control bytes)""" self._scc.cla_byte = cla self._scc.sel_ctrl = sel_ctrl - def get_apdu_parameter(self): + def get_apdu_parameter(self) -> Tuple[Hexstr, Hexstr]: """Get apdu parameters (class byte and selection control bytes)""" return (self._scc.cla_byte, self._scc.sel_ctrl) @@ -54,14 +56,14 @@ print("warning: erasing is not supported for specified card type!") return - def file_exists(self, fid): + def file_exists(self, fid: Path) -> bool: res_arr = self._scc.try_select_path(fid) for res in res_arr: if res[1] != '9000': return False return True - def read_iccid(self): + def read_iccid(self) -> Tuple[Optional[Hexstr], SwHexstr]: ef_iccid = EF_ICCID() (res, sw) = self._scc.read_binary(ef_iccid.fid) if sw == '9000': @@ -80,12 +82,12 @@ class UiccCardBase(SimCardBase): name = 'UICC' - def __init__(self, ssc): + def __init__(self, ssc: LinkBase): super(UiccCardBase, self).__init__(ssc) # See also: ETSI TS 102 221, Table 9.3 self._adm_chv_num = 0xA0 - def read_aids(self): + def read_aids(self) -> List[Hexstr]: """Fetch all the AIDs present on UICC""" self._aids = [] try: @@ -104,7 +106,7 @@ return self._aids @staticmethod - def _get_aid(adf="usim") -> str: + def _get_aid(adf="usim") -> Hexstr: aid_map = {} # First (known) halves of the U/ISIM AID aid_map["usim"] = "a0000000871002" @@ -114,7 +116,7 @@ return aid_map[adf] return None - def _complete_aid(self, aid) -> str: + def _complete_aid(self, aid) -> Hexstr: """find the complete version of an ADF.U/ISIM AID""" # Find full AID by partial AID: if is_hex(aid): @@ -123,7 +125,7 @@ return aid_known return None - def adf_present(self, adf="usim") -> bool: + def adf_present(self, adf: str = "usim") -> bool: """Check if the AID of the specified ADF is present in EF.DIR (call read_aids before use)""" aid = self._get_aid(adf) if aid: @@ -132,7 +134,7 @@ return True return False - def select_adf_by_aid(self, adf="usim"): + def select_adf_by_aid(self, adf: str = "usim") -> Tuple[Optional[Hexstr], Optional[SwHexstr]]: """Select ADF.U/ISIM in the Card using its full AID""" if is_hex(adf): aid = adf -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33692 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Id5752a64b59097584301c860ebf74d858ed3d240 Gerrit-Change-Number: 33692 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in pysim[master]: pySim/cards: Split legacy classes away from core SIM + UICC
by laforge 11 Jul '23

11 Jul '23
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/33690 ) Change subject: pySim/cards: Split legacy classes away from core SIM + UICC ...................................................................... pySim/cards: Split legacy classes away from core SIM + UICC This introduces an internal split between * the code that is shared between pySim-shell and legacy tools, which is now in the new class hierarchy {Card,SimCard,UiccCard}Base * the code that is only used by legacy tools, which is using the old class names inherited from the *Base above All users still go through the legacy {Sim,Usim,Isim}Card classes, they will be adjusted in subsequent patches. Change-Id: Id36140675def5fc44eedce81fc7b09e0adc527e1 --- M pySim/cards.py 1 file changed, 94 insertions(+), 68 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/90/33690/1 diff --git a/pySim/cards.py b/pySim/cards.py index d3a43f3..2cbc507 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -5,7 +5,7 @@ # # Copyright (C) 2009-2010 Sylvain Munaut <tnt(a)246tNt.com> -# Copyright (C) 2011 Harald Welte <laforge(a)gnumonks.org> +# Copyright (C) 2011-2023 Harald Welte <laforge(a)gnumonks.org> # Copyright (C) 2017 Alexander.Chemeris <Alexander.Chemeris(a)gmail.com> # # This program is free software: you can redistribute it and/or modify @@ -25,13 +25,76 @@ from typing import Optional, Dict, Tuple import abc -from pySim.ts_51_011 import EF, DF, EF_AD, EF_SPN -from pySim.ts_31_102 import EF_USIM_ADF_map -from pySim.ts_31_103 import EF_ISIM_ADF_map from pySim.utils import * + +class CardBase: + """General base class for some kind of telecommunications card.""" + def __init__(self, scc): + self._scc = scc + + def reset(self): + rc = self._scc.reset_card() + if rc == 1: + return self._scc.get_atr() + else: + return None + self._aids = [] + + def set_apdu_parameter(self, cla, sel_ctrl): + """Set apdu parameters (class byte and selection control bytes)""" + self._scc.cla_byte = cla + self._scc.sel_ctrl = sel_ctrl + + def get_apdu_parameter(self): + """Get apdu parameters (class byte and selection control bytes)""" + return (self._scc.cla_byte, self._scc.sel_ctrl) + + def erase(self): + print("warning: erasing is not supported for specified card type!") + return + + def file_exists(self, fid): + res_arr = self._scc.try_select_path(fid) + for res in res_arr: + if res[1] != '9000': + return False + return True + + +class SimCardBase(CardBase): + + """Here we only add methods for commands specified in TS 51.011, without + any higher-layer processing.""" + + name = 'SIM' + + def read_binary(self, ef, length=None, offset=0): + ef_path = ef in EF and EF[ef] or ef + return self._scc.read_binary(ef_path, length, offset) + + def read_record(self, ef, rec_no): + ef_path = ef in EF and EF[ef] or ef + return self._scc.read_record(ef_path, rec_no) + + +class UiccCardBase(SimCardBase): + name = 'UICC' + + def __init__(self, ssc): + super(UiccCardBase, self).__init__(ssc) + # See also: ETSI TS 102 221, Table 9.3 + self._adm_chv_num = 0xA0 + +################################################################################ +# LEGACY +################################################################################ + from smartcard.util import toBytes from pytlv.TLV import * +from pySim.ts_51_011 import EF, DF, EF_AD, EF_SPN +from pySim.ts_31_102 import EF_USIM_ADF_map +from pySim.ts_31_103 import EF_ISIM_ADF_map def format_addr(addr: str, addr_type: str) -> str: """ @@ -52,32 +115,13 @@ return res -class SimCard: - name = 'SIM' +class SimCard(SimCardBase): + """Higher-layer class that is used *only* by legacy pySim-{prog,read}.""" def __init__(self, scc): - self._scc = scc self._adm_chv_num = 4 - self._aids = [] - - def reset(self): - rc = self._scc.reset_card() - if rc == 1: - return self._scc.get_atr() - else: - return None - - def erase(self): - print("warning: erasing is not supported for specified card type!") - return - - def file_exists(self, fid): - res_arr = self._scc.try_select_path(fid) - for res in res_arr: - if res[1] != '9000': - return False - return True + super().__init__(scc) def verify_adm(self, key): """Authenticate with ADM key""" @@ -252,14 +296,6 @@ data, sw = self._scc.update_binary(EF['SPN'], content) return sw - def read_binary(self, ef, length=None, offset=0): - ef_path = ef in EF and EF[ef] or ef - return self._scc.read_binary(ef_path, length, offset) - - def read_record(self, ef, rec_no): - ef_path = ef in EF and EF[ef] or ef - return self._scc.read_record(ef_path, rec_no) - def read_gid1(self): (res, sw) = self._scc.read_binary(EF['GID1']) if sw == '9000': @@ -274,6 +310,10 @@ else: return (None, sw) + +class UsimCard(UiccCardBase, SimCard): + """Higher-layer class that is used *only* by legacy pySim-{prog,read}.""" + def read_aids(self): """Fetch all the AIDs present on UICC""" self._aids = [] @@ -335,36 +375,6 @@ return self._scc.select_adf(aid) return (None, None) - def erase_binary(self, ef): - """Erase the contents of a file""" - len = self._scc.binary_size(ef) - self._scc.update_binary(ef, "ff" * len, offset=0, verify=True) - - def erase_record(self, ef, rec_no): - """Erase the contents of a single record""" - len = self._scc.record_size(ef) - self._scc.update_record(ef, rec_no, "ff" * len, - force_len=False, verify=True) - - def set_apdu_parameter(self, cla, sel_ctrl): - """Set apdu parameters (class byte and selection control bytes)""" - self._scc.cla_byte = cla - self._scc.sel_ctrl = sel_ctrl - - def get_apdu_parameter(self): - """Get apdu parameters (class byte and selection control bytes)""" - return (self._scc.cla_byte, self._scc.sel_ctrl) - - -class UsimCard(SimCard): - - name = 'USIM' - - def __init__(self, ssc): - super(UsimCard, self).__init__(ssc) - - # See also: ETSI TS 102 221, Table 9.3 - self._adm_chv_num = 0xA0 def read_ehplmn(self): (res, sw) = self._scc.read_binary(EF_USIM_ADF_map['EHPLMN']) @@ -469,13 +479,11 @@ -class IsimCard(SimCard): +class IsimCard(UiccCardBase): + """Higher-layer class that is used *only* by legacy pySim-{prog,read}.""" name = 'ISIM' - def __init__(self, ssc): - super(IsimCard, self).__init__(ssc) - def read_pcscf(self): rec_cnt = self._scc.record_count(EF_ISIM_ADF_map['PCSCF']) pcscf_recs = "" -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33690 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Id36140675def5fc44eedce81fc7b09e0adc527e1 Gerrit-Change-Number: 33690 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in pysim[master]: ts_31_102, ts_31_103: Move legacy-only code to pySim.legacy
by laforge 11 Jul '23

11 Jul '23
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/33694 ) Change subject: ts_31_102, ts_31_103: Move legacy-only code to pySim.legacy ...................................................................... ts_31_102, ts_31_103: Move legacy-only code to pySim.legacy Change-Id: Ifebfbbc00ef0d01cafd6f058a32d243d3696e97e --- M pySim-read.py M pySim/legacy/cards.py A pySim/legacy/ts_31_102.py A pySim/legacy/ts_31_103.py M pySim/ts_31_102.py M pySim/ts_31_103.py 6 files changed, 193 insertions(+), 137 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/94/33694/1 diff --git a/pySim-read.py b/pySim-read.py index 74bb35a..bafaf26 100755 --- a/pySim-read.py +++ b/pySim-read.py @@ -28,10 +28,13 @@ import random import re import sys + from pySim.ts_51_011 import EF_SST_map, EF_AD from pySim.legacy.ts_51_011 import EF, DF -from pySim.ts_31_102 import EF_UST_map, EF_USIM_ADF_map -from pySim.ts_31_103 import EF_IST_map, EF_ISIM_ADF_map +from pySim.ts_31_102 import EF_UST_map +from pySim.legacy.ts_31_102 import EF_USIM_ADF_map +from pySim.ts_31_103 import EF_IST_map +from pySim.legacy.ts_31_103 import EF_ISIM_ADF_map from pySim.commands import SimCardCommands from pySim.transport import init_reader, argparse_add_reader_args diff --git a/pySim/legacy/cards.py b/pySim/legacy/cards.py index c134d30..02c78d4 100644 --- a/pySim/legacy/cards.py +++ b/pySim/legacy/cards.py @@ -13,10 +13,10 @@ from pySim.legacy.utils import enc_ePDGSelection, format_xplmn_w_act, format_xplmn, dec_st, enc_st from pySim.legacy.utils import format_ePDGSelection from pySim.legacy.ts_51_011 import EF, DF +from pySim.legacy.ts_31_102 import EF_USIM_ADF_map +from pySim.legacy.ts_31_103 import EF_ISIM_ADF_map from pySim.ts_51_011 import EF_AD, EF_SPN -from pySim.ts_31_102 import EF_USIM_ADF_map -from pySim.ts_31_103 import EF_ISIM_ADF_map def format_addr(addr: str, addr_type: str) -> str: """ diff --git a/pySim/legacy/ts_31_102.py b/pySim/legacy/ts_31_102.py new file mode 100644 index 0000000..c4a829e --- /dev/null +++ b/pySim/legacy/ts_31_102.py @@ -0,0 +1,134 @@ +# -*- coding: utf-8 -*- + +""" +Various constants from 3GPP TS 31.102 V17.9.0 usd by *legacy* code +""" + +# +# Copyright (C) 2020 Supreeth Herle <herlesupreeth(a)gmail.com> +# Copyright (C) 2021-2023 Harald Welte <laforge(a)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 +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +EF_USIM_ADF_map = { + 'LI': '6F05', + 'ARR': '6F06', + 'IMSI': '6F07', + 'Keys': '6F08', + 'KeysPS': '6F09', + 'DCK': '6F2C', + 'HPPLMN': '6F31', + 'CNL': '6F32', + 'ACMmax': '6F37', + 'UST': '6F38', + 'ACM': '6F39', + 'FDN': '6F3B', + 'SMS': '6F3C', + 'GID1': '6F3E', + 'GID2': '6F3F', + 'MSISDN': '6F40', + 'PUCT': '6F41', + 'SMSP': '6F42', + 'SMSS': '6F42', + 'CBMI': '6F45', + 'SPN': '6F46', + 'SMSR': '6F47', + 'CBMID': '6F48', + 'SDN': '6F49', + 'EXT2': '6F4B', + 'EXT3': '6F4C', + 'BDN': '6F4D', + 'EXT5': '6F4E', + 'CCP2': '6F4F', + 'CBMIR': '6F50', + 'EXT4': '6F55', + 'EST': '6F56', + 'ACL': '6F57', + 'CMI': '6F58', + 'START-HFN': '6F5B', + 'THRESHOLD': '6F5C', + 'PLMNwAcT': '6F60', + 'OPLMNwAcT': '6F61', + 'HPLMNwAcT': '6F62', + 'PSLOCI': '6F73', + 'ACC': '6F78', + 'FPLMN': '6F7B', + 'LOCI': '6F7E', + 'ICI': '6F80', + 'OCI': '6F81', + 'ICT': '6F82', + 'OCT': '6F83', + 'AD': '6FAD', + 'VGCS': '6FB1', + 'VGCSS': '6FB2', + 'VBS': '6FB3', + 'VBSS': '6FB4', + 'eMLPP': '6FB5', + 'AAeM': '6FB6', + 'ECC': '6FB7', + 'Hiddenkey': '6FC3', + 'NETPAR': '6FC4', + 'PNN': '6FC5', + 'OPL': '6FC6', + 'MBDN': '6FC7', + 'EXT6': '6FC8', + 'MBI': '6FC9', + 'MWIS': '6FCA', + 'CFIS': '6FCB', + 'EXT7': '6FCC', + 'SPDI': '6FCD', + 'MMSN': '6FCE', + 'EXT8': '6FCF', + 'MMSICP': '6FD0', + 'MMSUP': '6FD1', + 'MMSUCP': '6FD2', + 'NIA': '6FD3', + 'VGCSCA': '6FD4', + 'VBSCA': '6FD5', + 'GBAP': '6FD6', + 'MSK': '6FD7', + 'MUK': '6FD8', + 'EHPLMN': '6FD9', + 'GBANL': '6FDA', + 'EHPLMNPI': '6FDB', + 'LRPLMNSI': '6FDC', + 'NAFKCA': '6FDD', + 'SPNI': '6FDE', + 'PNNI': '6FDF', + 'NCP-IP': '6FE2', + 'EPSLOCI': '6FE3', + 'EPSNSC': '6FE4', + 'UFC': '6FE6', + 'UICCIARI': '6FE7', + 'NASCONFIG': '6FE8', + 'PWC': '6FEC', + 'FDNURI': '6FED', + 'BDNURI': '6FEE', + 'SDNURI': '6FEF', + 'IWL': '6FF0', + 'IPS': '6FF1', + 'IPD': '6FF2', + 'ePDGId': '6FF3', + 'ePDGSelection': '6FF4', + 'ePDGIdEm': '6FF5', + 'ePDGSelectionEm': '6FF6', +} + +LOCI_STATUS_map = { + 0: 'updated', + 1: 'not updated', + 2: 'plmn not allowed', + 3: 'locatation area not allowed' +} diff --git a/pySim/legacy/ts_31_103.py b/pySim/legacy/ts_31_103.py new file mode 100644 index 0000000..f500f08 --- /dev/null +++ b/pySim/legacy/ts_31_103.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +""" +Various constants from 3GPP TS 31.103 V16.1.0 used by *legacy* code only +""" + +# Copyright (C) 2020 Supreeth Herle <herlesupreeth(a)gmail.com> +# Copyright (C) 2021 Harald Welte <laforge(a)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 +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +EF_ISIM_ADF_map = { + 'IST': '6F07', + 'IMPI': '6F02', + 'DOMAIN': '6F03', + 'IMPU': '6F04', + 'AD': '6FAD', + 'ARR': '6F06', + 'PCSCF': '6F09', + 'GBAP': '6FD5', + 'GBANL': '6FD7', + 'NAFKCA': '6FDD', + 'UICCIARI': '6FE7', + 'SMS': '6F3C', + 'SMSS': '6F43', + 'SMSR': '6F47', + 'SMSP': '6F42', + 'FromPreferred': '6FF7', + 'IMSConfigData': '6FF8', + 'XCAPConfigData': '6FFC', + 'WebRTCURI': '6FFA' +} diff --git a/pySim/ts_31_102.py b/pySim/ts_31_102.py index e7ae8f0..5db3e88 100644 --- a/pySim/ts_31_102.py +++ b/pySim/ts_31_102.py @@ -209,117 +209,6 @@ 3: 'APN Control List (ACL)' } -LOCI_STATUS_map = { - 0: 'updated', - 1: 'not updated', - 2: 'plmn not allowed', - 3: 'locatation area not allowed' -} - -EF_USIM_ADF_map = { - 'LI': '6F05', - 'ARR': '6F06', - 'IMSI': '6F07', - 'Keys': '6F08', - 'KeysPS': '6F09', - 'DCK': '6F2C', - 'HPPLMN': '6F31', - 'CNL': '6F32', - 'ACMmax': '6F37', - 'UST': '6F38', - 'ACM': '6F39', - 'FDN': '6F3B', - 'SMS': '6F3C', - 'GID1': '6F3E', - 'GID2': '6F3F', - 'MSISDN': '6F40', - 'PUCT': '6F41', - 'SMSP': '6F42', - 'SMSS': '6F42', - 'CBMI': '6F45', - 'SPN': '6F46', - 'SMSR': '6F47', - 'CBMID': '6F48', - 'SDN': '6F49', - 'EXT2': '6F4B', - 'EXT3': '6F4C', - 'BDN': '6F4D', - 'EXT5': '6F4E', - 'CCP2': '6F4F', - 'CBMIR': '6F50', - 'EXT4': '6F55', - 'EST': '6F56', - 'ACL': '6F57', - 'CMI': '6F58', - 'START-HFN': '6F5B', - 'THRESHOLD': '6F5C', - 'PLMNwAcT': '6F60', - 'OPLMNwAcT': '6F61', - 'HPLMNwAcT': '6F62', - 'PSLOCI': '6F73', - 'ACC': '6F78', - 'FPLMN': '6F7B', - 'LOCI': '6F7E', - 'ICI': '6F80', - 'OCI': '6F81', - 'ICT': '6F82', - 'OCT': '6F83', - 'AD': '6FAD', - 'VGCS': '6FB1', - 'VGCSS': '6FB2', - 'VBS': '6FB3', - 'VBSS': '6FB4', - 'eMLPP': '6FB5', - 'AAeM': '6FB6', - 'ECC': '6FB7', - 'Hiddenkey': '6FC3', - 'NETPAR': '6FC4', - 'PNN': '6FC5', - 'OPL': '6FC6', - 'MBDN': '6FC7', - 'EXT6': '6FC8', - 'MBI': '6FC9', - 'MWIS': '6FCA', - 'CFIS': '6FCB', - 'EXT7': '6FCC', - 'SPDI': '6FCD', - 'MMSN': '6FCE', - 'EXT8': '6FCF', - 'MMSICP': '6FD0', - 'MMSUP': '6FD1', - 'MMSUCP': '6FD2', - 'NIA': '6FD3', - 'VGCSCA': '6FD4', - 'VBSCA': '6FD5', - 'GBAP': '6FD6', - 'MSK': '6FD7', - 'MUK': '6FD8', - 'EHPLMN': '6FD9', - 'GBANL': '6FDA', - 'EHPLMNPI': '6FDB', - 'LRPLMNSI': '6FDC', - 'NAFKCA': '6FDD', - 'SPNI': '6FDE', - 'PNNI': '6FDF', - 'NCP-IP': '6FE2', - 'EPSLOCI': '6FE3', - 'EPSNSC': '6FE4', - 'UFC': '6FE6', - 'UICCIARI': '6FE7', - 'NASCONFIG': '6FE8', - 'PWC': '6FEC', - 'FDNURI': '6FED', - 'BDNURI': '6FEE', - 'SDNURI': '6FEF', - 'IWL': '6FF0', - 'IPS': '6FF1', - 'IPD': '6FF2', - 'ePDGId': '6FF3', - 'ePDGSelection': '6FF4', - 'ePDGIdEm': '6FF5', - 'ePDGSelectionEm': '6FF6', -} - # 3gPP TS 31.102 Section 7.5.2.1 class SUCI_TlvDataObject(BER_TLV_IE, tag=0xA1): _construct = HexAdapter(GreedyBytes) diff --git a/pySim/ts_31_103.py b/pySim/ts_31_103.py index f1c8dd7..5f374cb 100644 --- a/pySim/ts_31_103.py +++ b/pySim/ts_31_103.py @@ -56,28 +56,6 @@ 21: 'MuD and MiD configuration data', } -EF_ISIM_ADF_map = { - 'IST': '6F07', - 'IMPI': '6F02', - 'DOMAIN': '6F03', - 'IMPU': '6F04', - 'AD': '6FAD', - 'ARR': '6F06', - 'PCSCF': '6F09', - 'GBAP': '6FD5', - 'GBANL': '6FD7', - 'NAFKCA': '6FDD', - 'UICCIARI': '6FE7', - 'SMS': '6F3C', - 'SMSS': '6F43', - 'SMSR': '6F47', - 'SMSP': '6F42', - 'FromPreferred': '6FF7', - 'IMSConfigData': '6FF8', - 'XCAPConfigData': '6FFC', - 'WebRTCURI': '6FFA' -} - # TS 31.103 Section 4.2.2 class EF_IMPI(TransparentEF): _test_de_encode = [ -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33694 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Ifebfbbc00ef0d01cafd6f058a32d243d3696e97e Gerrit-Change-Number: 33694 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in pysim[master]: create pySim.legacy.ts_51_011.py and move legacy code there
by laforge 11 Jul '23

11 Jul '23
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/33693 ) Change subject: create pySim.legacy.ts_51_011.py and move legacy code there ...................................................................... create pySim.legacy.ts_51_011.py and move legacy code there Those old flat dicts indicating FID to string-name mapping have long been obsoleted by the pySim.filsystem based classes. Change-Id: I20ceea3fdb02ee70d8c8889c078b2e5a0f17c83b --- M pySim-prog.py M pySim-read.py M pySim/legacy/cards.py A pySim/legacy/ts_51_011.py M pySim/ts_51_011.py 5 files changed, 275 insertions(+), 233 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/93/33693/1 diff --git a/pySim-prog.py b/pySim-prog.py index 2e9d5d7..c07bfd1 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -38,7 +38,8 @@ from pySim.transport import init_reader from pySim.legacy.cards import _cards_classes, card_detect from pySim.utils import h2b, swap_nibbles, rpad, derive_milenage_opc, calculate_luhn, dec_iccid -from pySim.ts_51_011 import EF, EF_AD +from pySim.ts_51_011 import EF_AD +from pySim.legacy.ts_51_011 import EF from pySim.card_handler import * from pySim.utils import * diff --git a/pySim-read.py b/pySim-read.py index 52c60be..74bb35a 100755 --- a/pySim-read.py +++ b/pySim-read.py @@ -28,7 +28,8 @@ import random import re import sys -from pySim.ts_51_011 import EF, DF, EF_SST_map, EF_AD +from pySim.ts_51_011 import EF_SST_map, EF_AD +from pySim.legacy.ts_51_011 import EF, DF from pySim.ts_31_102 import EF_UST_map, EF_USIM_ADF_map from pySim.ts_31_103 import EF_IST_map, EF_ISIM_ADF_map diff --git a/pySim/legacy/cards.py b/pySim/legacy/cards.py index 401f5ed..c134d30 100644 --- a/pySim/legacy/cards.py +++ b/pySim/legacy/cards.py @@ -12,8 +12,9 @@ from pySim.utils import is_hex, h2b, b2h, h2s, s2h from pySim.legacy.utils import enc_ePDGSelection, format_xplmn_w_act, format_xplmn, dec_st, enc_st from pySim.legacy.utils import format_ePDGSelection +from pySim.legacy.ts_51_011 import EF, DF -from pySim.ts_51_011 import EF, DF, EF_AD, EF_SPN +from pySim.ts_51_011 import EF_AD, EF_SPN from pySim.ts_31_102 import EF_USIM_ADF_map from pySim.ts_31_103 import EF_ISIM_ADF_map diff --git a/pySim/legacy/ts_51_011.py b/pySim/legacy/ts_51_011.py new file mode 100644 index 0000000..3eea112 --- /dev/null +++ b/pySim/legacy/ts_51_011.py @@ -0,0 +1,257 @@ +# -*- coding: utf-8 -*- + +# without this, pylint will fail when inner classes are used +# within the 'nested' kwarg of our TlvMeta metaclass on python 3.7 :( +# pylint: disable=undefined-variable + +""" Various constants from 3GPP TS 51.011 used by *legacy* code only. +""" + +# Copyright (C) 2017 Alexander.Chemeris <Alexander.Chemeris(a)gmail.com> +# Copyright (C) 2021 Harald Welte <laforge(a)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 +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +MF_num = '3F00' + +DF_num = { + 'TELECOM': '7F10', + + 'GSM': '7F20', + 'IS-41': '7F22', + 'FP-CTS': '7F23', + + 'GRAPHICS': '5F50', + + 'IRIDIUM': '5F30', + 'GLOBST': '5F31', + 'ICO': '5F32', + 'ACeS': '5F33', + + 'EIA/TIA-553': '5F40', + 'CTS': '5F60', + 'SOLSA': '5F70', + + 'MExE': '5F3C', +} + +EF_num = { + # MF + 'ICCID': '2FE2', + 'ELP': '2F05', + 'DIR': '2F00', + + # DF_TELECOM + 'ADN': '6F3A', + 'FDN': '6F3B', + 'SMS': '6F3C', + 'CCP': '6F3D', + 'MSISDN': '6F40', + 'SMSP': '6F42', + 'SMSS': '6F43', + 'LND': '6F44', + 'SMSR': '6F47', + 'SDN': '6F49', + 'EXT1': '6F4A', + 'EXT2': '6F4B', + 'EXT3': '6F4C', + 'BDN': '6F4D', + 'EXT4': '6F4E', + 'CMI': '6F58', + 'ECCP': '6F4F', + + # DF_GRAPHICS + 'IMG': '4F20', + + # DF_SoLSA + 'SAI': '4F30', + 'SLL': '4F31', + + # DF_MExE + 'MExE-ST': '4F40', + 'ORPK': '4F41', + 'ARPK': '4F42', + 'TPRPK': '4F43', + + # DF_GSM + 'LP': '6F05', + 'IMSI': '6F07', + 'Kc': '6F20', + 'DCK': '6F2C', + 'PLMNsel': '6F30', + 'HPPLMN': '6F31', + 'CNL': '6F32', + 'ACMmax': '6F37', + 'SST': '6F38', + 'ACM': '6F39', + 'GID1': '6F3E', + 'GID2': '6F3F', + 'PUCT': '6F41', + 'CBMI': '6F45', + 'SPN': '6F46', + 'CBMID': '6F48', + 'BCCH': '6F74', + 'ACC': '6F78', + 'FPLMN': '6F7B', + 'LOCI': '6F7E', + 'AD': '6FAD', + 'PHASE': '6FAE', + 'VGCS': '6FB1', + 'VGCSS': '6FB2', + 'VBS': '6FB3', + 'VBSS': '6FB4', + 'eMLPP': '6FB5', + 'AAeM': '6FB6', + 'ECC': '6FB7', + 'CBMIR': '6F50', + 'NIA': '6F51', + 'KcGPRS': '6F52', + 'LOCIGPRS': '6F53', + 'SUME': '6F54', + 'PLMNwAcT': '6F60', + 'OPLMNwAcT': '6F61', + # Figure 8 names it HPLMNAcT, but in the text it's names it HPLMNwAcT + 'HPLMNAcT': '6F62', + 'HPLMNwAcT': '6F62', + 'CPBCCH': '6F63', + 'INVSCAN': '6F64', + 'PNN': '6FC5', + 'OPL': '6FC6', + 'MBDN': '6FC7', + 'EXT6': '6FC8', + 'MBI': '6FC9', + 'MWIS': '6FCA', + 'CFIS': '6FCB', + 'EXT7': '6FCC', + 'SPDI': '6FCD', + 'MMSN': '6FCE', + 'EXT8': '6FCF', + 'MMSICP': '6FD0', + 'MMSUP': '6FD1', + 'MMSUCP': '6FD2', +} + +DF = { + 'TELECOM': [MF_num, DF_num['TELECOM']], + + 'GSM': [MF_num, DF_num['GSM']], + 'IS-41': [MF_num, DF_num['IS-41']], + 'FP-CTS': [MF_num, DF_num['FP-CTS']], + + 'GRAPHICS': [MF_num, DF_num['GRAPHICS']], + + 'IRIDIUM': [MF_num, DF_num['IRIDIUM']], + 'GLOBST': [MF_num, DF_num['GLOBST']], + 'ICO': [MF_num, DF_num['ICO']], + 'ACeS': [MF_num, DF_num['ACeS']], + + 'EIA/TIA-553': [MF_num, DF_num['EIA/TIA-553']], + 'CTS': [MF_num, DF_num['CTS']], + 'SoLSA': [MF_num, DF_num['SOLSA']], + + 'MExE': [MF_num, DF_num['MExE']], +} + + +EF = { + 'ICCID': [MF_num, EF_num['ICCID']], + 'ELP': [MF_num, EF_num['ELP']], + 'DIR': [MF_num, EF_num['DIR']], + + 'ADN': DF['TELECOM']+[EF_num['ADN']], + 'FDN': DF['TELECOM']+[EF_num['FDN']], + 'SMS': DF['TELECOM']+[EF_num['SMS']], + 'CCP': DF['TELECOM']+[EF_num['CCP']], + 'MSISDN': DF['TELECOM']+[EF_num['MSISDN']], + 'SMSP': DF['TELECOM']+[EF_num['SMSP']], + 'SMSS': DF['TELECOM']+[EF_num['SMSS']], + 'LND': DF['TELECOM']+[EF_num['LND']], + 'SMSR': DF['TELECOM']+[EF_num['SMSR']], + 'SDN': DF['TELECOM']+[EF_num['SDN']], + 'EXT1': DF['TELECOM']+[EF_num['EXT1']], + 'EXT2': DF['TELECOM']+[EF_num['EXT2']], + 'EXT3': DF['TELECOM']+[EF_num['EXT3']], + 'BDN': DF['TELECOM']+[EF_num['BDN']], + 'EXT4': DF['TELECOM']+[EF_num['EXT4']], + 'CMI': DF['TELECOM']+[EF_num['CMI']], + 'ECCP': DF['TELECOM']+[EF_num['ECCP']], + + 'IMG': DF['GRAPHICS']+[EF_num['IMG']], + + 'SAI': DF['SoLSA']+[EF_num['SAI']], + 'SLL': DF['SoLSA']+[EF_num['SLL']], + + 'MExE-ST': DF['MExE']+[EF_num['MExE-ST']], + 'ORPK': DF['MExE']+[EF_num['ORPK']], + 'ARPK': DF['MExE']+[EF_num['ARPK']], + 'TPRPK': DF['MExE']+[EF_num['TPRPK']], + + 'LP': DF['GSM']+[EF_num['LP']], + 'IMSI': DF['GSM']+[EF_num['IMSI']], + 'Kc': DF['GSM']+[EF_num['Kc']], + 'DCK': DF['GSM']+[EF_num['DCK']], + 'PLMNsel': DF['GSM']+[EF_num['PLMNsel']], + 'HPPLMN': DF['GSM']+[EF_num['HPPLMN']], + 'CNL': DF['GSM']+[EF_num['CNL']], + 'ACMmax': DF['GSM']+[EF_num['ACMmax']], + 'SST': DF['GSM']+[EF_num['SST']], + 'ACM': DF['GSM']+[EF_num['ACM']], + 'GID1': DF['GSM']+[EF_num['GID1']], + 'GID2': DF['GSM']+[EF_num['GID2']], + 'PUCT': DF['GSM']+[EF_num['PUCT']], + 'CBMI': DF['GSM']+[EF_num['CBMI']], + 'SPN': DF['GSM']+[EF_num['SPN']], + 'CBMID': DF['GSM']+[EF_num['CBMID']], + 'BCCH': DF['GSM']+[EF_num['BCCH']], + 'ACC': DF['GSM']+[EF_num['ACC']], + 'FPLMN': DF['GSM']+[EF_num['FPLMN']], + 'LOCI': DF['GSM']+[EF_num['LOCI']], + 'AD': DF['GSM']+[EF_num['AD']], + 'PHASE': DF['GSM']+[EF_num['PHASE']], + 'VGCS': DF['GSM']+[EF_num['VGCS']], + 'VGCSS': DF['GSM']+[EF_num['VGCSS']], + 'VBS': DF['GSM']+[EF_num['VBS']], + 'VBSS': DF['GSM']+[EF_num['VBSS']], + 'eMLPP': DF['GSM']+[EF_num['eMLPP']], + 'AAeM': DF['GSM']+[EF_num['AAeM']], + 'ECC': DF['GSM']+[EF_num['ECC']], + 'CBMIR': DF['GSM']+[EF_num['CBMIR']], + 'NIA': DF['GSM']+[EF_num['NIA']], + 'KcGPRS': DF['GSM']+[EF_num['KcGPRS']], + 'LOCIGPRS': DF['GSM']+[EF_num['LOCIGPRS']], + 'SUME': DF['GSM']+[EF_num['SUME']], + 'PLMNwAcT': DF['GSM']+[EF_num['PLMNwAcT']], + 'OPLMNwAcT': DF['GSM']+[EF_num['OPLMNwAcT']], + # Figure 8 names it HPLMNAcT, but in the text it's names it HPLMNwAcT + 'HPLMNAcT': DF['GSM']+[EF_num['HPLMNAcT']], + 'HPLMNwAcT': DF['GSM']+[EF_num['HPLMNAcT']], + 'CPBCCH': DF['GSM']+[EF_num['CPBCCH']], + 'INVSCAN': DF['GSM']+[EF_num['INVSCAN']], + 'PNN': DF['GSM']+[EF_num['PNN']], + 'OPL': DF['GSM']+[EF_num['OPL']], + 'MBDN': DF['GSM']+[EF_num['MBDN']], + 'EXT6': DF['GSM']+[EF_num['EXT6']], + 'MBI': DF['GSM']+[EF_num['MBI']], + 'MWIS': DF['GSM']+[EF_num['MWIS']], + 'CFIS': DF['GSM']+[EF_num['CFIS']], + 'EXT7': DF['GSM']+[EF_num['EXT7']], + 'SPDI': DF['GSM']+[EF_num['SPDI']], + 'MMSN': DF['GSM']+[EF_num['MMSN']], + 'EXT8': DF['GSM']+[EF_num['EXT8']], + 'MMSICP': DF['GSM']+[EF_num['MMSICP']], + 'MMSUP': DF['GSM']+[EF_num['MMSUP']], + 'MMSUCP': DF['GSM']+[EF_num['MMSUCP']], +} + diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py index 700fb02..1f98e72 100644 --- a/pySim/ts_51_011.py +++ b/pySim/ts_51_011.py @@ -41,236 +41,6 @@ from typing import Tuple from pySim.tlv import * from pySim.utils import * -MF_num = '3F00' - -DF_num = { - 'TELECOM': '7F10', - - 'GSM': '7F20', - 'IS-41': '7F22', - 'FP-CTS': '7F23', - - 'GRAPHICS': '5F50', - - 'IRIDIUM': '5F30', - 'GLOBST': '5F31', - 'ICO': '5F32', - 'ACeS': '5F33', - - 'EIA/TIA-553': '5F40', - 'CTS': '5F60', - 'SOLSA': '5F70', - - 'MExE': '5F3C', -} - -EF_num = { - # MF - 'ICCID': '2FE2', - 'ELP': '2F05', - 'DIR': '2F00', - - # DF_TELECOM - 'ADN': '6F3A', - 'FDN': '6F3B', - 'SMS': '6F3C', - 'CCP': '6F3D', - 'MSISDN': '6F40', - 'SMSP': '6F42', - 'SMSS': '6F43', - 'LND': '6F44', - 'SMSR': '6F47', - 'SDN': '6F49', - 'EXT1': '6F4A', - 'EXT2': '6F4B', - 'EXT3': '6F4C', - 'BDN': '6F4D', - 'EXT4': '6F4E', - 'CMI': '6F58', - 'ECCP': '6F4F', - - # DF_GRAPHICS - 'IMG': '4F20', - - # DF_SoLSA - 'SAI': '4F30', - 'SLL': '4F31', - - # DF_MExE - 'MExE-ST': '4F40', - 'ORPK': '4F41', - 'ARPK': '4F42', - 'TPRPK': '4F43', - - # DF_GSM - 'LP': '6F05', - 'IMSI': '6F07', - 'Kc': '6F20', - 'DCK': '6F2C', - 'PLMNsel': '6F30', - 'HPPLMN': '6F31', - 'CNL': '6F32', - 'ACMmax': '6F37', - 'SST': '6F38', - 'ACM': '6F39', - 'GID1': '6F3E', - 'GID2': '6F3F', - 'PUCT': '6F41', - 'CBMI': '6F45', - 'SPN': '6F46', - 'CBMID': '6F48', - 'BCCH': '6F74', - 'ACC': '6F78', - 'FPLMN': '6F7B', - 'LOCI': '6F7E', - 'AD': '6FAD', - 'PHASE': '6FAE', - 'VGCS': '6FB1', - 'VGCSS': '6FB2', - 'VBS': '6FB3', - 'VBSS': '6FB4', - 'eMLPP': '6FB5', - 'AAeM': '6FB6', - 'ECC': '6FB7', - 'CBMIR': '6F50', - 'NIA': '6F51', - 'KcGPRS': '6F52', - 'LOCIGPRS': '6F53', - 'SUME': '6F54', - 'PLMNwAcT': '6F60', - 'OPLMNwAcT': '6F61', - # Figure 8 names it HPLMNAcT, but in the text it's names it HPLMNwAcT - 'HPLMNAcT': '6F62', - 'HPLMNwAcT': '6F62', - 'CPBCCH': '6F63', - 'INVSCAN': '6F64', - 'PNN': '6FC5', - 'OPL': '6FC6', - 'MBDN': '6FC7', - 'EXT6': '6FC8', - 'MBI': '6FC9', - 'MWIS': '6FCA', - 'CFIS': '6FCB', - 'EXT7': '6FCC', - 'SPDI': '6FCD', - 'MMSN': '6FCE', - 'EXT8': '6FCF', - 'MMSICP': '6FD0', - 'MMSUP': '6FD1', - 'MMSUCP': '6FD2', -} - -DF = { - 'TELECOM': [MF_num, DF_num['TELECOM']], - - 'GSM': [MF_num, DF_num['GSM']], - 'IS-41': [MF_num, DF_num['IS-41']], - 'FP-CTS': [MF_num, DF_num['FP-CTS']], - - 'GRAPHICS': [MF_num, DF_num['GRAPHICS']], - - 'IRIDIUM': [MF_num, DF_num['IRIDIUM']], - 'GLOBST': [MF_num, DF_num['GLOBST']], - 'ICO': [MF_num, DF_num['ICO']], - 'ACeS': [MF_num, DF_num['ACeS']], - - 'EIA/TIA-553': [MF_num, DF_num['EIA/TIA-553']], - 'CTS': [MF_num, DF_num['CTS']], - 'SoLSA': [MF_num, DF_num['SOLSA']], - - 'MExE': [MF_num, DF_num['MExE']], -} - - -EF = { - 'ICCID': [MF_num, EF_num['ICCID']], - 'ELP': [MF_num, EF_num['ELP']], - 'DIR': [MF_num, EF_num['DIR']], - - 'ADN': DF['TELECOM']+[EF_num['ADN']], - 'FDN': DF['TELECOM']+[EF_num['FDN']], - 'SMS': DF['TELECOM']+[EF_num['SMS']], - 'CCP': DF['TELECOM']+[EF_num['CCP']], - 'MSISDN': DF['TELECOM']+[EF_num['MSISDN']], - 'SMSP': DF['TELECOM']+[EF_num['SMSP']], - 'SMSS': DF['TELECOM']+[EF_num['SMSS']], - 'LND': DF['TELECOM']+[EF_num['LND']], - 'SMSR': DF['TELECOM']+[EF_num['SMSR']], - 'SDN': DF['TELECOM']+[EF_num['SDN']], - 'EXT1': DF['TELECOM']+[EF_num['EXT1']], - 'EXT2': DF['TELECOM']+[EF_num['EXT2']], - 'EXT3': DF['TELECOM']+[EF_num['EXT3']], - 'BDN': DF['TELECOM']+[EF_num['BDN']], - 'EXT4': DF['TELECOM']+[EF_num['EXT4']], - 'CMI': DF['TELECOM']+[EF_num['CMI']], - 'ECCP': DF['TELECOM']+[EF_num['ECCP']], - - 'IMG': DF['GRAPHICS']+[EF_num['IMG']], - - 'SAI': DF['SoLSA']+[EF_num['SAI']], - 'SLL': DF['SoLSA']+[EF_num['SLL']], - - 'MExE-ST': DF['MExE']+[EF_num['MExE-ST']], - 'ORPK': DF['MExE']+[EF_num['ORPK']], - 'ARPK': DF['MExE']+[EF_num['ARPK']], - 'TPRPK': DF['MExE']+[EF_num['TPRPK']], - - 'LP': DF['GSM']+[EF_num['LP']], - 'IMSI': DF['GSM']+[EF_num['IMSI']], - 'Kc': DF['GSM']+[EF_num['Kc']], - 'DCK': DF['GSM']+[EF_num['DCK']], - 'PLMNsel': DF['GSM']+[EF_num['PLMNsel']], - 'HPPLMN': DF['GSM']+[EF_num['HPPLMN']], - 'CNL': DF['GSM']+[EF_num['CNL']], - 'ACMmax': DF['GSM']+[EF_num['ACMmax']], - 'SST': DF['GSM']+[EF_num['SST']], - 'ACM': DF['GSM']+[EF_num['ACM']], - 'GID1': DF['GSM']+[EF_num['GID1']], - 'GID2': DF['GSM']+[EF_num['GID2']], - 'PUCT': DF['GSM']+[EF_num['PUCT']], - 'CBMI': DF['GSM']+[EF_num['CBMI']], - 'SPN': DF['GSM']+[EF_num['SPN']], - 'CBMID': DF['GSM']+[EF_num['CBMID']], - 'BCCH': DF['GSM']+[EF_num['BCCH']], - 'ACC': DF['GSM']+[EF_num['ACC']], - 'FPLMN': DF['GSM']+[EF_num['FPLMN']], - 'LOCI': DF['GSM']+[EF_num['LOCI']], - 'AD': DF['GSM']+[EF_num['AD']], - 'PHASE': DF['GSM']+[EF_num['PHASE']], - 'VGCS': DF['GSM']+[EF_num['VGCS']], - 'VGCSS': DF['GSM']+[EF_num['VGCSS']], - 'VBS': DF['GSM']+[EF_num['VBS']], - 'VBSS': DF['GSM']+[EF_num['VBSS']], - 'eMLPP': DF['GSM']+[EF_num['eMLPP']], - 'AAeM': DF['GSM']+[EF_num['AAeM']], - 'ECC': DF['GSM']+[EF_num['ECC']], - 'CBMIR': DF['GSM']+[EF_num['CBMIR']], - 'NIA': DF['GSM']+[EF_num['NIA']], - 'KcGPRS': DF['GSM']+[EF_num['KcGPRS']], - 'LOCIGPRS': DF['GSM']+[EF_num['LOCIGPRS']], - 'SUME': DF['GSM']+[EF_num['SUME']], - 'PLMNwAcT': DF['GSM']+[EF_num['PLMNwAcT']], - 'OPLMNwAcT': DF['GSM']+[EF_num['OPLMNwAcT']], - # Figure 8 names it HPLMNAcT, but in the text it's names it HPLMNwAcT - 'HPLMNAcT': DF['GSM']+[EF_num['HPLMNAcT']], - 'HPLMNwAcT': DF['GSM']+[EF_num['HPLMNAcT']], - 'CPBCCH': DF['GSM']+[EF_num['CPBCCH']], - 'INVSCAN': DF['GSM']+[EF_num['INVSCAN']], - 'PNN': DF['GSM']+[EF_num['PNN']], - 'OPL': DF['GSM']+[EF_num['OPL']], - 'MBDN': DF['GSM']+[EF_num['MBDN']], - 'EXT6': DF['GSM']+[EF_num['EXT6']], - 'MBI': DF['GSM']+[EF_num['MBI']], - 'MWIS': DF['GSM']+[EF_num['MWIS']], - 'CFIS': DF['GSM']+[EF_num['CFIS']], - 'EXT7': DF['GSM']+[EF_num['EXT7']], - 'SPDI': DF['GSM']+[EF_num['SPDI']], - 'MMSN': DF['GSM']+[EF_num['MMSN']], - 'EXT8': DF['GSM']+[EF_num['EXT8']], - 'MMSICP': DF['GSM']+[EF_num['MMSICP']], - 'MMSUP': DF['GSM']+[EF_num['MMSUP']], - 'MMSUCP': DF['GSM']+[EF_num['MMSUCP']], -} # Mapping between SIM Service Number and its description EF_SST_map = { -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33693 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I20ceea3fdb02ee70d8c8889c078b2e5a0f17c83b Gerrit-Change-Number: 33693 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in pysim[master]: cards: All derived of SimCardBase use CLA=A0; all UiccCardBase use CL...
by laforge 11 Jul '23

11 Jul '23
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/33695 ) Change subject: cards: All derived of SimCardBase use CLA=A0; all UiccCardBase use CLA=00 ...................................................................... cards: All derived of SimCardBase use CLA=A0; all UiccCardBase use CLA=00 Change-Id: Id61b549f68410631529349ee62b08a102f609405 --- M pySim/cards.py M pySim/legacy/cards.py 2 files changed, 14 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/95/33695/1 diff --git a/pySim/cards.py b/pySim/cards.py index a9f2e59..2f4260f 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -76,6 +76,10 @@ """Here we only add methods for commands specified in TS 51.011, without any higher-layer processing.""" + def __init__(self, scc: LinkBase): + super(SimCardBase, self).__init__(scc) + self._scc.cla_byte = "A0" + name = 'SIM' @@ -84,6 +88,7 @@ def __init__(self, ssc: LinkBase): super(UiccCardBase, self).__init__(ssc) + self._scc.cla_byte = "00" # See also: ETSI TS 102 221, Table 9.3 self._adm_chv_num = 0xA0 diff --git a/pySim/legacy/cards.py b/pySim/legacy/cards.py index 02c78d4..b865d4b 100644 --- a/pySim/legacy/cards.py +++ b/pySim/legacy/cards.py @@ -892,7 +892,6 @@ def __init__(self, ssc): super(SysmoUSIMSJS1, self).__init__(ssc) - self._scc.cla_byte = "00" self._scc.sel_ctrl = "0004" # request an FCP @classmethod @@ -1205,7 +1204,6 @@ def __init__(self, ssc): super(WavemobileSim, self).__init__(ssc) self._adm_chv_num = 0x0A - self._scc.cla_byte = "00" self._scc.sel_ctrl = "0004" # request an FCP @classmethod @@ -1300,7 +1298,6 @@ def __init__(self, ssc): super(SysmoISIMSJA2, self).__init__(ssc) - self._scc.cla_byte = "00" self._scc.sel_ctrl = "0004" # request an FCP @classmethod -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33695 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Id61b549f68410631529349ee62b08a102f609405 Gerrit-Change-Number: 33695 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in pysim[master]: cards: cosmetic rename, argument name should be scc, not ssc
by laforge 11 Jul '23

11 Jul '23
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/33696 ) Change subject: cards: cosmetic rename, argument name should be scc, not ssc ...................................................................... cards: cosmetic rename, argument name should be scc, not ssc ssc = SimCardCommands Change-Id: I9d690a0a5b9b49ea342728a29b7d4ed10ac31e4e --- M pySim/cards.py 1 file changed, 13 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/96/33696/1 diff --git a/pySim/cards.py b/pySim/cards.py index 2f4260f..5ee8b4a 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -86,8 +86,8 @@ class UiccCardBase(SimCardBase): name = 'UICC' - def __init__(self, ssc: LinkBase): - super(UiccCardBase, self).__init__(ssc) + def __init__(self, scc: LinkBase): + super(UiccCardBase, self).__init__(scc) self._scc.cla_byte = "00" # See also: ETSI TS 102 221, Table 9.3 self._adm_chv_num = 0xA0 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33696 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I9d690a0a5b9b49ea342728a29b7d4ed10ac31e4e Gerrit-Change-Number: 33696 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • ...
  • 306
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.