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

September 2026

  • 1 participants
  • 1894 discussions
[M] Change in pysim[master]: GP: only send a GET STATUS tag list to cards that support it
by Hoernchen 23 Sep '26

23 Sep '26
Attention is currently required from: dexter, laforge. Hoernchen has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/pysim/+/43552?usp=email ) Change subject: GP: only send a GET STATUS tag list to cards that support it ...................................................................... Patch Set 3: (1 comment) File pySim/global_platform/__init__.py: https://gerrit.osmocom.org/c/pysim/+/43552/comment/cd3a99d5_036f77c4?usp=em… : PS2, Line 805: self._gp_version = decode_gp_version(h2b(data)) > maybe logging the gp_version? Done -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43552?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: I74cd2bd47617d616bede6453397f544cde5abcb7 Gerrit-Change-Number: 43552 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 23 Sep 2026 16:14:51 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[L] Change in pysim[master]: transport: stop the T=0 layer from breaking GP 6310
by Hoernchen 23 Sep '26

23 Sep '26
Attention is currently required from: dexter, laforge. Hoernchen has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/pysim/+/43551?usp=email ) Change subject: transport: stop the T=0 layer from breaking GP 6310 ...................................................................... Patch Set 3: (4 comments) Commit Message: https://gerrit.osmocom.org/c/pysim/+/43551/comment/fe61f50c_bcc9eb03?usp=em… : PS2, Line 15: That is not "redundant", as per GP CS v2.3 section 11.4.3.1 the > I think we normally refer to the "GlobalPlatform Card […] Done File pySim/global_platform/__init__.py: https://gerrit.osmocom.org/c/pysim/+/43551/comment/85a940d0_6d21e4fb?usp=em… : PS2, Line 740: p2 = 0x02 # TLV format according to Table 11-36 > maybe reference as GPC, section 11.4.3.1, table 11-36. […] Done https://gerrit.osmocom.org/c/pysim/+/43551/comment/83a05d2d_93b7f09a?usp=em… : PS2, Line 751: raise SwMatchError(sw, '9000/6310') > I gave this a practical test: When I select the ISD and do a "get_status applications" for example, […] Error adjusted to take a list, as proposed. This patch can not be independently tested with get_status applications, that needs the next one to succeed. https://gerrit.osmocom.org/c/pysim/+/43551/comment/a167683e_6cefb686?usp=em… : PS2, Line 760: # GPC CardSpec v2.3, section 11.4.3.1, 6310 == additional matches. > As it seems the spec ref is wrong. As far as I understand, the following is correct: […] Done -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43551?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: I10f8afa8dd5623a49a6a0e7132607b3a1fad2d8c Gerrit-Change-Number: 43551 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 23 Sep 2026 16:14:37 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[XS] Change in pysim[master]: osmo-smdpp: add --smdp-address to set ES9+ SM-DP+ address
by Hoernchen 23 Sep '26

23 Sep '26
Attention is currently required from: dexter, laforge. Hoernchen has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/pysim/+/43549?usp=email ) Change subject: osmo-smdpp: add --smdp-address to set ES9+ SM-DP+ address ...................................................................... Patch Set 3: (2 comments) Commit Message: https://gerrit.osmocom.org/c/pysim/+/43549/comment/9bb27868_d78e0572?usp=em… : PS2, Line 18: so this is useful for debugging, but likely not spec compliant. > To my opinion this is an error in the spec. […] I have reworded it because while I assume that what the message original stated is true this is up to interpretation, as usual.. File osmo-smdpp.py: https://gerrit.osmocom.org/c/pysim/+/43549/comment/7640cccf_775ee32b?usp=em… : PS2, Line 923: "The TLS cert identity is unaffected. Useful for debugging.") > You could also make the second occurrence of the default hostname dynamic. Done -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43549?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: I2fa822c7d5e0d5b68a6704a1779f9923505f9008 Gerrit-Change-Number: 43549 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 23 Sep 2026 16:12:01 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[L] Change in pysim[master]: contrib: SCP81 TLS-PSK RAS for RAM/RFM over HTTPS
by Hoernchen 23 Sep '26

