From 19b4a971e9405d047324922a160d0a976115c5ea Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 8 Jun 2023 17:18:31 +0200 Subject: [PATCH] SJA5: EF.USIM_AUTH_KEY: Display / enforce proper length TUAK K The K value in case of TUAK can be 16 or 32 bytes long. We used to permit/parse/display 32 bytes even if only 16 bytes was configured. Let's enforce the correct length of "K". Fixes: OS#6053 Change-Id: Ia0f9a2138f16dce72f3118001e95baa1c80f23ce --- pySim/sysmocom_sja2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySim/sysmocom_sja2.py b/pySim/sysmocom_sja2.py index 8b1fc04e..1bd4a8a8 100644 --- a/pySim/sysmocom_sja2.py +++ b/pySim/sysmocom_sja2.py @@ -207,7 +207,7 @@ class EF_USIM_AUTH_KEY(TransparentEF): 'tuak_cfg'/TuakCfgByte, 'num_of_keccak_iterations'/Int8ub, 'op_opc'/HexAdapter(Bytes(32)), - 'k'/HexAdapter(Bytes(32))) + 'k'/HexAdapter(Bytes(this.cfg.key_length//8))) def _decode_bin(self, raw_bin_data: bytearray) -> dict: if raw_bin_data[0] & 0x0F == 0x06: