summaryrefslogtreecommitdiffstats
path: root/tests/osmo-auc-gen
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-08-26 21:45:33 +0200
committerHarald Welte <laforge@gnumonks.org>2017-08-29 12:46:45 +0000
commit3cb08277f1d46c6c74c4bb6e254a57ffb9ac3834 (patch)
treec275c022fec7456430c7b62f3218334ca3bc04e1 /tests/osmo-auc-gen
parent4315e01f5a8658399fedfb68d0647624666a86e0 (diff)
osmo-auc-gen: umts: add --ind arg
During UMTS AKA, the caller typically indicates which IND slot the next used SQN should belong to. Without this option, osmo-auc-gen will always produce SQN from IND-slot 0. Add --ind option. Enhance the osmo-auc-gen_test.sh to expect errors with useful printouts on stderr, and add tests that verify valid --ind ranges. Related: OS#2465 Change-Id: Ib60eec80d58ca9a0a01e7fbd2bcbbd4339b1a6d8
Diffstat (limited to 'tests/osmo-auc-gen')
-rw-r--r--tests/osmo-auc-gen/osmo-auc-gen_test.err9
-rw-r--r--tests/osmo-auc-gen/osmo-auc-gen_test.ok63
-rwxr-xr-xtests/osmo-auc-gen/osmo-auc-gen_test.sh20
3 files changed, 91 insertions, 1 deletions
diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.err b/tests/osmo-auc-gen/osmo-auc-gen_test.err
index e69de29b..46ecf2ef 100644
--- a/tests/osmo-auc-gen/osmo-auc-gen_test.err
+++ b/tests/osmo-auc-gen/osmo-auc-gen_test.err
@@ -0,0 +1,9 @@
+expecting error:
+> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind -1
+Requested --ind 4294967295 is too large for IND bitlen of 5
+expecting error:
+> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind 32
+Requested --ind 32 is too large for IND bitlen of 5
+expecting error:
+> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind 42
+Requested --ind 42 is too large for IND bitlen of 5
diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.ok b/tests/osmo-auc-gen/osmo-auc-gen_test.ok
index a1d06f0c..278c88f4 100644
--- a/tests/osmo-auc-gen/osmo-auc-gen_test.ok
+++ b/tests/osmo-auc-gen/osmo-auc-gen_test.ok
@@ -96,3 +96,66 @@ RES: e229c19e791f2e41
SRES: 9b36efdf
Kc: 059a4f668f6fbe39
SQN: 32
+
+
+> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind 5
+osmo-auc-gen (C) 2011-2012 by Harald Welte
+This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY
+
+RAND: 39fa2f4e3d523d8619a73b4f65c3e14d
+AUTN: 8704f5ba55d6000079267a4b347ad890
+IK: 27497388b6cb044648f396aa155b95ef
+CK: f64735036e5871319c679f4742a75ea1
+RES: e229c19e791f2e41
+SRES: 9b36efdf
+Kc: 059a4f668f6fbe39
+SQN: 37
+
+
+> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind 23
+osmo-auc-gen (C) 2011-2012 by Harald Welte
+This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY
+
+RAND: 39fa2f4e3d523d8619a73b4f65c3e14d
+AUTN: 8704f5ba55c40000129ddaa4f5016e25
+IK: 27497388b6cb044648f396aa155b95ef
+CK: f64735036e5871319c679f4742a75ea1
+RES: e229c19e791f2e41
+SRES: 9b36efdf
+Kc: 059a4f668f6fbe39
+SQN: 55
+
+
+> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind 31
+osmo-auc-gen (C) 2011-2012 by Harald Welte
+This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY
+
+RAND: 39fa2f4e3d523d8619a73b4f65c3e14d
+AUTN: 8704f5ba55cc00009d169f5ff89f6087
+IK: 27497388b6cb044648f396aa155b95ef
+CK: f64735036e5871319c679f4742a75ea1
+RES: e229c19e791f2e41
+SRES: 9b36efdf
+Kc: 059a4f668f6fbe39
+SQN: 63
+
+
+expecting error:
+> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind -1
+osmo-auc-gen (C) 2011-2012 by Harald Welte
+This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY
+
+
+
+expecting error:
+> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind 32
+osmo-auc-gen (C) 2011-2012 by Harald Welte
+This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY
+
+
+
+expecting error:
+> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind 42
+osmo-auc-gen (C) 2011-2012 by Harald Welte
+This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY
+
diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.sh b/tests/osmo-auc-gen/osmo-auc-gen_test.sh
index 132d9c39..f7fc87da 100755
--- a/tests/osmo-auc-gen/osmo-auc-gen_test.sh
+++ b/tests/osmo-auc-gen/osmo-auc-gen_test.sh
@@ -18,6 +18,16 @@ invoke() {
$osmo_auc_gen $@
}
+invoke_err() {
+ echo
+ echo
+ echo expecting error:
+ echo '>' osmo-auc-gen $@
+ echo expecting error: >&2
+ echo '>' osmo-auc-gen $@ >&2
+ $osmo_auc_gen $@ && exit 1 || true
+}
+
bytes1="6a61050765caa32c90371370e5d6dc2d"
bytes2="1dc4f974325cce611e54f516dc1fec56"
bytes3="2a48162ff3edca4adf0b7b5e527d6c16"
@@ -32,5 +42,13 @@ invoke -3 -a milenage -r $bytes1 -k $bytes3 -o $bytes2 -s 281474976710655
k="EB215756028D60E3275E613320AEC880"
opc="FB2A3D1B360F599ABAB99DB8669F8308"
rand="39fa2f4e3d523d8619a73b4f65c3e14d"
-auts="979498b1f72d3e28c59fa2e72f9c"
+auts="979498b1f72d3e28c59fa2e72f9c" # --> SQN.MS = 23
invoke -3 -a milenage -r $rand -k $k -o $opc -A $auts
+invoke -3 -a milenage -r $rand -k $k -o $opc -A $auts --ind 5
+invoke -3 -a milenage -r $rand -k $k -o $opc -A $auts --ind 23
+invoke -3 -a milenage -r $rand -k $k -o $opc -A $auts --ind 31
+
+# expect error: IND is too large for IND-bitlen of 5 (max 31)
+invoke_err -3 -a milenage -r $rand -k $k -o $opc -A $auts --ind -1
+invoke_err -3 -a milenage -r $rand -k $k -o $opc -A $auts --ind 32
+invoke_err -3 -a milenage -r $rand -k $k -o $opc -A $auts --ind 42