23 Sep '26
Attention is currently required from: daniel, dexter, laforge, lynxis lazus. Hoernchen has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/pysim/+/43547?usp=email ) Change subject: contrib: SCP81 TLS-PSK RAS for RAM/RFM over HTTPS ...................................................................... Patch Set 3: (4 comments) File contrib/scp81_admin_server.py: https://gerrit.osmocom.org/c/pysim/+/43547/comment/0296415a_635234aa?usp=em… : PS2, Line 3: > This file has the execution bit not set. Done https://gerrit.osmocom.org/c/pysim/+/43547/comment/4a2138d1_959cb07b?usp=em… : PS2, Line 80: 'PSK-AES256-CBC-SHA', > I do not see any SHA348 ciphers in that table. […] leftover from field trials, removed. https://gerrit.osmocom.org/c/pysim/+/43547/comment/4cf183fa_d6dcd0c1?usp=em… : PS2, Line 98: raise ValueError('AID must be at least 5 bytes?! (RID): %r' % aid) > This exception string is a it confusing. […] Done https://gerrit.osmocom.org/c/pysim/+/43547/comment/0fa883ca_c4020f30?usp=em… : PS2, Line 116: # similar helpers give us a mutable bytearray which F/$3/$ed me five times already > I would recommend to shorten this comment a bit. Done -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43547?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: I4f243aeca65d0f33ff34e6932e3f4e156446af8b Gerrit-Change-Number: 43547 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 23 Sep 2026 16:10:02 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[M] Change in pysim[master]: ota: indefinite length en/decoding support
by Hoernchen 23 Sep '26

23 Sep '26
Attention is currently required from: dexter, laforge. Hoernchen has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/pysim/+/43546?usp=email ) Change subject: ota: indefinite length en/decoding support ...................................................................... Patch Set 3: (12 comments) File pySim/ota.py: https://gerrit.osmocom.org/c/pysim/+/43546/comment/569c712b_18068c96?usp=em… : PS2, Line 134: 'commands'/Prefixed(BerTlvLen, ExpandedCmdItems)) > We don't need such a definition for the indefinite length coding as well? […] Done https://gerrit.osmocom.org/c/pysim/+/43546/comment/4d9feb83_ae74fdb6?usp=em… : PS2, Line 169: # - starts with the "Number of executed command TLV objects" (table 5.10/5.13/5.15) > I would recommend to put a spec ref on top of this: […] Done https://gerrit.osmocom.org/c/pysim/+/43546/comment/0342fc86_699af2d5?usp=em… : PS2, Line 172: ExpandedRemoteResp = Struct('_tag'/Const(b'\xab'), > 0xAB is the tag for definite length coding. For indefinite length coding the tag is 0xAF. […] Done https://gerrit.osmocom.org/c/pysim/+/43546/comment/388e061b_cb69d183?usp=em… : PS2, Line 185: """Parse the definite BER-TLV len, return (length_value, number_of_length_octets) """ > maybe you can use bertlv_parse_len() from pyosmocom here? However, it returns the length value and t […] Done https://gerrit.osmocom.org/c/pysim/+/43546/comment/99034494_a36fce53?usp=em… : PS2, Line 196: "<tag> 80 <content> 00 00" """ > maybe add a hint like "(works for commands and response)" It was first wondering a bit why you put t […] Done https://gerrit.osmocom.org/c/pysim/+/43546/comment/ee053f00_fd94e956?usp=em… : PS2, Line 198: raise ValueError('expected indefinite-length template tag 0x%02x' % tag) > I would strongly recommend to split this into two distinct checks. […] Done https://gerrit.osmocom.org/c/pysim/+/43546/comment/69915d1f_63d84c83?usp=em… : PS2, Line 204: if data[off:off+2] != b'\x00\x00': > Is this safe? What if you get a string where everything is valid but the last byte is chopped off fo […] Done https://gerrit.osmocom.org/c/pysim/+/43546/comment/57a636d5_6c09a840?usp=em… : PS2, Line 207: length, len_octets = _read_ber_tlv_len(data, off + 1) > As it seems you are not only interested in the octets, you are also putting much effort into verifyi […] Done https://gerrit.osmocom.org/c/pysim/+/43546/comment/21c4cc56_8313b8a2?usp=em… : PS2, Line 232: return b'\xae\x80' + ExpandedCmdItems.build(commands) + b'\x00\x00' > Ah, now I see why there is no explicit struct for the indefinite command scripting template. […] It was my first try and old code from july, this reworked patch now uses construct. File tests/unittests/test_ota.py: https://gerrit.osmocom.org/c/pysim/+/43546/comment/72424fde_6250fc8b?usp=em… : PS2, Line 470: 'ae80220700a4000c023f00220700a4000c022fe2220500b000000a0000') > maybe add a testcase like this one, but with one byte chopped off at the end? (See my other comment) Done https://gerrit.osmocom.org/c/pysim/+/43546/comment/4f5f7d98_e91ac4ab?usp=em… : PS2, Line 486: 'af8023029000230290002' '30c988812010000408608149000' '0000')) > Looks like you have chopped the string wrongly. […] Done https://gerrit.osmocom.org/c/pysim/+/43546/comment/9f48c29a_27032d29?usp=em… : PS2, Line 498: 'c00401408510c00403018810c00402018810c004010188109000' '0000') > maybe separate the 'af80'? You also have the end marker separate. Done -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43546?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: I4e023112e98729489ed443eec3ed5ab45c773b17 Gerrit-Change-Number: 43546 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 23 Sep 2026 16:09:22 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[L] Change in pysim[master]: smpp2sim: make the SCP81 BIP relay work
by Hoernchen 23 Sep '26

