laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/pysim/+/37140?usp=email )
Change subject: pySim.ota.OtaDialectSMS: Move SMS header construct ip to class level
......................................................................
pySim.ota.OtaDialectSMS: Move SMS header construct ip to class level
this way we can use it in other [future] methods.
Change-Id: If296f823c18864fddcfb9cb1b82a087bac8875d4
---
M pySim/ota.py
1 file changed, 13 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/40/37140/1
diff --git a/pySim/ota.py b/pySim/ota.py
index 54e8f75..d77a64e 100644
--- a/pySim/ota.py
+++ b/pySim/ota.py
@@ -322,6 +322,7 @@
'response_status'/ResponseStatus,
'cc_rc'/Bytes(this.rhl-10),
'secured_data'/GreedyBytes)
+ hdr_construct = Struct('chl'/Int8ub, 'spi'/SPI, 'kic'/KIC,
'kid'/KID_CC, 'tar'/Bytes(3))
def encode_cmd(self, otak: OtaKeyset, tar: bytes, spi: dict, apdu: bytes) ->
bytes:
# length of signature in octets
@@ -343,8 +344,7 @@
chl = 13 + len_sig
# CHL + SPI (+ KIC + KID)
- c = Struct('chl'/Int8ub, 'spi'/SPI, 'kic'/KIC,
'kid'/KID_CC, 'tar'/Bytes(3))
- part_head = c.build({'chl': chl, 'spi':spi, 'kic':kic,
'kid':kid, 'tar':tar})
+ part_head = self.hdr_construct.build({'chl': chl, 'spi':spi,
'kic':kic, 'kid':kid, 'tar':tar})
#print("part_head: %s" % b2h(part_head))
# CNTR + PCNTR (CNTR not used)
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/37140?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: If296f823c18864fddcfb9cb1b82a087bac8875d4
Gerrit-Change-Number: 37140
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange