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

August 2024

  • 1 participants
  • 1478 discussions
[XS] Change in osmo-ttcn3-hacks[master]: testenv: fix testsuite.run() not passing env variables
by laforge 30 Aug '24

30 Aug '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37933?usp=email ) Change subject: testenv: fix testsuite.run() not passing env variables ...................................................................... testenv: fix testsuite.run() not passing env variables Running start-testsuite.sh in a clean env fails on systems with non- standard TTCN3_BIN_DIR and TITAN_LIBRARY_PATH paths. This is the case for Arch Linux and the eclipse-titan AUR package. Let's call cmd.generate_env() to allow overriding these variables. Change-Id: I95c3cfe41ee230927bb5777631372597cbd3c051 --- M _testenv/testenv/testsuite.py 1 file changed, 2 insertions(+), 3 deletions(-) Approvals: pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/_testenv/testenv/testsuite.py b/_testenv/testenv/testsuite.py index 88ea467..077d3f1 100644 --- a/_testenv/testenv/testsuite.py +++ b/_testenv/testenv/testsuite.py @@ -162,9 +162,8 @@ start_testsuite = os.path.join(ttcn3_hacks_dir, "start-testsuite.sh") suite = os.path.join(ttcn3_hacks_dir, testenv.args.testsuite, section_data["program"]) - env = { - "TTCN3_PCAP_PATH": os.path.join(testenv.testdir.testdir, "testsuite"), - } + pcap_path = os.path.join(testenv.testdir.testdir, "testsuite") + env = testenv.cmd.generate_env({ "TTCN3_PCAP_PATH" : pcap_path }) cmd = [start_testsuite, suite, section_data["config"]] -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37933?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: I95c3cfe41ee230927bb5777631372597cbd3c051 Gerrit-Change-Number: 37933 Gerrit-PatchSet: 3 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[master]: testenv: fix testsuite.run() not passing env variables
by laforge 30 Aug '24

30 Aug '24
Attention is currently required from: fixeria, osmith. laforge has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37933?usp=email ) Change subject: testenv: fix testsuite.run() not passing env variables ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37933?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: I95c3cfe41ee230927bb5777631372597cbd3c051 Gerrit-Change-Number: 37933 Gerrit-PatchSet: 3 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Fri, 30 Aug 2024 05:09:37 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in pysim[master]: suci-tutorial: fix spec reference
by laforge 30 Aug '24

30 Aug '24
Attention is currently required from: dexter. laforge has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/37949?usp=email ) Change subject: suci-tutorial: fix spec reference ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/37949?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: If98c0b1093c7d19ea0278758c635b8405b465a2e Gerrit-Change-Number: 37949 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Fri, 30 Aug 2024 05:08:51 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in pysim[master]: suci-tutorial: put download links for specs to the front
by laforge 30 Aug '24

30 Aug '24
Attention is currently required from: dexter. laforge has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/37948?usp=email ) Change subject: suci-tutorial: put download links for specs to the front ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/37948?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: Ibcbc6bb5d836d32c381922a35afa3b73b5f90621 Gerrit-Change-Number: 37948 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Fri, 30 Aug 2024 05:08:43 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in pysim[master]: suci-tutorial: fix incorrect hnet_pubkey value
by laforge 30 Aug '24

30 Aug '24
Attention is currently required from: dexter. laforge has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/37946?usp=email ) Change subject: suci-tutorial: fix incorrect hnet_pubkey value ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/37946?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: I6fddf8a6efc28ad0d40b1715973429904e00d2b2 Gerrit-Change-Number: 37946 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Fri, 30 Aug 2024 05:08:05 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in pysim[master]: scp: fix key length in dek_encrypt and dek_decrypt
by laforge 30 Aug '24

30 Aug '24
Attention is currently required from: dexter. laforge has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/37931?usp=email ) Change subject: scp: fix key length in dek_encrypt and dek_decrypt ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/37931?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: I92e0dc6a6196b532bd8b53fca7b9e78070d6903f Gerrit-Change-Number: 37931 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Fri, 30 Aug 2024 05:05:29 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[master]: s1gw: rename module ConnHdlr -> S1GW_ConnHdlr
by fixeria 30 Aug '24