23 Sep '26
Attention is currently required from: daniel, dexter, laforge. Hoernchen has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/pysim/+/43545?usp=email ) Change subject: smpp2sim: make the SCP81 BIP relay work ...................................................................... Patch Set 3: (10 comments) File pySim/bip.py: https://gerrit.osmocom.org/c/pysim/+/43545/comment/6e70c94e_68208659?usp=em… : PS2, Line 30: # Without them the handler builds and logs what it would send. > I would move such documentation into the API docstrings of the class. […] Done https://gerrit.osmocom.org/c/pysim/+/43545/comment/416f3b7a_c648c6f4?usp=em… : PS2, Line 64: bandwidth.. > This explains why we have moved away from twisted. I would put this into a normal comment. […] Done https://gerrit.osmocom.org/c/pysim/+/43545/comment/9c937f71_4fa3fff5?usp=em… : PS2, Line 119: if was_empty and not self._closing: > I think its important to document why we only notify when the buffer was empty. […] Done https://gerrit.osmocom.org/c/pysim/+/43545/comment/a05d4efc_05f7a4ac?usp=em… : PS2, Line 126: def rx_available(self) -> int: > Missing API doc […] Done https://gerrit.osmocom.org/c/pysim/+/43545/comment/8bb1c38a_c85b58d3?usp=em… : PS2, Line 175: def __init__(self, on_data_available=None): > I think here it is in particular important to put an API docstring and to document the on_data_avail […] Done https://gerrit.osmocom.org/c/pysim/+/43545/comment/be87285d_3a8521fb?usp=em… : PS2, Line 189: def channel_delete(self, chan_nr: int): > maybe add a docstring? Done https://gerrit.osmocom.org/c/pysim/+/43545/comment/0a24f9e9_ab12230c?usp=em… : PS2, Line 192: def notify_data_available(self, chan: ProactChannel): > The ProactChannel object is created by the channel_create method in this class. […] The back reference is not only for the notification, ProactChannel.close() also removes itself from ProactChannels via channel_delete. Dropping it would move that bookkeeping into every caller of close() so I kept it as is. https://gerrit.osmocom.org/c/pysim/+/43545/comment/c7ef8ff0_248828fb?usp=em… : PS2, Line 199: def __init__(self, data_available_sink=None, sms_sink=None): > Explain the parameters in an API docstring. In particular the data_available_sink is important here. […] Done https://gerrit.osmocom.org/c/pysim/+/43545/comment/bcce6e4f_eea65298?usp=em… : PS2, Line 268: def build_data_available_envelope(self, chan: ProactChannel) -> bytes: > As far as I can see this is called from _on_channel_data_available only. […] Done https://gerrit.osmocom.org/c/pysim/+/43545/comment/a4180bcc_31e1fd05?usp=em… : PS2, Line 392: def handle_ReceiveData(self, pcmd: ProactiveCommand): > maybe add some more API doc on how to use this function? As far as I understood, this is to be calle […] Done -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43545?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: If96c768f2e35c20ea3753e601059410121517b60 Gerrit-Change-Number: 43545 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 23 Sep 2026 16:07:55 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[L] Change in pysim[master]: sms/smpp-ota-tool: reassemble multi part response SMS
by Hoernchen 23 Sep '26

23 Sep '26
Attention is currently required from: dexter, laforge. Hoernchen has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/pysim/+/43544?usp=email ) Change subject: sms/smpp-ota-tool: reassemble multi part response SMS ...................................................................... Patch Set 3: (6 comments) File pySim/sms.py: https://gerrit.osmocom.org/c/pysim/+/43544/comment/cf7da830_34db5c7f?usp=em… : PS2, Line 99: # TS 23.040 9.2.3.24.1/.8 IEI of the concat IE > You are referencing to 9.2.3.24.1 and 9.2.3.24. […] Done https://gerrit.osmocom.org/c/pysim/+/43544/comment/ac6018ca_1a23f57b?usp=em… : PS2, Line 132: # TS 23.040 9.2.3.24.1.8 , total zero or seqno zero / > total: > Did you mean TS 23.040 9.2.3.24. […] Done https://gerrit.osmocom.org/c/pysim/+/43544/comment/81feedac_d88d323d?usp=em… : PS2, Line 153: if len(s['parts']) < total: > I wonder what happens when someone keeps sending incomplete sets. […] Yeah that was by design considering the size of the data and how long we collect this the leak did not matter.. There is no reassembly timer in TS 23.040 (9.2.3.24.1 only says incomplete sets "may be discarded"). I chose a cap instead of timers for this reworked patch: max_sets=8, oldest incomplete set evicted. arbitrary number, discarding is fine anyway. File tests/unittests/test_sms.py: https://gerrit.osmocom.org/c/pysim/+/43544/comment/266a9919_8d5142bc?usp=em… : PS2, Line 109: """TS 23.040 9.2.3.24 reassembly of multi-part SMS. > I would recommend to reference the spac as "3GPP TS 23.040" and not only "TS ..." […] Done https://gerrit.osmocom.org/c/pysim/+/43544/comment/e90e1b42_02d450d1?usp=em… : PS2, Line 113: form before decoding.""" > I would rephrase it a bit: […] Done https://gerrit.osmocom.org/c/pysim/+/43544/comment/070db4e6_04b99c6e?usp=em… : PS2, Line 137: self.assertEqual(b2h(built), '0700030102017100') > maybe move test_ground_truth_udh above test_single_part_passthrough? It seems to be just a precursor […] Done -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43544?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: I8c81097e607e0d055c4f031bbcc8a74d5c24a0e7 Gerrit-Change-Number: 43544 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 23 Sep 2026 16:06:08 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[M] Change in pysim[master]: transport/smpp2sim: TERMINAL RESPONSE for proactive SEND SHORT MESSAGE
by Hoernchen 23 Sep '26

