sysmo_isim_sja2: rename use_opc to milenage_use_opc

The OP / OPc parameter is purely milenage specific, so lets express this
by prefixing it with milenage_
This commit is contained in:
Philipp Maier 2023-06-08 12:52:35 +02:00
parent 1e0ea9a6a9
commit b7e0c6f782
1 changed files with 8 additions and 8 deletions

View File

@ -96,7 +96,7 @@ class SYSMO_ISIMSJA2_FILE_EF_XSIM_AUTH_KEY:
"""
algo = SYSMO_ISIMSJA2_ALGO_COMP12V1
use_opc = False
milenage_use_opc = False
sres_dev_func = 1
def __init__(self, content = None):
@ -105,7 +105,7 @@ class SYSMO_ISIMSJA2_FILE_EF_XSIM_AUTH_KEY:
header = content[0]
self.algo = header & 0x0F
self.use_opc = bool((header >> 4) & 1)
self.milenage_use_opc = bool((header >> 4) & 1)
if (header >> 5) & 1:
self.sres_dev_func = 2
@ -121,7 +121,7 @@ class SYSMO_ISIMSJA2_FILE_EF_XSIM_AUTH_KEY:
dump += id_to_str(sysmo_isimsja5_algorithms, self.algo)
dump += "\n"
if self.use_opc == True:
if self.milenage_use_opc == True:
dump += pfx + "Milenage: use OPc\n"
else:
dump += pfx + "Milenage: use OP\n"
@ -134,7 +134,7 @@ class SYSMO_ISIMSJA2_FILE_EF_XSIM_AUTH_KEY:
def encode(self):
out = [0x00]
out[0] = self.algo & 0x0F
if self.use_opc == True:
if self.milenage_use_opc == True:
out[0] |= 1 << 4
out[0] |= ((self.sres_dev_func-1) & 1) << 5
return out
@ -770,7 +770,7 @@ class Sysmo_isim_sja2(Sysmo_usim):
res = self._read_binary(self.sim.filelen)
ef = SYSMO_ISIMSJA2_FILE_EF_USIM_AUTH_KEY(res.apdu)
if ef.use_opc:
if ef.milenage_use_opc:
mode_str = "OPc"
else:
mode_str = "OP"
@ -799,7 +799,7 @@ class Sysmo_isim_sja2(Sysmo_usim):
res = self._read_binary(self.sim.filelen)
ef = SYSMO_ISIMSJA2_FILE_EF_USIM_AUTH_KEY_2G(res.apdu)
ef.opc = op
ef.use_opc = bool(select)
ef.milenage_use_opc = bool(select)
self.sim.update_binary(ef.encode())
if self.sim.has_isim:
@ -807,14 +807,14 @@ class Sysmo_isim_sja2(Sysmo_usim):
res = self._read_binary(self.sim.filelen)
ef = SYSMO_ISIMSJA2_FILE_EF_USIM_AUTH_KEY(res.apdu)
ef.opc = op
ef.use_opc = bool(select)
ef.milenage_use_opc = bool(select)
self.sim.update_binary(ef.encode())
self.__select_xsim_auth_key(isim = False, _2G = False)
res = self._read_binary(self.sim.filelen)
ef = SYSMO_ISIMSJA2_FILE_EF_USIM_AUTH_KEY(res.apdu)
ef.opc = op
ef.use_opc = bool(select)
ef.milenage_use_opc = bool(select)
self.sim.update_binary(ef.encode())
print("")