sysmo_isim_sja2: add full TUAK support and unit-tests

we do not have full TUAK support yet. All we can do so far is to set the
algorithm to TUAK, but we can not set configuration parameters and keys.
This patch adds features to modify the TUAK configuration byte. The key
and the TOP/TOPc is modified using the existing key and OP/OPC
commandline otions.

This patch also addes tests to verify sysmo-isim-tool.sja5.py. This also
includes TUAK. The tests are not activated for automatic testing yet
since the test fixture does not yet have a sysmo-isim-sja5 installed.

Related: SYS#6473
This commit is contained in:
Philipp Maier 2023-06-23 13:39:50 +02:00
parent 6702e0e5e8
commit e82fed7520
23 changed files with 2779 additions and 5 deletions

View File

@ -32,7 +32,8 @@ from common import *
class Application(Common):
getopt_dump = False
getopt_show_tuak_cfg = False
getopt_write_tuak_cfg = None
# Automatically executed by superclass
def _banner(self):
@ -46,16 +47,26 @@ class Application(Common):
for opt, arg in opts:
if opt in ("-d", "--dump"):
self.getopt_dump = True
elif opt in ("-w", "--tuak-cfg"):
self.getopt_show_tuak_cfg = True
elif opt in ("-W", "--set-tuak-cfg"):
self.getopt_write_tuak_cfg = arg.split(':', 3)
# Automatically executed by superclass when -h or --help is supplied as option
def _helptext(self):
print(" -d, --dump ..................... Dump propritary file contents")
print(" -w, --tuak-cfg ................. Show TUAK configuration")
print(" -W, --set-tuak-cfg R:M:C:K ..... Set TUAK configuration")
print("")
print(" For Option -T, the following algorithms are valid:")
print('\n'.join([' %d %s' % entry for entry in sysmo_isimsja5_algorithms]))
print("")
print(" For Option -W, the following values are applicable:")
print(" R = RES-Size in bits: 32, 64, 128 or 256")
print(" M = MAC-A and MAC-S size in bits: 64, 128 or 256")
print(" C = CK and IK size in bits: 128 or 256")
print(" K = Number of Keccak iterations: 1-255")
print("")
# Automatically executed by superclass before _execute() is called
def _init(self):
@ -67,11 +78,15 @@ class Application(Common):
if self.getopt_dump:
self.sim.dump()
elif self.getopt_show_tuak_cfg:
self.sim.show_tuak_cfg()
elif self.getopt_write_tuak_cfg:
self.sim.write_tuak_cfg(self.getopt_write_tuak_cfg[0], self.getopt_write_tuak_cfg[1], \
self.getopt_write_tuak_cfg[2], self.getopt_write_tuak_cfg[3])
def main(argv):
Application(argv, "d", ["dump"], True)
Application(argv, "dwW:", ["dump"], True)
if __name__ == "__main__":

View File

