summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-08-26 22:29:51 +0200
committerHarald Welte <laforge@gnumonks.org>2017-08-29 12:46:46 +0000
commite6e6446edf24c19c94d0774f81dc78ea0bc52f79 (patch)
tree3bd40d8e334446423f0857ffea28fbcf19da4711
parentb1af6ef1646c54f429f7b87778d92d139c0e3336 (diff)
osmo-auc-gen: umts: print out the IND of the SQN used
Make ind_mask available in the main(){} scope, in order to print out IND = SQN & ind_mask. Adjust test suite expectations. Related: OS#2465 Change-Id: I91eac53c4af66a58b9372d9baf5781fc9f29b1fc
-rw-r--r--tests/osmo-auc-gen/osmo-auc-gen_test.ok15
-rw-r--r--utils/osmo-auc-gen.c10
2 files changed, 22 insertions, 3 deletions
diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.ok b/tests/osmo-auc-gen/osmo-auc-gen_test.ok
index f833760d..82923f10 100644
--- a/tests/osmo-auc-gen/osmo-auc-gen_test.ok
+++ b/tests/osmo-auc-gen/osmo-auc-gen_test.ok
@@ -12,6 +12,7 @@ RES: f511d3a7f06e6a30
SRES: 057fb997
Kc: 60524000cc5e5407
SQN: 0
+IND: 0
> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 1
@@ -26,6 +27,7 @@ RES: f511d3a7f06e6a30
SRES: 057fb997
Kc: 60524000cc5e5407
SQN: 1
+IND: 1
> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 1dc4f974325cce611e54f516dc1fec56 -o 2a48162ff3edca4adf0b7b5e527d6c16 -s 23
@@ -40,6 +42,7 @@ RES: f511d3a7f06e6a30
SRES: 057fb997
Kc: 60524000cc5e5407
SQN: 23
+IND: 23
> osmo-auc-gen -3 -a milenage -r 1dc4f974325cce611e54f516dc1fec56 -k 2a48162ff3edca4adf0b7b5e527d6c16 -o 6a61050765caa32c90371370e5d6dc2d -s 42
@@ -54,6 +57,7 @@ RES: 912cdfaadd7b0154
SRES: 4c57defe
Kc: 169d78081b24c007
SQN: 42
+IND: 10
> osmo-auc-gen -3 -a milenage -r 2a48162ff3edca4adf0b7b5e527d6c16 -k 6a61050765caa32c90371370e5d6dc2d -o 1dc4f974325cce611e54f516dc1fec56 -s 99
@@ -68,6 +72,7 @@ RES: fd40205be2c9c7b2
SRES: 1f89e7e9
Kc: d2d5361395b9b74a
SQN: 99
+IND: 3
> osmo-auc-gen -3 -a milenage -r 6a61050765caa32c90371370e5d6dc2d -k 2a48162ff3edca4adf0b7b5e527d6c16 -o 1dc4f974325cce611e54f516dc1fec56 -s 281474976710655
@@ -82,6 +87,7 @@ RES: 7c04e86a67967fcd
SRES: 1b9297a7
Kc: 10687b71e4eb94c5
SQN: 281474976710655
+IND: 31
> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c
@@ -96,6 +102,7 @@ RES: e229c19e791f2e41
SRES: 9b36efdf
Kc: 059a4f668f6fbe39
SQN: 32
+IND: 0
> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind 5
@@ -110,6 +117,7 @@ RES: e229c19e791f2e41
SRES: 9b36efdf
Kc: 059a4f668f6fbe39
SQN: 37
+IND: 5
> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind 23
@@ -124,6 +132,7 @@ RES: e229c19e791f2e41
SRES: 9b36efdf
Kc: 059a4f668f6fbe39
SQN: 55
+IND: 23
> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind 31
@@ -138,6 +147,7 @@ RES: e229c19e791f2e41
SRES: 9b36efdf
Kc: 059a4f668f6fbe39
SQN: 63
+IND: 31
> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind-len 0
@@ -152,6 +162,7 @@ RES: e229c19e791f2e41
SRES: 9b36efdf
Kc: 059a4f668f6fbe39
SQN: 24
+IND: 0
> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind-len 1
@@ -166,6 +177,7 @@ RES: e229c19e791f2e41
SRES: 9b36efdf
Kc: 059a4f668f6fbe39
SQN: 24
+IND: 0
> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind-len 1 --ind 1
@@ -180,6 +192,7 @@ RES: e229c19e791f2e41
SRES: 9b36efdf
Kc: 059a4f668f6fbe39
SQN: 25
+IND: 1
> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind-len 8
@@ -194,6 +207,7 @@ RES: e229c19e791f2e41
SRES: 9b36efdf
Kc: 059a4f668f6fbe39
SQN: 256
+IND: 0
> osmo-auc-gen -3 -a milenage -r 39fa2f4e3d523d8619a73b4f65c3e14d -k EB215756028D60E3275E613320AEC880 -o FB2A3D1B360F599ABAB99DB8669F8308 -A 979498b1f72d3e28c59fa2e72f9c --ind-len 8 --ind 1
@@ -208,6 +222,7 @@ RES: e229c19e791f2e41
SRES: 9b36efdf
Kc: 059a4f668f6fbe39
SQN: 257
+IND: 1
expecting error:
diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c
index 6e38b520..d4ae1b9e 100644
--- a/utils/osmo-auc-gen.c
+++ b/utils/osmo-auc-gen.c
@@ -105,6 +105,8 @@ int main(int argc, char **argv)
int sqn_is_set = 0;
int ind_is_set = 0;
int fmt_triplets_dat = 0;
+ uint64_t seq_1;
+ uint64_t ind_mask;
printf("osmo-auc-gen (C) 2011-2012 by Harald Welte\n");
printf("This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY\n\n");
@@ -268,8 +270,8 @@ int main(int argc, char **argv)
memset(vec, 0, sizeof(*vec));
if (test_aud.type == OSMO_AUTH_TYPE_UMTS) {
- uint64_t seq_1 = 1LL << test_aud.u.umts.ind_bitlen;
- uint64_t ind_mask = seq_1 - 1;
+ seq_1 = 1LL << test_aud.u.umts.ind_bitlen;
+ ind_mask = seq_1 - 1;
if (sqn_is_set) {
/* Before calculating the UMTS auth vector, osmo_auth_gen_vec() increments SEQ.
@@ -312,8 +314,10 @@ int main(int argc, char **argv)
dump_triplets_dat(vec);
else {
dump_auth_vec(vec);
- if (test_aud.type == OSMO_AUTH_TYPE_UMTS)
+ if (test_aud.type == OSMO_AUTH_TYPE_UMTS) {
printf("SQN:\t%" PRIu64 "\n", test_aud.u.umts.sqn);
+ printf("IND:\t%u\n", (unsigned int)(test_aud.u.umts.sqn & ind_mask));
+ }
}
exit(0);