diff options
author | James Prestwood <james.prestwood@linux.intel.com> | 2017-10-11 16:22:18 -0700 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2017-10-12 09:51:48 -0500 |
commit | 5556e2ac571db977b6a8d58d65557008c2f70ca6 (patch) | |
tree | eff5ba0c53c97566dc1154a8bf243952bbc4cc93 /test | |
parent | cd92f86ad4682f0bdbae94efe1400bcb4a33b05a (diff) | |
download | ofono-5556e2ac571db977b6a8d58d65557008c2f70ca6.tar.gz |
test: added tests for GSM/UMTS auth algorithms
Diffstat (limited to 'test')
-rwxr-xr-x | test/run-isim-umts-auth | 38 | ||||
-rwxr-xr-x | test/run-usim-gsm-auth | 36 |
2 files changed, 74 insertions, 0 deletions
diff --git a/test/run-isim-umts-auth b/test/run-isim-umts-auth new file mode 100755 index 00000000..a5214259 --- /dev/null +++ b/test/run-isim-umts-auth @@ -0,0 +1,38 @@ +#!/usr/bin/python3 + +import dbus +import sys + +bus = dbus.SystemBus() + +if len(sys.argv) == 4: + path = sys.argv[1] + rand = sys.argv[2] + autn = sys.argv[3] + + sim_auth = dbus.Interface(bus.get_object('org.ofono', path), + 'org.ofono.SimAuthentication') + apps = sim_auth.GetApplications() + for i in apps: + if apps[i]['Type'] == 'Ims': + ims_path = i + + if not ims_path: + print("No Ims application found") + quit() + + isim_auth = dbus.Interface(bus.get_object('org.ofono', ims_path), + 'org.ofono.ISimApplication') + ret = isim_auth.ImsAuthenticate(bytearray.fromhex(rand), + bytearray.fromhex(autn)) + + if 'auts' in ret: + print('Sync Failure') + print('AUTS: ' + ''.join('%02x' % x for x in ret['AUTS'])) + else: + print('Success') + print('RES: ' + ''.join('%02x' % x for x in ret['RES'])) + print('CK: ' + ''.join('%02x' % x for x in ret['CK'])) + print('IK: ' + ''.join('%02x' % x for x in ret['IK'])) +else: + print("./run-isim-umts-auth <modem> <rand> <autn>") diff --git a/test/run-usim-gsm-auth b/test/run-usim-gsm-auth new file mode 100755 index 00000000..b97a5579 --- /dev/null +++ b/test/run-usim-gsm-auth @@ -0,0 +1,36 @@ +#!/usr/bin/python3 + +import dbus +import sys + +bus = dbus.SystemBus() + +if len(sys.argv) < 6 and len(sys.argv) > 2: + path = sys.argv[1] + + rands = [] + for i in sys.argv[2:]: + rands.append(bytearray.fromhex(i)) + + sim_auth = dbus.Interface(bus.get_object('org.ofono', path), + 'org.ofono.SimAuthentication') + apps = sim_auth.GetApplications() + + for i in apps: + if apps[i]['Type'] == 'Umts': + umts_path = i + + if not umts_path: + print("No Umts application found") + quit() + + umts = dbus.Interface(bus.get_object('org.ofono', umts_path), + 'org.ofono.USimApplication') + av = umts.GsmAuthenticate(rands) + + for i in av: + print('SRES: ' + ''.join('%02x' % x for x in i['SRES'])) + print('KC: ' + ''.join('%02x' % x for x in i['Kc'])) + +else: + print("./run-usim-gsm-auth <modem> <rands>...[up to 3]") |