@ -102,10 +102,41 @@ sysmo_isimsjax_16_byte_key_algorithms = [
SYSMO_ISIMSJA5_ALGO_XOR_2G,
]
# TUAK configuration byte
SYSMO_ISIMSJA5_TUAK_RES_SIZE_32_BIT = 0
SYSMO_ISIMSJA5_TUAK_RES_SIZE_64_BIT = 1
SYSMO_ISIMSJA5_TUAK_RES_SIZE_128_BIT = 2
SYSMO_ISIMSJA5_TUAK_RES_SIZE_256_BIT = 3
SYSMO_ISIMSJA5_TUAK_MAC_SIZE_64_BIT = 0
SYSMO_ISIMSJA5_TUAK_MAC_SIZE_128_BIT = 1
SYSMO_ISIMSJA5_TUAK_MAC_SIZE_256_BIT = 2
SYSMO_ISIMSJA5_TUAK_CKIK_SIZE_128_BIT = 0
SYSMO_ISIMSJA5_TUAK_CKIK_SIZE_256_BIT = 1
sysmo_isimsja5_res_sizes = [
(SYSMO_ISIMSJA5_TUAK_RES_SIZE_32_BIT, "32"),
(SYSMO_ISIMSJA5_TUAK_RES_SIZE_64_BIT, "64"),
(SYSMO_ISIMSJA5_TUAK_RES_SIZE_128_BIT, "128"),
(SYSMO_ISIMSJA5_TUAK_RES_SIZE_256_BIT, "256")
]
sysmo_isimsja5_mac_sizes = [
(SYSMO_ISIMSJA5_TUAK_MAC_SIZE_64_BIT, "64"),
(SYSMO_ISIMSJA5_TUAK_MAC_SIZE_128_BIT, "128"),
(SYSMO_ISIMSJA5_TUAK_MAC_SIZE_256_BIT, "256")
]
sysmo_isimsja5_ckik_sizes = [
(SYSMO_ISIMSJA5_TUAK_CKIK_SIZE_128_BIT, "128"),
(SYSMO_ISIMSJA5_TUAK_CKIK_SIZE_256_BIT, "256")
]
sysmo_isimsjax_op_opc = [
(True, 'OPc'),
(False, 'OP'),
]
sysmo_isimsja5_top_topc = [
(True, 'TOPc'),
(False, 'TOP'),
]
class SYSMO_ISIMSJAX_ALGO_PARS_MILENAGE:
use_opc = False
@ -261,6 +292,8 @@ class SYSMO_ISIMSJAX_FILE_EF_XSIM_AUTH_KEY:
self.algo_pars = SYSMO_ISIMSJAX_ALGO_PARS_SHA1AKA(content)
elif self.algo == SYSMO_ISIMSJA2_ALGO_XOR:
self.algo_pars = SYSMO_ISIMSJAX_ALGO_PARS_XOR(content)
elif self.algo == SYSMO_ISIMSJA5_ALGO_TUAK:
self.algo_pars = SYSMO_ISIMSJA5_ALGO_PARS_TUAK(content)
def __str__(self) -> str:
dump = ""
@ -331,6 +364,50 @@ class SYSMO_ISIMSJAX_ALGO_KEY_MILENAGE(SYSMO_ISIMSJAX_ALGO_KEY_COMP128):
return super().encode() + self.opc
class SYSMO_ISIMSJAX_ALGO_KEY_TUAK:
res_size = 0 #3 bit value
mac_size = 0 #3 bit value
ckik_size = 0 #1 bit value
num_keccak = 0 #1 byte value
topc = [0x00] * 32
key = [0x00] * 32
def __init__(self, content = None):
if content == None:
return
self.res_size = int(content[1] & 7)
self.mac_size = int((content[1] >> 3) & 7)
self.ckik_size = bool((content[1] >> 6) & 1)
self.num_keccak = content[2]
self.topc = content[3:35]
self.key = content[35:67]
def __str__(self) -> str:
dump = ""
pfx = " "
dump += pfx + "RES size: %s bit" % id_to_str(sysmo_isimsja5_res_sizes, self.res_size) + "\n"
dump += pfx + "MAC-A/MAC-S size: %s bit" % id_to_str(sysmo_isimsja5_mac_sizes, self.mac_size) + "\n"
dump += pfx + "Keccak iterations: %d" % self.num_keccak + "\n"
dump += pfx + "TOPc: " + hexdump(self.topc) + "\n"
#TODO: Keys may be 128 or 256 bits long. The key length is defined
#in the header of the file, which means we cannot access this bit
#from here but it would be nice to display the key in its correct
#length though.
dump += pfx + "Key: " + hexdump(self.key)
return dump
def encode(self) -> list:
param_byte = self.res_size & 7
param_byte |= (self.res_size & 7) << 3
param_byte |= (self.ckik_size & 1) << 6
out = [param_byte]
out += [self.num_keccak]
out += self.topc
out += self.key
return out
class SYSMO_ISIMSJAX_FILE_EF_USIM_AUTH_KEY(SYSMO_ISIMSJAX_FILE_EF_XSIM_AUTH_KEY):
algo_key = None
@ -351,6 +428,8 @@ class SYSMO_ISIMSJAX_FILE_EF_USIM_AUTH_KEY(SYSMO_ISIMSJAX_FILE_EF_XSIM_AUTH_KEY)
elif self.algo == SYSMO_ISIMSJA2_ALGO_XOR or \
self.algo == SYSMO_ISIMSJA5_ALGO_XOR_2G:
self.algo_key = SYSMO_ISIMSJAX_ALGO_KEY_XOR(content)
elif self.algo == SYSMO_ISIMSJA5_ALGO_TUAK:
self.algo_key = SYSMO_ISIMSJAX_ALGO_KEY_TUAK(content)
def __str__(self) -> str:
dump = ""
@ -757,6 +836,11 @@ class Sysmo_isim_sja2(Sysmo_usim):
"""
if ef.algo in sysmo_isimsjax_16_byte_key_algorithms:
print(" %s: Key: %s" % (gen, hexdump(ef.algo_key.ki)))
elif ef.algo is SYSMO_ISIMSJA5_ALGO_TUAK:
if not ef.algo_pars.use_256_bit_key:
print(" %s: Key: %s" % (gen, hexdump(ef.algo_key.key[0:16])))
else:
print(" %s: Key: %s" % (gen, hexdump(ef.algo_key.key)))
else:
print(" * %s: Key not applicable for selected algorithm." % gen)
@ -801,6 +885,13 @@ class Sysmo_isim_sja2(Sysmo_usim):
ef.algo_key.ki = key
self.sim.update_binary(ef.encode())
print(" * %s: Key programmed." % gen)
elif ef.algo is SYSMO_ISIMSJA5_ALGO_TUAK:
ef.algo_key.key = key
ef.algo_pars.use_256_bit_key = False
if len(key) > 16:
ef.algo_pars.use_256_bit_key = True
self.sim.update_binary(ef.encode())
print(" * %s: Key programmed." % gen)
else:
print(" * %s: Key not applicable for selected algorithm." % gen)
@ -915,6 +1006,9 @@ class Sysmo_isim_sja2(Sysmo_usim):
if ef.algo is SYSMO_ISIMSJA2_ALGO_MILENAGE:
print(" %s: %s: %s" % (gen, id_to_str(sysmo_isimsjax_op_opc, ef.algo_pars.use_opc), \
hexdump(ef.algo_key.opc)))
elif ef.algo is SYSMO_ISIMSJA5_ALGO_TUAK:
print(" %s: %s: %s" % (gen, id_to_str(sysmo_isimsja5_top_topc, ef.algo_pars.use_topc), \
hexdump(ef.algo_key.topc)))
else:
print(" * %s: OP/OPc not applicable for selected algorithm." % gen)
@ -960,6 +1054,11 @@ class Sysmo_isim_sja2(Sysmo_usim):
ef.algo_pars.use_opc = bool(select)
self.sim.update_binary(ef.encode())
print(" %s %s programmed." % (gen, id_to_str(sysmo_isimsjax_op_opc, bool(select))));
elif ef.algo is SYSMO_ISIMSJA5_ALGO_TUAK and len(op) is 32:
ef.algo_key.topc = op
ef.algo_pars.use_topc = bool(select)
self.sim.update_binary(ef.encode())
print(" %s %s programmed." % (gen, id_to_str(sysmo_isimsja5_top_topc, bool(select))));
else:
print(" %s OP/OPc not applicable for selected algorithm, skipping..." % gen)
@ -1035,6 +1134,109 @@ class Sysmo_isim_sja2(Sysmo_usim):
print("")
def __display_tuak_cfg(self, ef, gen:str):
"""
Helper method to display key
"""
if ef.algo is SYSMO_ISIMSJA5_ALGO_TUAK:
print(" %s: TUAK configuration:" % gen)
print(" RES size: %s bit" % id_to_str(sysmo_isimsja5_res_sizes, ef.algo_key.res_size))
print(" MAC-A/MAC-S size: %s bit" % id_to_str(sysmo_isimsja5_mac_sizes, ef.algo_key.mac_size))
print(" CK/IK size: %s bit" % id_to_str(sysmo_isimsja5_ckik_sizes, ef.algo_key.ckik_size))
print(" Keccak iterations: %d" % ef.algo_key.num_keccak)
else:
print(" * %s: TUAK configuration not applicable for selected algorithm." % gen)
def show_tuak_cfg(self):
print("Reading TUAK configuration...")
self._init()
print(" * Reading...")
self.__select_xsim_auth_key(isim = False, _2G = True)
res = self._read_binary(self.sim.filelen)
ef_2g = SYSMO_ISIMSJAX_FILE_EF_USIM_AUTH_KEY(res.apdu)
self.__select_xsim_auth_key(isim = False, _2G = False)
res = self._read_binary(self.sim.filelen)
ef_3g = SYSMO_ISIMSJAX_FILE_EF_USIM_AUTH_KEY(res.apdu)
if self.sim.has_isim:
self.__select_xsim_auth_key(isim = True, _2G = False)
res = self._read_binary(self.sim.filelen)
ef_4g5g = SYSMO_ISIMSJAX_FILE_EF_USIM_AUTH_KEY(res.apdu)
else:
ef_4g5g = None
print(" * Current TUAK configuration:")
self.__display_tuak_cfg(ef_2g, "2g")
self.__display_tuak_cfg(ef_3g, "3g")
if ef_4g5g:
self.__display_tuak_cfg(ef_4g5g, "4g5g")
print("")
def __program_tuak_cfg(self, res_size:int, mac_size:int, ckik_size:int, num_keccak:int, gen:str):
"""
Helper method to program key, EF must be selected first
"""
res = self._read_binary(self.sim.filelen)
ef = SYSMO_ISIMSJAX_FILE_EF_USIM_AUTH_KEY_2G(res.apdu)
if ef.algo is SYSMO_ISIMSJA5_ALGO_TUAK:
ef.algo_key.res_size = res_size
ef.algo_key.mac_size = mac_size
ef.algo_key.ckik_size = bool(ckik_size)
ef.algo_key.num_keccak = num_keccak
self.sim.update_binary(ef.encode())
print(" %s TUAK configuration programmed." % gen);
else:
print(" %s TUAK configuration not applicable for selected algorithm, skipping..." % gen)
def write_tuak_cfg(self, res_size_str:str, mac_size_str:str, ckik_size_str:str, num_keccak_str:str):
print("Writing TUAK configuration...")
self._init()
print(" * New TUAK configuration:")
res_size = str_to_id(sysmo_isimsja5_res_sizes, res_size_str, -1)
if res_size < 0:
print(" * Invalid TUAK configuration, RES-Size must be 32, 64, 128 or 256 bit!")
print("")
return
mac_size = str_to_id(sysmo_isimsja5_mac_sizes, mac_size_str, -1)
if mac_size < 0:
print(" * Invalid TUAK configuration, MAC-Size must be 64, 128 or 256 bit!")
print("")
return
ckik_size = str_to_id(sysmo_isimsja5_ckik_sizes, ckik_size_str, -1)
if ckik_size < 0:
print(" * Invalid TUAK configuration, MAC-Size must be 128 or 256 bit!")
print("")
return
num_keccak = int(num_keccak_str)
if num_keccak > 255:
print(" * Invalid TUAK configuration, number of Keccak iterations must not exceed 256!")
print("")
return
print(" RES size: %s bit" % id_to_str(sysmo_isimsja5_res_sizes, res_size))
print(" MAC-A/MAC-S size: %s bit" % id_to_str(sysmo_isimsja5_mac_sizes, mac_size))
print(" CK/IK size: %s bit" % id_to_str(sysmo_isimsja5_ckik_sizes, ckik_size))
print(" Keccak iterations: %d" % num_keccak)
print(" * Programming...")
self.__select_xsim_auth_key(isim = False, _2G = True)
self.__program_tuak_cfg(res_size, mac_size, ckik_size, num_keccak, "2g")
self.__select_xsim_auth_key(isim = False, _2G = False)
self.__program_tuak_cfg(res_size, mac_size, ckik_size, num_keccak, "3g")
if self.sim.has_isim:
self.__select_xsim_auth_key(isim = True, _2G = False)
self.__program_tuak_cfg(res_size, mac_size, ckik_size, num_keccak, "4g5g")
print("")
class Sysmo_isim_sja5(Sysmo_isim_sja2):
algorithms = sysmo_isimsja5_algorithms

View File

@ -32,3 +32,23 @@ echo ""
echo ""
echo ""
echo ""
# The sysmo-isim-sja5 related tests will be activated as soon as a physical
# card becomes available in the test fixture.
#
#echo "=========================================================="
#echo " EXECUTING TESTS FOR SYSMO-USIM-SJA5"
#echo "=========================================================="
#echo ""
#cd ./sja5
#echo "Location $PWD"
#echo ""
#sh ./run-tests
#if [ ! $? -eq 0 ]; then
# exit 1
#fi
#cd ..
#echo ""
#echo ""
#echo ""
#echo ""

16
tests/sja5/01_auth.out Normal file
View File

@ -0,0 +1,16 @@
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Done!

4
tests/sja5/01_auth.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
. ./test-data
$TOOL -a $ADMPIN

1440
tests/sja5/02_algo.out Normal file

File diff suppressed because it is too large Load Diff

9
tests/sja5/02_algo.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
. ./test-data
ALGOS="1:1 3:1 4:1 5:1 15:1 1:4 3:15 2:2 1:3 1:6 6:6 6:1 1:2:3 1:4:5 5:4:15 5:4:6 "
ALGOS=$ALGOS"MILENAGE:MILENAGE COMP128v1:MILENAGE COMP128v3:MILENAGE COMP128v2:MILENAGE SHA1-AKA:XOR SHA1-AKA:TUAK TUAK:MILENAGE TUAK:TUAK COMP128v1:MILENAGE COMP128v1:MILENAGE:SHA1-AKA COMP128v2:COMP128v1:COMP128v3 COMP128v2:COMP128v1:TUAK COMP128v2:TUAK:COMP128v1 TUAK:COMP128v1:COMP128v3"
for algo in $ALGOS; do
$TOOL -a $ADMPIN -T $algo
$TOOL -a $ADMPIN -t
done

View File

@ -0,0 +1,124 @@
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Programming Milenage parameters...
* Initalizing...
* New Milenage Parameters for (EF.MILENAGE_CFG):
R1: 0xaa
R2: 0xbb
R3: 0xcc
R4: 0xdd
R5: 0xee
C1: 1234567890abcdef1234567890abcdef
C2: f1234567890abcdef1234567890abcde
C3: ef1234567890abcdef1234567890abcd
C4: def1234567890abcdef1234567890abc
C5: cdef1234567890abcdef1234567890ab
* Programming...
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading Milenage parameters...
* Initalizing...
* Reading...
* Current Milenage Parameters:
R1: 0xaa
R2: 0xbb
R3: 0xcc
R4: 0xdd
R5: 0xee
C1: 1234567890abcdef1234567890abcdef
C2: f1234567890abcdef1234567890abcde
C3: ef1234567890abcdef1234567890abcd
C4: def1234567890abcdef1234567890abc
C5: cdef1234567890abcdef1234567890ab
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Programming Milenage parameters...
* Initalizing...
* New Milenage Parameters for (EF.MILENAGE_CFG):
R1: 0x40
R2: 0x0
R3: 0x20
R4: 0x40
R5: 0x60
C1: 00000000000000000000000000000000
C2: 00000000000000000000000000000001
C3: 00000000000000000000000000000002
C4: 00000000000000000000000000000004
C5: 00000000000000000000000000000008
* Programming...
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading Milenage parameters...
* Initalizing...
* Reading...
* Current Milenage Parameters:
R1: 0x40
R2: 0x0
R3: 0x20
R4: 0x40
R5: 0x60
C1: 00000000000000000000000000000000
C2: 00000000000000000000000000000001
C3: 00000000000000000000000000000002
C4: 00000000000000000000000000000004
C5: 00000000000000000000000000000008
Done!

24
tests/sja5/03_milenage_par.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
. ./test-data
# Write and reread with test data
C1="1234567890ABCDEF1234567890ABCDEF"
C2="F1234567890ABCDEF1234567890ABCDE"
C3="EF1234567890ABCDEF1234567890ABCD"
C4="DEF1234567890ABCDEF1234567890ABC"
C5="CDEF1234567890ABCDEF1234567890AB"
R12345="AA:BB:CC:DD:EE"
PARAMS=$C1$C2$C3$C4$C5$R12345
$TOOL -a $ADMPIN -L $PARAMS
$TOOL -a $ADMPIN -l
# Write and reread with factory defaults
C1="00000000000000000000000000000000"
C2="00000000000000000000000000000001"
C3="00000000000000000000000000000002"
C4="00000000000000000000000000000004"
C5="00000000000000000000000000000008"
R12345="40:00:20:40:60"
PARAMS=$C1$C2$C3$C4$C5$R12345
$TOOL -a $ADMPIN -L $PARAMS
$TOOL -a $ADMPIN -l

122
tests/sja5/04_op_opc.out Normal file
View File

@ -0,0 +1,122 @@
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Programming Authentication parameters...
* Initalizing...
* New algorithm setting:
2g: 4=MILENAGE
3g: 4=MILENAGE
4g5g: 4=MILENAGE
* Programming...
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Writing OPc value...
* Initalizing...
* New OPc setting:
OPc: 000102030405060708090a0b0c0d0e0f
* Programming...
2g OPc programmed.
3g OPc programmed.
4g5g OPc programmed.
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading OP/c value...
* Initalizing...
* Reading...
* Current OP/OPc setting:
2g: OPc: 000102030405060708090a0b0c0d0e0f
3g: OPc: 000102030405060708090a0b0c0d0e0f
4g5g: OPc: 000102030405060708090a0b0c0d0e0f
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Writing OP value...
* Initalizing...
* New OPc setting:
OP: 840337c3d45397ce8ea8609ffdc47224
* Programming...
2g OP programmed.
3g OP programmed.
4g5g OP programmed.
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading OP/c value...
* Initalizing...
* Reading...
* Current OP/OPc setting:
2g: OP: 840337c3d45397ce8ea8609ffdc47224
3g: OP: 840337c3d45397ce8ea8609ffdc47224
4g5g: OP: 840337c3d45397ce8ea8609ffdc47224
Done!

13
tests/sja5/04_op_opc.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
. ./test-data
# OP/OPc is milenage specific, make sure we have milenage configured before
# testing.
$TOOL -a $ADMPIN -T "MILENAGE:MILENAGE"
$TOOL -a $ADMPIN -C 000102030405060708090a0b0c0d0e0f
$TOOL -a $ADMPIN -o
$TOOL -a $ADMPIN -O 840337c3d45397ce8ea8609ffdc47224
$TOOL -a $ADMPIN -o

98
tests/sja5/05_key.out Normal file
View File

@ -0,0 +1,98 @@
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Writing Key value...
* Initalizing...
* New Key setting:
Key: a0b1c2d3e4f5061728394a5b6c7d8e9f
* Programming...
* 2g: Key programmed.
* 3g: Key programmed.
* 4g5g: Key programmed.
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading Key value...
* Initalizing...
* Reading...
* Current Key setting:
2g: Key: a0b1c2d3e4f5061728394a5b6c7d8e9f
3g: Key: a0b1c2d3e4f5061728394a5b6c7d8e9f
4g5g: Key: a0b1c2d3e4f5061728394a5b6c7d8e9f
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Writing Key value...
* Initalizing...
* New Key setting:
Key: d7882eae7cd14f06108c55f8e5cffe93
* Programming...
* 2g: Key programmed.
* 3g: Key programmed.
* 4g5g: Key programmed.
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading Key value...
* Initalizing...
* Reading...
* Current Key setting:
2g: Key: d7882eae7cd14f06108c55f8e5cffe93
3g: Key: d7882eae7cd14f06108c55f8e5cffe93
4g5g: Key: d7882eae7cd14f06108c55f8e5cffe93
Done!

11
tests/sja5/05_key.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
. ./test-data
# set to arbitrary value + read back
$TOOL -a $ADMPIN -K a0b1c2d3e4f5061728394a5b6c7d8e9f
$TOOL -a $ADMPIN -k
# set to original value + read back
$TOOL -a $ADMPIN -K $KI
$TOOL -a $ADMPIN -k

75
tests/sja5/06_seq.out Normal file
View File

@ -0,0 +1,75 @@
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading Milenage Sequence parameters...
* Initalizing...
* Current SQN Configuration for ADF_USIM:
IND (bits): 5
SQN Check enabled
SQN Age Limit disabled
SQN Max Delta enabled
SQN Skip first enabled
SQN Conceal AUTN enabled
SQN Conceal AUTS enabled
SQN No AMF clear disabled
Max Delta: 8589934592
Age Limit: 8589934592
Freshness Data:
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000
* Current SQN Configuration for ADF_ISIM:
IND (bits): 5
SQN Check enabled
SQN Age Limit disabled
SQN Max Delta enabled
SQN Skip first enabled
SQN Conceal AUTN enabled
SQN Conceal AUTS enabled
SQN No AMF clear disabled
Max Delta: 8589934592
Age Limit: 8589934592
Freshness Data:
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
* Resetting SQN Configuration to defaults...
* Initalizing...
* Resetting...
Done!

8
tests/sja5/06_seq.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
. ./test-data
# we can only read them for now, which will of course change once we perform auth against it
$TOOL -a $ADMPIN -s
# test if resetting SQN parameters works
$TOOL -a $ADMPIN -S

132
tests/sja5/07_mnclen.out Normal file
View File

@ -0,0 +1,132 @@
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Writing MNCLEN value...
* Initalizing...
* New MNCLEN setting:
MNCLEN: 0x02
* Programming...
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading MNCLEN value...
* Initalizing...
* Reading...
* Current MNCLEN setting:
MNCLEN: 0x02
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Writing MNCLEN value...
* Initalizing...
* New MNCLEN setting:
MNCLEN: 0x03
* Programming...
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading MNCLEN value...
* Initalizing...
* Reading...
* Current MNCLEN setting:
MNCLEN: 0x03
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Writing MNCLEN value...
* Initalizing...
* New MNCLEN setting:
MNCLEN: 0x02
* Programming...
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading MNCLEN value...
* Initalizing...
* Reading...
* Current MNCLEN setting:
MNCLEN: 0x02
Done!

15
tests/sja5/07_mnclen.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
. ./test-data
# set to 2 (default) + read back
$TOOL -a $ADMPIN -N 02
$TOOL -a $ADMPIN -n
# set to 3 + read back
$TOOL -a $ADMPIN -N 03
$TOOL -a $ADMPIN -n
# set to 2 (default) + read back
$TOOL -a $ADMPIN -N 02
$TOOL -a $ADMPIN -n

349
tests/sja5/08_tuak.out Normal file
View File

@ -0,0 +1,349 @@
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Programming Authentication parameters...
* Initalizing...
* New algorithm setting:
2g: 1=COMP128v1
3g: 4=MILENAGE
4g5g: 6=TUAK
* Programming...
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Writing TUAK configuration...
* Initalizing...
* New TUAK configuration:
RES size: 32 bit
MAC-A/MAC-S size: 64 bit
CK/IK size: 128 bit
Keccak iterations: 123
* Programming...
2g TUAK configuration not applicable for selected algorithm, skipping...
3g TUAK configuration not applicable for selected algorithm, skipping...
4g5g TUAK configuration programmed.
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading TUAK configuration...
* Initalizing...
* Reading...
* Current TUAK configuration:
* 2g: TUAK configuration not applicable for selected algorithm.
* 3g: TUAK configuration not applicable for selected algorithm.
4g5g: TUAK configuration:
RES size: 32 bit
MAC-A/MAC-S size: 64 bit
CK/IK size: 128 bit
Keccak iterations: 123
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Writing Key value...
* Initalizing...
* New Key setting:
Key: a0b1c2d3e4f5061728394a5b6c7d8e9f
* Programming...
* 2g: Key programmed.
* 3g: Key programmed.
* 4g5g: Key programmed.
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading Key value...
* Initalizing...
* Reading...
* Current Key setting:
2g: Key: a0b1c2d3e4f5061728394a5b6c7d8e9f
3g: Key: a0b1c2d3e4f5061728394a5b6c7d8e9f
4g5g: Key: a0b1c2d3e4f5061728394a5b6c7d8e9f
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Writing Key value...
* Initalizing...
* New Key setting:
Key: a0b1ca0b1c2d3e4fe8394a55061722d3b6c7d8e9f8394a5506172e9fb6c7d84f
* Programming...
* 2g: Key programmed.
* 3g: Key programmed.
* 4g5g: Key programmed.
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading Key value...
* Initalizing...
* Reading...
* Current Key setting:
2g: Key: a0b1ca0b1c2d3e4fe8394a55061722d3
3g: Key: a0b1ca0b1c2d3e4fe8394a55061722d3
4g5g: Key: a0b1ca0b1c2d3e4fe8394a55061722d3b6c7d8e9f8394a5506172e9fb6c7d84f
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Writing OP value...
* Initalizing...
* New OPc setting:
OP: e8394a55061a0b1ca3e4f722d3b6c7d8e172e9fb680b1cc7d84f9f2d394a5506
* Programming...
2g OP/OPc not applicable for selected algorithm, skipping...
3g OP programmed.
4g5g TOP programmed.
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading OP/c value...
* Initalizing...
* Reading...
* Current OP/OPc setting:
* 2g: OP/OPc not applicable for selected algorithm.
3g: OP: e8394a55061a0b1ca3e4f722d3b6c7d8
4g5g: TOP: e8394a55061a0b1ca3e4f722d3b6c7d8e172e9fb680b1cc7d84f9f2d394a5506
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Writing OPc value...
* Initalizing...
* New OPc setting:
OPc: 03b694a5506c7d8e172e9fb680b1cc7d61a0b1ca3e4f722d84e8394a55f9f2d3
* Programming...
2g OP/OPc not applicable for selected algorithm, skipping...
3g OPc programmed.
4g5g TOPc programmed.
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading OP/c value...
* Initalizing...
* Reading...
* Current OP/OPc setting:
* 2g: OP/OPc not applicable for selected algorithm.
3g: OPc: 03b694a5506c7d8e172e9fb680b1cc7d
4g5g: TOPc: 03b694a5506c7d8e172e9fb680b1cc7d61a0b1ca3e4f722d84e8394a55f9f2d3
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Programming Authentication parameters...
* Initalizing...
* New algorithm setting:
2g: 1=COMP128v1
3g: 1=COMP128v1
4g5g: 1=COMP128v1
* Programming...
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Writing Key value...
* Initalizing...
* New Key setting:
Key: d7882eae7cd14f06108c55f8e5cffe93
* Programming...
* 2g: Key programmed.
* 3g: Key programmed.
* 4g5g: Key programmed.
Done!
sysmoISIM-SJA5 parameterization tool
Copyright (c) 2023 sysmocom - s.f.m.c. GmbH
Trying to find card with ATR: 3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 59 C4
Initializing smartcard terminal...
* Detected Card IMSI: 901700000046734
ISIM Application installed
USIM Application installed
Authenticating...
* Remaining attempts: 3
* Authenticating...
* Authentication successful
* Remaining attempts: 3
Reading Key value...
* Initalizing...
* Reading...
* Current Key setting:
2g: Key: d7882eae7cd14f06108c55f8e5cffe93
3g: Key: d7882eae7cd14f06108c55f8e5cffe93
4g5g: Key: d7882eae7cd14f06108c55f8e5cffe93
Done!

30
tests/sja5/08_tuak.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
. ./test-data
# First we select a configuration that includes TUAK
$TOOL -a $ADMPIN -T "COMP128v1:MILENAGE:TUAK"
# Program/read-back valid TUAK configuration
$TOOL -a $ADMPIN -W 32:64:128:123
$TOOL -a $ADMPIN -w
# Program/read-back a 128 bit key
$TOOL -a $ADMPIN -K a0b1c2d3e4f5061728394a5b6c7d8e9f
$TOOL -a $ADMPIN -k
# Program/read-back a 256 bit key
$TOOL -a $ADMPIN -K a0b1ca0b1c2d3e4fe8394a55061722d3b6c7d8e9f8394a5506172e9fb6c7d84f
$TOOL -a $ADMPIN -k
# Program/read-back a TOP value
$TOOL -a $ADMPIN -O e8394a55061a0b1ca3e4f722d3b6c7d8e172e9fb680b1cc7d84f9f2d394a5506
$TOOL -a $ADMPIN -o
# Program/read-back a TOPc value
$TOOL -a $ADMPIN -C 03b694a5506c7d8e172e9fb680b1cc7d61a0b1ca3e4f722d84e8394a55f9f2d3
$TOOL -a $ADMPIN -o
# restore original Ki value + read back
$TOOL -a $ADMPIN -T "COMP128v1:COMP128v1:COMP128v1"
$TOOL -a $ADMPIN -K $KI
$TOOL -a $ADMPIN -k

9
tests/sja5/prepare Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
. ./test-data
echo "================ PREPARING TEST CARD ================"
$TOOL -a $ADMPIN -J $IMSI
$TOOL -a $ADMPIN -S
echo "================ TEST CARD PREPARED ================="
echo ""

14
tests/sja5/regen Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
echo "Regenerating test output..."
./prepare
./01_auth.sh > ./01_auth.out
./02_algo.sh > ./02_algo.out
./03_milenage_par.sh > ./03_milenage_par.out
./04_op_opc.sh > ./04_op_opc.out
./05_ki.sh > ./05_ki.out
./06_seq.sh > ./06_seq.out
./07_mnclen.sh > ./07_mnclen.out
echo "Reference output regenerated!"
echo ""

39
tests/sja5/run-tests Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
# default: execute all tests
TESTS="01_auth.sh 02_algo.sh 03_milenage_par.sh 04_op_opc.sh 05_key.sh 06_seq.sh 07_mnclen.sh 08_tuak.sh"
# if command line specifies some specific tests, execute only those
if [ $# -ge 1 ]; then
TESTS=$*
fi
TMP=`tempfile`
NUM_FAIL=0
# prepare test card
./prepare
for T in $TESTS; do
echo "==> Executing Testcase $T"
EXPOUT=${T%%.sh}.out
rm $TMP
./$T > $TMP
diff -u $EXPOUT $TMP
if [ $? -eq 0 ]; then
echo "Test $T passed"
else
echo "Test $T FAILED!"
NUM_FAIL=$((NUM_FAIL+1))
fi
done
echo
echo
echo "Summary: $NUM_FAIL Tests failed"
if [ $NUM_FAIL -gt 0 ]; then
exit 1
else
exit 0
fi

5
tests/sja5/test-data Normal file
View File

@ -0,0 +1,5 @@
TOOL=../../sysmo-isim-tool.sja5.py
# data for the test scripts. The values have to match the SIM card inserted while executing the test
IMSI=901700000046734
ADMPIN=11111111 # <==== CHANGE THIS TO THE ADM1 KEY OF YOUR TEST CARD!
KI=D7882EAE7CD14F06108C55F8E5CFFE93