23 Sep '26
Attention is currently required from: daniel, dexter, laforge. Hoernchen has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/pysim/+/43543?usp=email ) Change subject: transport/smpp2sim: TERMINAL RESPONSE for proactive SEND SHORT MESSAGE ...................................................................... Patch Set 3: (3 comments) File pySim/transport/__init__.py: https://gerrit.osmocom.org/c/pysim/+/43543/comment/d88dfd55_3df8552d?usp=em… : PS2, Line 72: def prepare_response(self, pcmd: ProactiveCommand, general_result: str = 'performed_successfully'): > I think putting a spec ref (ETSI TS 102 223, section 6.8) would be very helpful here. Done File tests/unittests/test_transport.py: https://gerrit.osmocom.org/c/pysim/+/43543/comment/6cf6203c_838f09e4?usp=em… : PS2, Line 38: # Checkk that ProactiveCommand collection (empty .children) still works > Typo: Checkk Done https://gerrit.osmocom.org/c/pysim/+/43543/comment/11b225a1_191ac758?usp=em… : PS2, Line 44: self.assertEqual(b2h(til[1].to_tlv()), '82028381') > correct me if I am wrong, but as far as I understand we should also see encoded strings for CommandD […] Done -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43543?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: Ib96ce81c4ff093b8a6fc715f79617e95a2dd8433 Gerrit-Change-Number: 43543 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 23 Sep 2026 16:03:49 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[M] Change in pysim[master]: smpp-ota-tool: use the shared OTA argparse helpers
by Hoernchen 23 Sep '26