30 Aug '24
fixeria has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37950?usp=email ) Change subject: s1gw: rename module ConnHdlr -> S1GW_ConnHdlr ...................................................................... s1gw: rename module ConnHdlr -> S1GW_ConnHdlr This fixes the following warning: ConnHdlr.ttcn:39.1-43.1: warning: Definition with name `ConnHdlr' hides a module identifier Change-Id: I47364a35720059d6a51f004a5692b9a0c1ad98d8 --- R s1gw/S1GW_ConnHdlr.ttcn M s1gw/S1GW_Tests.ttcn 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/50/37950/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37950?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I47364a35720059d6a51f004a5692b9a0c1ad98d8 Gerrit-Change-Number: 37950 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: Jenkins Builder
1 0
0 0
[XS] Change in pysim[master]: tests: move unittests into a sub directory
by laforge 30 Aug '24

30 Aug '24
Attention is currently required from: dexter. laforge has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/37821?usp=email ) Change subject: tests: move unittests into a sub directory ...................................................................... Patch Set 9: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/37821?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: I0978c5353d0d479a050bbb6e7ae5a63db5e08d24 Gerrit-Change-Number: 37821 Gerrit-PatchSet: 9 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Fri, 30 Aug 2024 05:04:21 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in pysim[master]: commands: get rid of cla4lchan
by laforge 30 Aug '24

30 Aug '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/37936?usp=email ) Change subject: commands: get rid of cla4lchan ...................................................................... commands: get rid of cla4lchan The send_apdu* methods now support lchan patching, so there is no longer a need for computing the class byte manually (which is prone get forgotten) before calling a send_apdu*. It is now enough to supply an APDU that has a class byte with the default channel selected. This also means we do not need cla4lchan anymore, so let's restruture the code and get rid of it completely. Related: OS#6531 Change-Id: Ia795f3c16a8875484fce3b44e61497d5aa52b447 --- M pySim/commands.py M pySim/euicc.py 2 files changed, 11 insertions(+), 24 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/commands.py b/pySim/commands.py index 3a7fe47..9e231f1 100644 --- a/pySim/commands.py +++ b/pySim/commands.py @@ -81,8 +81,8 @@ @property def cla_byte(self) -> Hexstr: - """Return the (cached) patched default CLA byte for this card.""" - return self._cla4lchan + """Return the lchan patched default CLA value for this card.""" + return cla_with_lchan(self._cla_byte, self.lchan_nr) @property def max_cmd_len(self) -> int: @@ -96,19 +96,6 @@ def cla_byte(self, new_val: Hexstr): """Set the (raw, without lchan) default CLA value for this card.""" self._cla_byte = new_val - # compute cached result - self._cla4lchan = cla_with_lchan(self._cla_byte, self.lchan_nr) - - def cla4lchan(self, cla: Hexstr) -> Hexstr: - """Compute the lchan-patched value of the given CLA value. If no CLA - value is provided as argument, the lchan-patched version of the SimCardCommands._cla_byte - value is used. Most commands will use the latter, while some wish to override it and - can pass it as argument here.""" - if not cla: - # return cached result to avoid re-computing this over and over again - return self._cla4lchan - else: - return cla_with_lchan(cla, self.lchan_nr) def send_apdu(self, pdu: Hexstr, apply_lchan:bool = True) -> ResTuple: """Sends an APDU and auto fetch response data @@ -122,7 +109,7 @@ sw : string (in hex) of status word (ex. "9000") """ if apply_lchan: - pdu = self.cla4lchan(pdu[0:2]) + pdu[2:] + pdu = cla_with_lchan(pdu[0:2], self.lchan_nr) + pdu[2:] if self.scp: return self.scp.send_apdu_wrapper(self._tp.send_apdu, pdu) else: @@ -142,7 +129,7 @@ sw : string (in hex) of status word (ex. "9000") """ if apply_lchan: - pdu = self.cla4lchan(pdu[0:2]) + pdu[2:] + pdu = cla_with_lchan(pdu[0:2], self.lchan_nr) + pdu[2:] if self.scp: return self.scp.send_apdu_wrapper(self._tp.send_apdu_checksw, pdu, sw) else: @@ -517,9 +504,9 @@ # TS 102 221 Section 11.3.1 low-level helper def _retrieve_data(self, tag: int, first: bool = True) -> ResTuple: if first: - pdu = self.cla4lchan('80') + 'cb008001%02x' % (tag) + pdu = '80cb008001%02x' % (tag) else: - pdu = self.cla4lchan('80') + 'cb000000' + pdu = '80cb000000' return self.send_apdu_checksw(pdu) def retrieve_data(self, ef: Path, tag: int) -> ResTuple: @@ -549,7 +536,7 @@ p1 = 0x00 if isinstance(data, (bytes, bytearray)): data = b2h(data) - pdu = self.cla4lchan('80') + 'db00%02x%02x%s' % (p1, len(data)//2, data) + pdu = '80db00%02x%02x%s' % (p1, len(data)//2, data) return self.send_apdu_checksw(pdu) def set_data(self, ef, tag: int, value: str, verify: bool = False, conserve: bool = False) -> ResTuple: @@ -592,7 +579,7 @@ if len(rand) != 32: raise ValueError('Invalid rand') self.select_path(['3f00', '7f20']) - return self.send_apdu_checksw(self.cla4lchan('a0') + '88000010' + rand, sw='9000') + return self.send_apdu_checksw('a088000010' + rand, sw='9000') def authenticate(self, rand: Hexstr, autn: Hexstr, context: str = '3g') -> ResTuple: """Execute AUTHENTICATE (USIM/ISIM). @@ -625,7 +612,7 @@ def status(self) -> ResTuple: """Execute a STATUS command as per TS 102 221 Section 11.1.2.""" - return self.send_apdu_checksw(self.cla4lchan('80') + 'F2000000') + return self.send_apdu_checksw('80F2000000') def deactivate_file(self) -> ResTuple: """Execute DECATIVATE FILE command as per TS 102 221 Section 11.1.14.""" @@ -645,7 +632,7 @@ def resize_file(self, payload: Hexstr) -> ResTuple: """Execute RESIZE FILE command as per TS 102 222 Section 6.10""" - return self.send_apdu_checksw(self.cla4lchan('80') + 'd40000%02x%s' % (len(payload)//2, payload)) + return self.send_apdu_checksw('80d40000%02x%s' % (len(payload)//2, payload)) def delete_file(self, fid: Hexstr) -> ResTuple: """Execute DELETE FILE command as per TS 102 222 Section 6.4""" diff --git a/pySim/euicc.py b/pySim/euicc.py index d0cb682..8bd1ae4 100644 --- a/pySim/euicc.py +++ b/pySim/euicc.py @@ -322,7 +322,7 @@ def store_data(scc: SimCardCommands, tx_do: Hexstr, exp_sw: SwMatchstr ="9000") -> Tuple[Hexstr, SwHexstr]: """Perform STORE DATA according to Table 47+48 in Section 5.7.2 of SGP.22. Only single-block store supported for now.""" - capdu = '%sE29100%02x%s' % (scc.cla4lchan('80'), len(tx_do)//2, tx_do) + capdu = '80E29100%02x%s' % (len(tx_do)//2, tx_do) return scc.send_apdu_checksw(capdu, exp_sw) @staticmethod -- To view, visit https://gerrit.osmocom.org/c/pysim/+/37936?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: Ia795f3c16a8875484fce3b44e61497d5aa52b447 Gerrit-Change-Number: 37936 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
1 0
0 0
[M] Change in pysim[master]: ara_m: use class byte of current lchan
by laforge 30 Aug '24

30 Aug '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/37840?usp=email ) Change subject: ara_m: use class byte of current lchan ...................................................................... ara_m: use class byte of current lchan The ara_m commands use APDUs with a fix class byte (0x80). This means that all ARA-M related features only work in the basic logical channel. To fix this, let's compute the class byte for the current logical channel dynamically inside the send_apdu methods of SimCardCommands. This will fix the problem globally. Related: OS#6531 Change-Id: Ie3e48678f178a488bfaea6cc2b9a3e18145a8d10 --- M pySim-shell.py M pySim/ara_m.py M pySim/commands.py 3 files changed, 33 insertions(+), 26 deletions(-) Approvals: fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/pySim-shell.py b/pySim-shell.py index 0ba8a25..43e9dd2 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -252,9 +252,9 @@ # can be executed without the presence of a runtime state (self.rs) object. However, this also means that # self.lchan is also not present (see method equip). if opts.raw or self.lchan is None: - data, sw = self.card._scc.send_apdu(opts.APDU) + data, sw = self.card._scc.send_apdu(opts.APDU, apply_lchan = False) else: - data, sw = self.lchan.scc.send_apdu(opts.APDU) + data, sw = self.lchan.scc.send_apdu(opts.APDU, apply_lchan = False) if data: self.poutput("SW: %s, RESP: %s" % (sw, data)) else: diff --git a/pySim/ara_m.py b/pySim/ara_m.py index cdc934d..e6f0520 100644 --- a/pySim/ara_m.py +++ b/pySim/ara_m.py @@ -262,7 +262,7 @@ return pySim.global_platform.decode_select_response(data_hex) @staticmethod - def xceive_apdu_tlv(tp, hdr: Hexstr, cmd_do, resp_cls, exp_sw='9000'): + def xceive_apdu_tlv(scc, hdr: Hexstr, cmd_do, resp_cls, exp_sw='9000'): """Transceive an APDU with the card, transparently encoding the command data from TLV and decoding the response data tlv.""" if cmd_do: @@ -274,7 +274,7 @@ cmd_do_enc = b'' cmd_do_len = 0 c_apdu = hdr + ('%02x' % cmd_do_len) + b2h(cmd_do_enc) - (data, _sw) = tp.send_apdu_checksw(c_apdu, exp_sw) + (data, _sw) = scc.send_apdu_checksw(c_apdu, exp_sw) if data: if resp_cls: resp_do = resp_cls() @@ -285,32 +285,32 @@ return None @staticmethod - def store_data(tp, do) -> bytes: + def store_data(scc, do) -> bytes: """Build the Command APDU for STORE DATA.""" - return ADF_ARAM.xceive_apdu_tlv(tp, '80e29000', do, StoreResponseDoCollection) + return ADF_ARAM.xceive_apdu_tlv(scc, '80e29000', do, StoreResponseDoCollection) @staticmethod - def get_all(tp): - return ADF_ARAM.xceive_apdu_tlv(tp, '80caff40', None, GetResponseDoCollection) + def get_all(scc): + return ADF_ARAM.xceive_apdu_tlv(scc, '80caff40', None, GetResponseDoCollection) @staticmethod - def get_config(tp, v_major=0, v_minor=0, v_patch=1): + def get_config(scc, v_major=0, v_minor=0, v_patch=1): cmd_do = DeviceConfigDO() cmd_do.from_val_dict([{'device_interface_version_do': { 'major': v_major, 'minor': v_minor, 'patch': v_patch}}]) - return ADF_ARAM.xceive_apdu_tlv(tp, '80cadf21', cmd_do, ResponseAramConfigDO) + return ADF_ARAM.xceive_apdu_tlv(scc, '80cadf21', cmd_do, ResponseAramConfigDO) @with_default_category('Application-Specific Commands') class AddlShellCommands(CommandSet): def do_aram_get_all(self, _opts): """GET DATA [All] on the ARA-M Applet""" - res_do = ADF_ARAM.get_all(self._cmd.lchan.scc._tp) + res_do = ADF_ARAM.get_all(self._cmd.lchan.scc) if res_do: self._cmd.poutput_json(res_do.to_dict()) def do_aram_get_config(self, _opts): """Perform GET DATA [Config] on the ARA-M Applet: Tell it our version and retrieve its version.""" - res_do = ADF_ARAM.get_config(self._cmd.lchan.scc._tp) + res_do = ADF_ARAM.get_config(self._cmd.lchan.scc) if res_do: self._cmd.poutput_json(res_do.to_dict()) @@ -378,14 +378,14 @@ d = [{'ref_ar_do': [{'ref_do': ref_do_content}, {'ar_do': ar_do_content}]}] csrado = CommandStoreRefArDO() csrado.from_val_dict(d) - res_do = ADF_ARAM.store_data(self._cmd.lchan.scc._tp, csrado) + res_do = ADF_ARAM.store_data(self._cmd.lchan.scc, csrado) if res_do: self._cmd.poutput_json(res_do.to_dict()) def do_aram_delete_all(self, _opts): """Perform STORE DATA [Command-Delete[all]] to delete all access rules.""" deldo = CommandDelete() - res_do = ADF_ARAM.store_data(self._cmd.lchan.scc._tp, deldo) + res_do = ADF_ARAM.store_data(self._cmd.lchan.scc, deldo) if res_do: self._cmd.poutput_json(res_do.to_dict()) @@ -479,7 +479,7 @@ export_str = "" export_str += "aram_delete_all\n" - res_do = ADF_ARAM.get_all(lchan.scc._tp) + res_do = ADF_ARAM.get_all(lchan.scc) if not res_do: return export_str.strip() diff --git a/pySim/commands.py b/pySim/commands.py index 43fc705..3a7fe47 100644 --- a/pySim/commands.py +++ b/pySim/commands.py @@ -110,26 +110,30 @@ else: return cla_with_lchan(cla, self.lchan_nr) - def send_apdu(self, pdu: Hexstr) -> ResTuple: + def send_apdu(self, pdu: Hexstr, apply_lchan:bool = True) -> ResTuple: """Sends an APDU and auto fetch response data Args: pdu : string of hexadecimal characters (ex. "A0A40000023F00") + apply_lchan : apply the currently selected lchan to the CLA byte before sending Returns: tuple(data, sw), where data : string (in hex) of returned data (ex. "074F4EFFFF") sw : string (in hex) of status word (ex. "9000") """ + if apply_lchan: + pdu = self.cla4lchan(pdu[0:2]) + pdu[2:] if self.scp: return self.scp.send_apdu_wrapper(self._tp.send_apdu, pdu) else: return self._tp.send_apdu(pdu) - def send_apdu_checksw(self, pdu: Hexstr, sw: SwMatchstr = "9000") -> ResTuple: + def send_apdu_checksw(self, pdu: Hexstr, sw: SwMatchstr = "9000", apply_lchan:bool = True) -> ResTuple: """Sends an APDU and check returned SW Args: pdu : string of hexadecimal characters (ex. "A0A40000023F00") + apply_lchan : apply the currently selected lchan to the CLA byte before sending sw : string of 4 hexadecimal characters (ex. "9000"). The user may mask out certain digits using a '?' to add some ambiguity if needed. Returns: @@ -137,13 +141,15 @@ data : string (in hex) of returned data (ex. "074F4EFFFF") sw : string (in hex) of status word (ex. "9000") """ + if apply_lchan: + pdu = self.cla4lchan(pdu[0:2]) + pdu[2:] if self.scp: return self.scp.send_apdu_wrapper(self._tp.send_apdu_checksw, pdu, sw) else: return self._tp.send_apdu_checksw(pdu, sw) def send_apdu_constr(self, cla: Hexstr, ins: Hexstr, p1: Hexstr, p2: Hexstr, cmd_constr: Construct, - cmd_data: Hexstr, resp_constr: Construct) -> Tuple[dict, SwHexstr]: + cmd_data: Hexstr, resp_constr: Construct, apply_lchan:bool = True) -> Tuple[dict, SwHexstr]: """Build and sends an APDU using a 'construct' definition; parses response. Args: @@ -154,13 +160,14 @@ cmd_cosntr : defining how to generate binary APDU command data cmd_data : command data passed to cmd_constr resp_cosntr : defining how to decode binary APDU response data + apply_lchan : apply the currently selected lchan to the CLA byte before sending Returns: Tuple of (decoded_data, sw) """ cmd = cmd_constr.build(cmd_data) if cmd_data else '' p3 = i2h([len(cmd)]) pdu = ''.join([cla, ins, p1, p2, p3, b2h(cmd)]) - (data, sw) = self.send_apdu(pdu) + (data, sw) = self.send_apdu(pdu, apply_lchan = apply_lchan) if data: # filter the resulting dict to avoid '_io' members inside rsp = filter_dict(resp_constr.parse(h2b(data))) @@ -170,7 +177,7 @@ def send_apdu_constr_checksw(self, cla: Hexstr, ins: Hexstr, p1: Hexstr, p2: Hexstr, cmd_constr: Construct, cmd_data: Hexstr, resp_constr: Construct, - sw_exp: SwMatchstr="9000") -> Tuple[dict, SwHexstr]: + sw_exp: SwMatchstr="9000", apply_lchan:bool = True) -> Tuple[dict, SwHexstr]: """Build and sends an APDU using a 'construct' definition; parses response. Args: @@ -185,8 +192,8 @@ Returns: Tuple of (decoded_data, sw) """ - (rsp, sw) = self.send_apdu_constr(cla, ins, - p1, p2, cmd_constr, cmd_data, resp_constr) + (rsp, sw) = self.send_apdu_constr(cla, ins, p1, p2, cmd_constr, cmd_data, resp_constr, + apply_lchan = apply_lchan) if not sw_match(sw, sw_exp): raise SwMatchError(sw, sw_exp.lower(), self._tp.sw_interpreter) return (rsp, sw) @@ -750,7 +757,7 @@ Args: payload : payload as hex string """ - return self.send_apdu_checksw('80c20000%02x%s' % (len(payload)//2, payload)) + return self.send_apdu_checksw('80c20000%02x%s' % (len(payload)//2, payload), apply_lchan = False) def terminal_profile(self, payload: Hexstr) -> ResTuple: """Send TERMINAL PROFILE to card @@ -759,7 +766,7 @@ payload : payload as hex string """ data_length = len(payload) // 2 - data, sw = self.send_apdu_checksw(('80100000%02x' % data_length) + payload) + data, sw = self.send_apdu_checksw(('80100000%02x' % data_length) + payload, apply_lchan = False) return (data, sw) # ETSI TS 102 221 11.1.22 @@ -797,7 +804,7 @@ raise ValueError('Time unit must be 0x00..0x04') min_dur_enc = encode_duration(min_len_secs) max_dur_enc = encode_duration(max_len_secs) - data, sw = self.send_apdu_checksw('8076000004' + min_dur_enc + max_dur_enc) + data, sw = self.send_apdu_checksw('8076000004' + min_dur_enc + max_dur_enc, apply_lchan = False) negotiated_duration_secs = decode_duration(data[:4]) resume_token = data[4:] return (negotiated_duration_secs, resume_token, sw) @@ -807,7 +814,7 @@ """Send SUSPEND UICC (resume) to the card.""" if len(h2b(token)) != 8: raise ValueError("Token must be 8 bytes long") - data, sw = self.send_apdu_checksw('8076010008' + token) + data, sw = self.send_apdu_checksw('8076010008' + token, apply_lchan = False) return (data, sw) def get_data(self, tag: int, cla: int = 0x00): -- To view, visit https://gerrit.osmocom.org/c/pysim/+/37840?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: Ie3e48678f178a488bfaea6cc2b9a3e18145a8d10 Gerrit-Change-Number: 37840 Gerrit-PatchSet: 9 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • ...
  • 148
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.