This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/23710 )
Change subject: ts_31_102.py: switch EF.Keys from imperative to declarative codec
......................................................................
ts_31_102.py: switch EF.Keys from imperative to declarative codec
Change-Id: I215a61c1e44ee2c5df70a8ca96344b4dd4d93c00
---
M pySim/ts_31_102.py
1 file changed, 3 insertions(+), 6 deletions(-)
  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/10/23710/1
diff --git a/pySim/ts_31_102.py b/pySim/ts_31_102.py
index cdb6612..320a2cd 100644
--- a/pySim/ts_31_102.py
+++ b/pySim/ts_31_102.py
@@ -269,6 +269,8 @@
 ######################################################################
 
 from struct import unpack, pack
+from construct import *
+from pySim.construct import HexAdapter
 from pySim.filesystem import *
 from pySim.ts_51_011 import EF_IMSI, EF_xPLMNwAcT, EF_SPN, EF_CBMI, EF_ACC, EF_PLMNsel, EF_AD
 from pySim.ts_51_011 import EF_CBMID, EF_CBMIR
@@ -416,12 +418,7 @@
     def __init__(self, fid='6f08', sfid=0x08, name='EF.Keys', size={33,33},
                  desc='Ciphering and Integrity Keys'):
         super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size)
-    def _decode_bin(self, in_bin):
-        return {'ksi': in_bin[0],
-                'ck': b2h(in_bin[1:17]),
-                'ik': b2h(in_bin[17:33])}
-    def _encode_bin(self, in_json):
-        return h2b(in_json['ksi']) + h2b(in_json['ck']) + h2b(in_json['ik'])
+        self._construct = Struct('ksi'/Int8ub, 'ck'/HexAdapter(Bytes(16)), 'ik'/HexAdapter(Bytes(16)))
 
 # TS 31.103 Section 4.2.7
 class EF_UST(TransparentEF):
-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/23710
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I215a61c1e44ee2c5df70a8ca96344b4dd4d93c00
Gerrit-Change-Number: 23710
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210410/bd144920/attachment.htm>