23 Sep '26
Hoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/43722?usp=email ) Change subject: smpp-ota-tool: use the shared OTA argparse helpers ...................................................................... smpp-ota-tool: use the shared OTA argparse helpers Change-Id: Icea287f1a216fae4274f00a723a47ec19376a6ce --- M contrib/smpp-ota-tool.py 1 file changed, 4 insertions(+), 49 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/22/43722/1 diff --git a/contrib/smpp-ota-tool.py b/contrib/smpp-ota-tool.py index 885cf94..5f7af40 100755 --- a/contrib/smpp-ota-tool.py +++ b/contrib/smpp-ota-tool.py @@ -24,7 +24,7 @@ import smpplib.client import smpplib.consts import time -from pySim.ota import OtaKeyset, OtaDialectSms, OtaAlgoCrypt, OtaAlgoAuth, OtaCheckError, CNTR_REQ, RC_CC_DS, POR_REQ +from pySim.ota import OtaKeyset, OtaDialectSms, OtaCheckError, argparse_add_ota_args, ota_keyset_from_args, ota_spi_from_args from pySim.sms import ConcatenatedSmsReassembler from pySim.utils import b2h, h2b, is_hexstr from pathlib import Path @@ -38,36 +38,7 @@ option_parser.add_argument("--system-id", help="System ID to use to bind to the SMPP server", default="test") option_parser.add_argument("--password", help="Password to use to bind to the SMPP server", default="test") option_parser.add_argument("--verbose", help="Enable verbose logging", action='store_true', default=False) -algo_crypt_choices = [] -algo_crypt_classes = OtaAlgoCrypt.__subclasses__() -for cls in algo_crypt_classes: - algo_crypt_choices.append(cls.enum_name) -option_parser.add_argument("--algo-crypt", choices=algo_crypt_choices, default='triple_des_cbc2', - help="OTA crypt algorithm") -algo_auth_choices = [] -algo_auth_classes = OtaAlgoAuth.__subclasses__() -for cls in algo_auth_classes: - algo_auth_choices.append(cls.enum_name) -option_parser.add_argument("--algo-auth", choices=algo_auth_choices, default='triple_des_cbc2', - help="OTA auth algorithm") -option_parser.add_argument('--kic', required=True, type=is_hexstr, help='OTA key (KIC)') -option_parser.add_argument('--kic-idx', default=1, type=int, help='OTA key index (KIC)') -option_parser.add_argument('--kid', required=True, type=is_hexstr, help='OTA key (KID)') -option_parser.add_argument('--kid-idx', default=1, type=int, help='OTA key index (KID)') -option_parser.add_argument('--cntr', default=0, type=int, help='replay protection counter') -option_parser.add_argument('--tar', required=True, type=is_hexstr, help='Toolkit Application Reference') -option_parser.add_argument("--cntr-req", choices=CNTR_REQ.decmapping.values(), default='no_counter', - help="Counter requirement") -option_parser.add_argument('--no-ciphering', action='store_true', default=False, help='Disable ciphering') -option_parser.add_argument("--rc-cc-ds", choices=RC_CC_DS.decmapping.values(), default='cc', - help="message check (rc=redundency check, cc=crypt. checksum, ds=digital signature)") -option_parser.add_argument('--por-in-submit', action='store_true', default=False, - help='require PoR to be sent via SMS-SUBMIT') -option_parser.add_argument('--por-no-ciphering', action='store_true', default=False, help='Disable ciphering (PoR)') -option_parser.add_argument("--por-rc-cc-ds", choices=RC_CC_DS.decmapping.values(), default='cc', - help="PoR check (rc=redundency check, cc=crypt. checksum, ds=digital signature)") -option_parser.add_argument("--por-req", choices=POR_REQ.decmapping.values(), default='por_required', - help="Proof of Receipt requirements") +argparse_add_ota_args(option_parser, sms=True) option_parser.add_argument('--src-addr', default='12', type=str, help='SMS source address (MSISDN)') option_parser.add_argument('--dest-addr', default='23', type=str, help='SMS destination address (MSISDN)') option_parser.add_argument('--timeout', default=10, type=int, help='Maximum response waiting time') @@ -267,24 +238,8 @@ format='%(asctime)s %(levelname)s %(message)s', datefmt='%Y-%m-%d %H:%M:%S') - if opts.kic_idx != opts.kid_idx: - logger.warning("KIC index (%s) and KID index (%s) are different (security violation, card should reject message)", - opts.kic_idx, opts.kid_idx) - - ota_keyset = OtaKeyset(algo_crypt=opts.algo_crypt, - kic_idx=opts.kic_idx, - kic=h2b(opts.kic), - algo_auth=opts.algo_auth, - kid_idx=opts.kid_idx, - kid=h2b(opts.kid), - cntr=opts.cntr) - spi = {'counter' : opts.cntr_req, - 'ciphering' : not opts.no_ciphering, - 'rc_cc_ds': opts.rc_cc_ds, - 'por_in_submit': opts.por_in_submit, - 'por_shall_be_ciphered': not opts.por_no_ciphering, - 'por_rc_cc_ds': opts.por_rc_cc_ds, - 'por': opts.por_req} + ota_keyset = ota_keyset_from_args(opts) + spi = ota_spi_from_args(opts) if opts.format == 'expanded': # TS 102 226 5.2.1.1: wrap each apdu in its own C-APDU TLV apdu = [h2b(a) for a in opts.apdu] -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43722?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: Icea287f1a216fae4274f00a723a47ec19376a6ce Gerrit-Change-Number: 43722 Gerrit-PatchSet: 1 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de>
1 0
0 0
[L] Change in pysim[master]: contrib: CAT_TP admin server for RAM/RFM over BIP
by Hoernchen 23 Sep '26

23 Sep '26
Hoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/43721?usp=email ) Change subject: contrib: CAT_TP admin server for RAM/RFM over BIP ...................................................................... contrib: CAT_TP admin server for RAM/RFM over BIP Basically the UDP counterpart of scp81_admin_server.py, plain sockets: - waits for the SYN caused by the the PUSH - sends the queued C-APDUs as TS 102 225 secured packets, one per SDU, with the SCP80 keys and TAR of OTA over SMS - decodes the responses and closes the link with RST when done. Change-Id: I4b97971beb9c0dda73217ece5f1e51fd8ace4540 --- A contrib/cattp_admin_server.py A tests/unittests/test_cattp_admin_server.py 2 files changed, 364 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/21/43721/1 diff --git a/contrib/cattp_admin_server.py b/contrib/cattp_admin_server.py new file mode 100755 index 0000000..ee57ea1 --- /dev/null +++ b/contrib/cattp_admin_server.py @@ -0,0 +1,234 @@ +#!/usr/bin/env python3 +"""CAT_TP Remote Administration Server for RAM/RFM over BIP, ETSI TS 102 225 section 6""" + +# (C) 2026 by sysmocom - s.f.m.c. GmbH +# All Rights Reserved +# +# Author: Eric Wild <ewild(a)sysmocom.de> +# +# 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/>. + +# The UDP end of "OTA over BIP" for cards that do CAT_TP instead of SCP81: +# - contrib/cattp_trigger.py builds the PUSH that makes the card OPEN CHANNEL to us and SYN +# - once the link is OPEN this server sends the queued C-APDUs as TS 102 225 secured +# command packets, one per SDU, the same SCP80 keys and TAR as OTA over SMS +# - the card answers each with a secured response packet, decoded and logged here +# - after the last one the link is closed with RST, the card then closes the BIP channel +# +# Same command line spirit as scp81_admin_server.py, same OTA options as smpp-ota-tool.py. + +import argparse +import logging +from pathlib import Path +from typing import Dict, List, Optional, Callable + +from osmocom.utils import h2b, b2h + +from pySim.cattp import CatTpServer, CatTpConnection, RST_NORMAL +from pySim.ota import (OtaKeyset, OtaDialectCatTp, OtaCheckError, argparse_add_ota_args, + ota_keyset_from_args, ota_spi_from_args) + +logger = logging.getLogger(Path(__file__).stem) + + +def format_decoded_response(res, dec) -> str: + bits = ['status=%s cntr=%s' % (res.response_status, b2h(res.cntr))] + if dec is None: + return bits[0] + if 'commands' in dec: # expanded + bits.append('%u command(s) executed' % dec.number_of_commands) + for i, c in enumerate(dec.commands): + bits.append(' R-APDU[%u]: SW=%s data=%s' % (i, c.status_word, c.response_data or '-')) + if dec.get('truncated'): + bits.append(' TRUNCATED: SW 62F1, the card stopped executing the script') + if dec.bad_format is not None: + bits.append(' bad-format: %s' % dec.bad_format) + else: # compact + bits.append('%u command(s) executed, last SW=%s data=%s' % ( + dec.number_of_commands, dec.last_status_word, dec.last_response_data or '-')) + return '\n'.join(bits) + + +class CatTpAdminSession: + """One card: hand it the queued commands in order, one secured packet per SDU.""" + + def __init__(self, otak: OtaKeyset, spi: dict, tar: bytes, commands: List, + remote_format: str = 'compact', + on_response: Optional[Callable[[object, object], None]] = None): + self.otak = otak + self.spi = spi + self.tar = tar + self.pending = list(commands) + self.remote_format = remote_format + self.on_response = on_response + self.dialect = OtaDialectCatTp() + self.responses = [] + + def start(self, conn: CatTpConnection): + logger.info('link OPEN with identification %s, %u command(s) queued', + b2h(conn.peer_identification), len(self.pending)) + self._send_next(conn) + + def _send_next(self, conn: CatTpConnection): + if not self.pending: + logger.info('no more commands, closing the link') + conn.close(RST_NORMAL) + return + cmd = self.pending.pop(0) + secured = self.dialect.encode_cmd(self.otak, self.tar, self.spi, cmd, + remote_format=self.remote_format) + if self.spi['counter'] != 'no_counter': + self.otak.cntr += 1 + logger.info('-> command packet (%uB): %s', len(secured), b2h(secured)) + conn.send_sdu(secured) + + def _decode(self, sdu: bytes): + try: + return self.dialect.decode_resp(self.otak, self.spi, sdu, remote_format=self.remote_format) + except (ValueError, OtaCheckError): + # a card that could not process our packet answers in the clear + spi = dict(self.spi, por_shall_be_ciphered=False, por_rc_cc_ds='no_rc_cc_ds') + return self.dialect.decode_resp(self.otak, spi, sdu, remote_format=self.remote_format) + + def on_sdu(self, conn: CatTpConnection, sdu: bytes): + logger.debug('<- response packet (%uB): %s', len(sdu), b2h(sdu)) + try: + res, dec = self._decode(sdu) + except Exception as e: + logger.error('undecodable response packet %s: %s', b2h(sdu), e) + conn.close(RST_NORMAL) + return + self.responses.append((res, dec)) + logger.info('card response:\n%s', format_decoded_response(res, dec)) + if self.on_response: + self.on_response(res, dec) + self._send_next(conn) + + +class CatTpAdminServer: + """CatTpServer that runs a CatTpAdminSession for every card that connects.""" + + def __init__(self, host: str, port: int, otak: OtaKeyset, spi: dict, tar: bytes, + commands: List, remote_format: str = 'compact', + on_response: Optional[Callable[[object, object], None]] = None, + on_session_end: Optional[Callable[[CatTpAdminSession], None]] = None, + **conn_kwargs): + self.otak = otak + self.spi = spi + self.tar = tar + self.commands = commands + self.remote_format = remote_format + self.on_response = on_response + self.on_session_end = on_session_end + self.sessions: Dict[int, CatTpAdminSession] = {} + self.server = CatTpServer(host, port, on_sdu=self._on_sdu, on_state=self._on_state, **conn_kwargs) + + def bind(self) -> int: + return self.server.bind() + + @property + def port(self) -> int: + return self.server.port + + def serve_forever(self): + self.server.serve_forever() + + def shutdown(self): + self.server.shutdown() + + def _on_state(self, conn: CatTpConnection, state: str): + if state == CatTpConnection.OPEN: + session = CatTpAdminSession(self.otak, self.spi, self.tar, self.commands, + self.remote_format, self.on_response) + self.sessions[id(conn)] = session + session.start(conn) + elif state in (CatTpConnection.CLOSE_WAIT, CatTpConnection.CLOSED): + session = self.sessions.pop(id(conn), None) + if session is not None: + logger.info('session ended: %u response(s) collected', len(session.responses)) + if self.on_session_end: + self.on_session_end(session) + + def _on_sdu(self, conn: CatTpConnection, sdu: bytes): + session = self.sessions.get(id(conn)) + if session is None: + logger.warning('SDU without a session, ignoring') + return + session.on_sdu(conn, sdu) + + +def build_commands(apdus: List[bytes], batch: bool, remote_format: str) -> List: + """Group the APDUs per secured packet: one concatenated string for compact, a list for expanded.""" + if not apdus: + return [] + groups = [apdus] if batch else [[a] for a in apdus] + if remote_format == 'expanded': + return groups + return [b''.join(g) for g in groups] + + +def main(): + parser = argparse.ArgumentParser(description=__doc__, + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser.add_argument('--host', default='0.0.0.0', help='IP to bind to') + parser.add_argument('--port', type=int, default=6001, + help='UDP port, also the CAT_TP port the PUSH points the card to') + argparse_add_ota_args(parser) + parser.add_argument('--format', choices=['compact', 'expanded'], default='compact', + help='Remote Application data format, TS 102 226 5.1 / 5.2') + parser.add_argument('--apdu', '-a', action='append', default=[], metavar='HEX', + help='C-APDU to send, may be given several times, executed in order') + parser.add_argument('--apdu-file', help='File with one C-APDU (hex) per line, # comments allowed') + parser.add_argument('--batch', action='store_true', help='All C-APDUs in one command packet') + parser.add_argument('--max-pdu', type=int, default=1024, + help='largest PDU we accept, the card must not exceed it') + parser.add_argument('--max-sdu', type=int, default=65535, help='largest SDU we accept') + parser.add_argument('--window', type=int, default=4, help='receive window in PDUs') + parser.add_argument('--rto', type=float, default=5.0, + help='retransmission timeout in seconds, a card behind BIP is slow') + parser.add_argument('--retries', type=int, default=3, help='retransmissions before RST') + parser.add_argument('-v', '--verbose', action='store_true', help='enable debug output') + args = parser.parse_args() + + logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO, + format='%(asctime)s %(levelname)s %(message)s', + datefmt='%Y-%m-%d %H:%M:%S') + + apdus = [h2b(a) for a in args.apdu] + if args.apdu_file: + for line in Path(args.apdu_file).read_text().splitlines(): + line = line.split('#', 1)[0].strip() + if line: + apdus.append(h2b(line)) + commands = build_commands(apdus, args.batch, args.format) + if not commands: + logger.warning('no C-APDUs: the link will be closed right after the handshake') + + otak = ota_keyset_from_args(args) + spi = ota_spi_from_args(args) + + server = CatTpAdminServer(args.host, args.port, otak, spi, h2b(args.tar), commands, + remote_format=args.format, max_pdu=args.max_pdu, max_sdu=args.max_sdu, + window=args.window, rto=args.rto, max_retries=args.retries) + server.bind() + logger.info('trigger: contrib/cattp_trigger.py --ip <our ip> --port %u', server.port) + try: + server.serve_forever() + except KeyboardInterrupt: + logger.info('shutting down') + server.shutdown() + + +if __name__ == '__main__': + main() diff --git a/tests/unittests/test_cattp_admin_server.py b/tests/unittests/test_cattp_admin_server.py new file mode 100644 index 0000000..4e137e4 --- /dev/null +++ b/tests/unittests/test_cattp_admin_server.py @@ -0,0 +1,130 @@ +#!/usr/bin/env python3 + +# (C) 2026 by sysmocom - s.f.m.c. GmbH +# All Rights Reserved +# +# Author: Eric Wild <ewild(a)sysmocom.de> +# +# 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/>. + +import os.path +import importlib.util +import socket +import threading +import time +import unittest + +from osmocom.utils import h2b, b2h + +from pySim.cattp import CatTpConnection, RST_NORMAL +from pySim.ota import OtaKeyset, OtaDialectCatTp, encode_expanded_cmd, ExpandedRemoteResp + +_PATH = os.path.join(os.path.dirname(__file__), '..', '..', 'contrib', 'cattp_admin_server.py') +_spec = importlib.util.spec_from_file_location('cattp_admin_server', _PATH) +cattp_admin_server = importlib.util.module_from_spec(_spec) +_spec.loader.exec_module(cattp_admin_server) + +KEYSET = OtaKeyset(algo_crypt='aes_cbc', kic_idx=2, algo_auth='aes_cmac', kid_idx=2, + kic=h2b('200102030405060708090a0b0c0d0e0f'), + kid=h2b('201102030405060708090a0b0c0d0e0f')) +SPI = {'counter': 'no_counter', 'ciphering': True, 'rc_cc_ds': 'cc', 'por_in_submit': False, + 'por_shall_be_ciphered': True, 'por_rc_cc_ds': 'cc', 'por': 'por_required'} +TAR = h2b('b00010') + + +class _FakeCard: + """CAT_TP client that unpacks each command packet and answers 9000 for every C-APDU""" + + def __init__(self, port, remote_format): + self.dialect = OtaDialectCatTp() + self.remote_format = remote_format + self.received = [] + self.conn = CatTpConnection(4711, on_sdu=self._on_sdu, max_pdu=256) + self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + self.sock.settimeout(1.0) + self.sock.connect(('127.0.0.1', port)) + + def _on_sdu(self, conn, sdu): + tar, spi, apdu = self.dialect.decode_cmd(KEYSET, sdu) + self.received.append(apdu) + if self.remote_format == 'expanded': + n = apdu.count(b'\x22') # good enough for the C-APDUs used here + data = ExpandedRemoteResp.build(dict(body=dict( + num_executed=dict(number_of_commands=n), + responses=[dict(r_apdu=dict(response_data='', status_word='9000'))] * n))) + else: + data = h2b('01' '9000') + conn.send_sdu(self.dialect.encode_resp(KEYSET, spi, tar, data=data)) + + def run(self, deadline=5.0): + self.conn.connect(self.sock.getpeername()[1], identification=h2b('8949')) + end = time.monotonic() + deadline + while time.monotonic() < end and self.conn.state != 'CLOSE-WAIT': + for raw in self.conn.pop_tx(): + self.sock.send(raw) + try: + self.conn.on_pdu(self.sock.recv(65535)) + except socket.timeout: + self.conn.on_timer() + for raw in self.conn.pop_tx(): + self.sock.send(raw) + self.sock.close() + + +class CatTpAdminServerTest(unittest.TestCase): + APDUS = [h2b('00a40004023f00'), h2b('00b0000010')] + + def _run(self, batch, remote_format): + commands = cattp_admin_server.build_commands(self.APDUS, batch, remote_format) + ended = [] + server = cattp_admin_server.CatTpAdminServer('127.0.0.1', 0, KEYSET, SPI, TAR, commands, + remote_format=remote_format, + on_session_end=ended.append, rto=0.5) + server.bind() + threading.Thread(target=server.serve_forever, daemon=True).start() + self.addCleanup(server.shutdown) + card = _FakeCard(server.port, remote_format) + card.run() + deadline = time.monotonic() + 2.0 + while not ended and time.monotonic() < deadline: + time.sleep(0.01) + self.assertEqual(card.conn.close_reason, RST_NORMAL) + self.assertEqual(len(ended), 1) + return card, ended[0] + + def test_compact_one_packet_per_apdu(self): + card, session = self._run(batch=False, remote_format='compact') + self.assertEqual(card.received, self.APDUS) + self.assertEqual([d.last_status_word for _, d in session.responses], ['9000', '9000']) + + def test_compact_batch(self): + card, session = self._run(batch=True, remote_format='compact') + self.assertEqual(card.received, [b''.join(self.APDUS)]) + self.assertEqual(len(session.responses), 1) + + def test_expanded_batch(self): + card, session = self._run(batch=True, remote_format='expanded') + self.assertEqual(card.received, [encode_expanded_cmd(self.APDUS)]) + res, dec = session.responses[0] + self.assertEqual(res.response_status, 'por_ok') + self.assertEqual(dec.number_of_commands, 2) + + def test_build_commands(self): + self.assertEqual(cattp_admin_server.build_commands([], True, 'compact'), []) + self.assertEqual(cattp_admin_server.build_commands(self.APDUS, False, 'expanded'), + [[self.APDUS[0]], [self.APDUS[1]]]) + + +if __name__ == "__main__": + unittest.main() -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43721?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: I4b97971beb9c0dda73217ece5f1e51fd8ace4540 Gerrit-Change-Number: 43721 Gerrit-PatchSet: 1 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • ...
  • 190
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.