laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/30435 )
Change subject: sysmocom_sja2: simplify and fix op/opc decoder/encoder ......................................................................
sysmocom_sja2: simplify and fix op/opc decoder/encoder
The decoder/encoder of that decodes the EF.xSIM_AUTH_KEY files has an overcomplicated handling for op/and opc. There is a condition that checks if milenage is configured and another one that checks if the string is recognized as OP or OPc. Both is not correct and seems not to work (op and opc is always displayed as "null")
The encoder/decoder should focus on the physical file layout and regardless of any other conriguration the OP/OPc field is physically present and should be displayd and presented for editing.
Change-Id: I6fa3a07e5e473273498d3f13d4cfa33743b787e1 --- M pySim/sysmocom_sja2.py 1 file changed, 3 insertions(+), 20 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
diff --git a/pySim/sysmocom_sja2.py b/pySim/sysmocom_sja2.py index 53e6585..a78318e 100644 --- a/pySim/sysmocom_sja2.py +++ b/pySim/sysmocom_sja2.py @@ -143,12 +143,7 @@ 'algorithm'/Enum(Nibble, milenage=4, comp128v1=1, comp128v2=2, comp128v3=3)) self._construct = Struct('cfg'/CfgByte, 'key'/HexAdapter(Bytes(16)), - 'op'/ If(this.cfg.algorithm == 'milenage' and not this.cfg.use_opc_instead_of_op, - HexAdapter(Bytes(16))), - 'opc' / - If(this.cfg.algorithm == 'milenage' and this.cfg.use_opc_instead_of_op, - HexAdapter(Bytes(16))) - ) + 'op_opc' /HexAdapter(Bytes(16)))
class DF_SYSTEM(CardDF): @@ -198,13 +193,7 @@ 'algorithm'/Enum(Nibble, milenage=4, sha1_aka=5, xor=15)) self._construct = Struct('cfg'/CfgByte, 'key'/HexAdapter(Bytes(16)), - 'op' / - If(this.cfg.algorithm == 'milenage' and not this.cfg.use_opc_instead_of_op, - HexAdapter(Bytes(16))), - 'opc' / - If(this.cfg.algorithm == 'milenage' and this.cfg.use_opc_instead_of_op, - HexAdapter(Bytes(16))) - ) + 'op_opc' /HexAdapter(Bytes(16)))
class EF_USIM_AUTH_KEY_2G(TransparentEF): @@ -216,13 +205,7 @@ 'algorithm'/Enum(Nibble, milenage=4, comp128v1=1, comp128v2=2, comp128v3=3)) self._construct = Struct('cfg'/CfgByte, 'key'/HexAdapter(Bytes(16)), - 'op' / - If(this.cfg.algorithm == 'milenage' and not this.cfg.use_opc_instead_of_op, - HexAdapter(Bytes(16))), - 'opc' / - If(this.cfg.algorithm == 'milenage' and this.cfg.use_opc_instead_of_op, - HexAdapter(Bytes(16))) - ) + 'op_opc' /HexAdapter(Bytes(16)))
class EF_GBA_SK(TransparentEF):