diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-03-13 17:27:17 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-03-15 12:46:08 +0000 |
commit | bb6f7b7becb138da78c0f677d6340065f91d0067 (patch) | |
tree | 4b225228eaa90bbd9400e4d24dd045be4887f86e /tests | |
parent | 82c9a0ec198d83452a4232f288e230b59fa1eaf8 (diff) |
osmo_auth_gen_vec: UMTS auth: fix SQN as SEQ || IND
So far we incremented SQN by 1, which doesn't match the procedures described in
3GPP TS 33.102. An IND (index) denotes a non-significant part of SQN, and the
significant SEQ part needs to be incremented.
In OsmoHLR we furthermore want to use the "exception" suggested in annex C.3.4,
so that each HLR's client has a fixed IND index. In other words, we will not
assign IND cyclically, but keep IND unchanged per auth vector consumer.
Add 'ind_bitlen' and 'ind' to the osmo_sub_auth_data.u.umts structure and
increment SQN accordingly.
Add a comment explaining the details.
Because 'ind_bitlen' is still passed as zero, the milenage_test does not change
its behavior, which is a feature I want to clearly show in this patch. The test
will be expanded for the newly implemented SQN scheme in a subsequent patch.
Adjust osmo-auc-gen.c to still show the right SQN and SQN.MS -- because it is
passing ind_bitlen == 0, osmo-auc-gen can rely on single increments and know
SQN.MS is sqn - 1. Note that osmo-auc-gen_test output remains unchanged.
Related: OS#1968
Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auth/milenage_test.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 405da658..7aada36b 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -37,6 +37,8 @@ static struct osmo_sub_auth_data test_aud = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, .amf = { 0x00, 0x00 }, .sqn = 0x21, + .ind_bitlen = 0, + .ind = 0, }, }; @@ -79,6 +81,9 @@ int main(int argc, char **argv) #endif memset(vec, 0, sizeof(*vec)); + /* ind_bitlen == 0 uses the legacy mode of incrementing SQN by 1. + * sqn == 0x21 == 33, so the SQN used to generate the vector is + * sqn + 1 == 34. */ rc = osmo_auth_gen_vec(vec, &test_aud, _rand); if (rc < 0) { fprintf(stderr, "error generating auth vector\n"); @@ -90,6 +95,7 @@ int main(int argc, char **argv) const uint8_t auts[14] = { 0x87, 0x11, 0xa0, 0xec, 0x9e, 0x16, 0x37, 0xdf, 0x17, 0xf8, 0x0b, 0x38, 0x4e, 0xe4 }; + /* Invoking with ind_bitlen == 0, the next SQN after 31 is 32. */ rc = osmo_auth_gen_vec_auts(vec, &test_aud, auts, _rand, _rand); if (rc < 0) { printf("AUTS failed\n"); |