From 5140557f3bf115ddb45886565d7cafdbb2425d7c Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 16 Aug 2017 23:02:09 +0200 Subject: [PATCH] Add testsuite The idea of the testsuite is to test all functions of the utility against one known SIM card that is inserted at the time the test is executed. We could insert this card into a reader attached to a permanently-running machine and then use that as a jenkins build test slave. --- tests/01_auth.out | 16 + tests/01_auth.sh | 4 + tests/02_mode_read.out | 23 ++ tests/02_mode_read.sh | 4 + tests/03_mode_write.out | 92 +++++ tests/03_mode_write.sh | 7 + tests/04_algo.out | 782 ++++++++++++++++++++++++++++++++++++++ tests/04_algo.sh | 9 + tests/05_milenage_par.out | 31 ++ tests/05_milenage_par.sh | 5 + tests/06_op_opc.out | 90 +++++ tests/06_op_opc.sh | 9 + tests/07_ki.out | 88 +++++ tests/07_ki.sh | 11 + tests/08_seq.out | 63 +++ tests/08_seq.sh | 5 + tests/run-tests | 36 ++ tests/test-data | 6 + 18 files changed, 1281 insertions(+) create mode 100644 tests/01_auth.out create mode 100755 tests/01_auth.sh create mode 100644 tests/02_mode_read.out create mode 100755 tests/02_mode_read.sh create mode 100644 tests/03_mode_write.out create mode 100755 tests/03_mode_write.sh create mode 100644 tests/04_algo.out create mode 100755 tests/04_algo.sh create mode 100644 tests/05_milenage_par.out create mode 100755 tests/05_milenage_par.sh create mode 100644 tests/06_op_opc.out create mode 100755 tests/06_op_opc.sh create mode 100644 tests/07_ki.out create mode 100755 tests/07_ki.sh create mode 100644 tests/08_seq.out create mode 100755 tests/08_seq.sh create mode 100755 tests/run-tests create mode 100644 tests/test-data diff --git a/tests/01_auth.out b/tests/01_auth.out new file mode 100644 index 0000000..05875b0 --- /dev/null +++ b/tests/01_auth.out @@ -0,0 +1,16 @@ +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Done! diff --git a/tests/01_auth.sh b/tests/01_auth.sh new file mode 100755 index 0000000..d18b455 --- /dev/null +++ b/tests/01_auth.sh @@ -0,0 +1,4 @@ +#!/bin/sh +. ./test-data + +$TOOL -a $ADMPIN diff --git a/tests/02_mode_read.out b/tests/02_mode_read.out new file mode 100644 index 0000000..af719e2 --- /dev/null +++ b/tests/02_mode_read.out @@ -0,0 +1,23 @@ +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading SIM-Mode... + * Initalizing... + * Reading... + * Current status of Record No. 1 in EF.DIR: + 61194f10a0000000871002ffffffff890709000050055553696d31ffffffffffffffffffffff + ==> USIM application enabled + +Done! diff --git a/tests/02_mode_read.sh b/tests/02_mode_read.sh new file mode 100755 index 0000000..a91821c --- /dev/null +++ b/tests/02_mode_read.sh @@ -0,0 +1,4 @@ +#!/bin/sh +. ./test-data + +$TOOL -a $ADMPIN -m diff --git a/tests/03_mode_write.out b/tests/03_mode_write.out new file mode 100644 index 0000000..34bb1f8 --- /dev/null +++ b/tests/03_mode_write.out @@ -0,0 +1,92 @@ +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming SIM-Mode... + * New status of Record No.1 in EF.DIR: + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + ==> USIM application disabled + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: None + +Reading SIM-Mode... + * Initalizing... + * Reading... + * Current status of Record No. 1 in EF.DIR: + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + ==> USIM application disabled + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: None + +Programming SIM-Mode... + * New status of Record No.1 in EF.DIR: + 61194f10a0000000871002ffffffff890709000050055553696d31ffffffffffffffffffffff + ==> USIM application enabled + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading SIM-Mode... + * Initalizing... + * Reading... + * Current status of Record No. 1 in EF.DIR: + 61194f10a0000000871002ffffffff890709000050055553696d31ffffffffffffffffffffff + ==> USIM application enabled + +Done! diff --git a/tests/03_mode_write.sh b/tests/03_mode_write.sh new file mode 100755 index 0000000..a3de980 --- /dev/null +++ b/tests/03_mode_write.sh @@ -0,0 +1,7 @@ +#!/bin/sh +. ./test-data + +$TOOL -a $ADMPIN -c +$TOOL -a $ADMPIN -m +$TOOL -a $ADMPIN -u +$TOOL -a $ADMPIN -m diff --git a/tests/04_algo.out b/tests/04_algo.out new file mode 100644 index 0000000..abea050 --- /dev/null +++ b/tests/04_algo.out @@ -0,0 +1,782 @@ +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: MILENAGE + 3G: MILENAGE + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: MILENAGE + 3G: MILENAGE + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: COMP128v1 + 3G: MILENAGE + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: COMP128v1 + 3G: MILENAGE + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: XOR-2G + 3G: MILENAGE + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: XOR-2G + 3G: MILENAGE + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: GBA + 3G: MILENAGE + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: GBA + 3G: MILENAGE + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: COMP128v2 + 3G: MILENAGE + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: COMP128v2 + 3G: MILENAGE + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: COMP128v3 + 3G: MILENAGE + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: COMP128v3 + 3G: MILENAGE + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: CIS-B + 3G: MILENAGE + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: CIS-B + 3G: MILENAGE + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: GBA + 3G: XOR-3G + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: GBA + 3G: XOR-3G + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: COMP128v1 + 3G: XOR-3G + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: COMP128v1 + 3G: XOR-3G + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: MILENAGE + 3G: MILENAGE + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: MILENAGE + 3G: MILENAGE + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: COMP128v1 + 3G: MILENAGE + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: COMP128v1 + 3G: MILENAGE + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: XOR-2G + 3G: MILENAGE + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: XOR-2G + 3G: MILENAGE + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: COMP128v2 + 3G: MILENAGE + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: COMP128v2 + 3G: MILENAGE + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: COMP128v3 + 3G: MILENAGE + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: COMP128v3 + 3G: MILENAGE + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: CIS-B + 3G: MILENAGE + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: CIS-B + 3G: MILENAGE + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: GBA + 3G: XOR-3G + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: GBA + 3G: XOR-3G + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Programming Authentication parameters... + * New algorithm setting: + 2G: COMP128v1 + 3G: MILENAGE + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Authentication parameters... + * Initalizing... + * Reading... + * Current algorithm setting: + 2G: COMP128v1 + 3G: MILENAGE + +Done! diff --git a/tests/04_algo.sh b/tests/04_algo.sh new file mode 100755 index 0000000..67aecde --- /dev/null +++ b/tests/04_algo.sh @@ -0,0 +1,9 @@ +#!/bin/sh +. ./test-data + +ALGOS="1:1 3:1 4:1 5:1 6:1 7:1 9:1 5:8 3:8 " +ALGOS+="MILENAGE:MILENAGE COMP128v1:MILENAGE XOR-2G:MILENAGE COMP128v2:MILENAGE COMP128v3:MILENAGE CIS-B:MILENAGE GBA:XOR-3G COMP128v1:MILENAGE" +for algo in $ALGOS; do + $TOOL -a $ADMPIN -T $algo + $TOOL -a $ADMPIN -t +done diff --git a/tests/05_milenage_par.out b/tests/05_milenage_par.out new file mode 100644 index 0000000..dd11956 --- /dev/null +++ b/tests/05_milenage_par.out @@ -0,0 +1,31 @@ +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Milenage parameters... + * Initalizing... + * Reading... + * Current Milenage Parameters in (EF.MLNGC): + C1: 00000000000000000000000000000000 + C2: 00000000000000000000000000000001 + C3: 00000000000000000000000000000002 + C4: 00000000000000000000000000000004 + C5: 00000000000000000000000000000008 + R1: 0x40 + R2: 0x0 + R3: 0x20 + R4: 0x40 + R5: 0x60 + +Done! diff --git a/tests/05_milenage_par.sh b/tests/05_milenage_par.sh new file mode 100755 index 0000000..ed60f9e --- /dev/null +++ b/tests/05_milenage_par.sh @@ -0,0 +1,5 @@ +#!/bin/sh +. ./test-data + +# we only test reading here +$TOOL -a $ADMPIN -l diff --git a/tests/06_op_opc.out b/tests/06_op_opc.out new file mode 100644 index 0000000..7b8db32 --- /dev/null +++ b/tests/06_op_opc.out @@ -0,0 +1,90 @@ +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Writing OPC value... + * New OPc setting: + OPc: 000102030405060708090a0b0c0d0e0f + OP/OPc: 000102030405060708090a0b0c0d0e0f + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading OP/C value... + * Initalizing... + * Reading... + * Current OP/OPc setting: + OPc: 000102030405060708090a0b0c0d0e0f + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Writing OP value... + * New OPc setting: + OP: 840337c3d45397ce8ea8609ffdc47224 + OP/OPc: 840337c3d45397ce8ea8609ffdc47224 + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading OP/C value... + * Initalizing... + * Reading... + * Current OP/OPc setting: + OP: 840337c3d45397ce8ea8609ffdc47224 + +Done! diff --git a/tests/06_op_opc.sh b/tests/06_op_opc.sh new file mode 100755 index 0000000..b3e9e41 --- /dev/null +++ b/tests/06_op_opc.sh @@ -0,0 +1,9 @@ +#!/bin/sh +. ./test-data + +$TOOL -a $ADMPIN -C 000102030405060708090a0b0c0d0e0f +$TOOL -a $ADMPIN -o + +$TOOL -a $ADMPIN -O 840337c3d45397ce8ea8609ffdc47224 +$TOOL -a $ADMPIN -o + diff --git a/tests/07_ki.out b/tests/07_ki.out new file mode 100644 index 0000000..d84bbc7 --- /dev/null +++ b/tests/07_ki.out @@ -0,0 +1,88 @@ +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Writing KI value... + * New KI setting: + KI: a0b1c2d3e4f5061728394a5b6c7d8e9f + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading KI value... + * Initalizing... + * Reading... + * Current KI setting: + KI: a0b1c2d3e4f5061728394a5b6c7d8e9f + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Writing KI value... + * New KI setting: + KI: 94c7f52c8c7337fad1af3a73b17b56ac + * Initalizing... + * Programming... + +Done! +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading KI value... + * Initalizing... + * Reading... + * Current KI setting: + KI: 94c7f52c8c7337fad1af3a73b17b56ac + +Done! diff --git a/tests/07_ki.sh b/tests/07_ki.sh new file mode 100755 index 0000000..93ee6a6 --- /dev/null +++ b/tests/07_ki.sh @@ -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 + diff --git a/tests/08_seq.out b/tests/08_seq.out new file mode 100644 index 0000000..9d3d78b --- /dev/null +++ b/tests/08_seq.out @@ -0,0 +1,63 @@ +sysmoUSIM-SJS1 parameterization tool +Copyright (c)2017 Sysmocom s.f.m.c. GmbH + +Initializing smartcard terminal... + +Detected Card ICCID: 8988211320300000028 + +Authenticating... + * Remaining attempts: 3 + * Authenticating... + * Authentication successful + * Remaining attempts: 3 + +Detected Card IMSI: 262423203000002 + +Reading Milenage Sequence parameters... + * Initalizing... +* Current SQN Configuration: + IND (bits): 5 + SQN Check enabled: 0 + SQN Age Limit enabled: 1 + SQN Max Delta enabled: 0 + SQNms Offset: 0 + Max Delta: 268435456 + Age Limit: 268435456 + +* Current SQN Array: + SEQ[000]: 0 + SEQ[001]: 0 + SEQ[002]: 0 + SEQ[003]: 0 + SEQ[004]: 0 + SEQ[005]: 0 + SEQ[006]: 0 + SEQ[007]: 0 + SEQ[008]: 0 + SEQ[009]: 0 + SEQ[010]: 0 + SEQ[011]: 0 + SEQ[012]: 0 + SEQ[013]: 0 + SEQ[014]: 0 + SEQ[015]: 0 + SEQ[016]: 0 + SEQ[017]: 0 + SEQ[018]: 0 + SEQ[019]: 0 + SEQ[020]: 0 + SEQ[021]: 0 + SEQ[022]: 0 + SEQ[023]: 0 + SEQ[024]: 0 + SEQ[025]: 0 + SEQ[026]: 0 + SEQ[027]: 0 + SEQ[028]: 0 + SEQ[029]: 0 + SEQ[030]: 0 + SEQ[031]: 0 + +* Authentication Counter: DISABLED + +Done! diff --git a/tests/08_seq.sh b/tests/08_seq.sh new file mode 100755 index 0000000..a855485 --- /dev/null +++ b/tests/08_seq.sh @@ -0,0 +1,5 @@ +#!/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 diff --git a/tests/run-tests b/tests/run-tests new file mode 100755 index 0000000..7c40b29 --- /dev/null +++ b/tests/run-tests @@ -0,0 +1,36 @@ +#!/bin/sh + +# default: execute all tests +TESTS="01_auth.sh 02_mode_read.sh 03_mode_write.sh 04_algo.sh 05_milenage_par.sh 06_op_opc.sh 07_ki.sh 08_seq.sh" + +# if command line specifies some specific tests, execute only those +if [ $# -ge 1 ]; then + TESTS=$* +fi + +TMP=`tempfile` +NUM_FAIL=0 + +for T in $TESTS; do + echo "==> Executing Testcase $T" + EXPOUT=${T%%.sh}.out + rm $TMP + ./$T > $TMP + diff -u $EXPOUT $TMP + if [ $? == 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 diff --git a/tests/test-data b/tests/test-data new file mode 100644 index 0000000..87a4618 --- /dev/null +++ b/tests/test-data @@ -0,0 +1,6 @@ +TOOL=../sysmo-usim-tool.sjs1.py +# data for the test scripts. The values have to match the SIM card inserted while executing the test +ICCID=8988211320300000028 +IMSI=262423203000002 +ADMPIN=53304155 +KI=94c7f52c8c7337fad1af3a73b17b56ac