Harald Welte has submitted this change and it was merged.

Change subject: osmo-auc-gen: umts: print out the IND of the SQN used
......................................................................


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
---
M tests/osmo-auc-gen/osmo-auc-gen_test.ok
M utils/osmo-auc-gen.c
2 files changed, 22 insertions(+), 3 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.ok 
b/tests/osmo-auc-gen/osmo-auc-gen_test.ok
index f833760..82923f1 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 6e38b52..d4ae1b9 100644
--- a/utils/osmo-auc-gen.c
+++ b/utils/osmo-auc-gen.c
@@ -105,6 +105,8 @@
        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 @@
        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 @@
                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);

-- 
To view, visit https://gerrit.osmocom.org/3702
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I91eac53c4af66a58b9372d9baf5781fc9f29b1fc
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder

Reply via email to