sysmo-isim-sja2: reset SQN parameters completele

The commandline option -S states that the SQN parameters are reset to
default. Actually only the SQN counters are reset. Lets also reset the
related configuration parameters as well.

Change-Id: Ia1f298a00b0c4f0399afd60fefb8b3c8f3a514ba
This commit is contained in:
Philipp Maier 2020-02-18 15:21:53 +01:00
parent 59c1f0eab2
commit 7dde66efb3
1 changed files with 6 additions and 10 deletions

View File

@ -314,18 +314,18 @@ class SYSMO_ISIMSJA2_FILE_EF_USIM_SQN:
# Flag1:
ind_size_bits = 5 # speficy file length by 2^ind_len
sqn_check_enabled = True # perform SQN checks below
sqn_age_limit_enabled = False # perform age limit check: (SQNms-SQN) <= AGE_LIMIT)
sqn_age_limit_enabled = True # perform age limit check: (SQNms-SQN) <= AGE_LIMIT)
sqn_max_delta_enabled = True # perform delta max check: (SWN-SQNms) <= DELTA MAX)
sqn_check_skip_first = True # accept any SQN on the first authentication
# Flag2:
conceal_autn = True # Conceal the value of AUTN
conceal_auts = True # Conceal the value of AUTS
no_amf_clear = False # Do not clear AMF when computing MAC-S
no_amf_clear = True # Do not clear AMF when computing MAC-S
# Data:
max_delta = 2**28 << ind_size_bits
age_limit = 2**28 << ind_size_bits
max_delta = 281474976710655
age_limit = 281474976710655
freshness_data = [0x00] * (6*2**ind_size_bits) # initalize to zero
def __init__(self, content = None):
@ -848,17 +848,13 @@ class Sysmo_isim_sja2(Sysmo_usim):
self.sim.card.SELECT_ADF_USIM()
self.sim.select(SYSMO_ISIMSJA2_EF_USIM_SQN)
res = self._read_binary(self.sim.filelen)
ef = SYSMO_ISIMSJA2_FILE_EF_USIM_SQN(res.apdu)
ef.reset()
ef = SYSMO_ISIMSJA2_FILE_EF_USIM_SQN()
self.sim.update_binary(ef.encode())
if self.has_isim:
self.sim.card.SELECT_ADF_ISIM()
self.sim.select(SYSMO_ISIMSJA2_EF_USIM_SQN)
res = self._read_binary(self.sim.filelen)
ef = SYSMO_ISIMSJA2_FILE_EF_USIM_SQN(res.apdu)
ef.reset()
ef = SYSMO_ISIMSJA2_FILE_EF_USIM_SQN()
self.sim.update_binary(ef.encode())
print("")