diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-03-13 17:36:17 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-03-15 12:46:08 +0000 |
commit | 82c9a0ec198d83452a4232f288e230b59fa1eaf8 (patch) | |
tree | 61e29d723a5fb13e8cdba6879ea6cf1ef1233510 /utils | |
parent | 5fe3d1b0f7d40bd80733b23575e40b9544652fc4 (diff) |
osmo_auth_gen_vec: UMTS auth: store last used SQN, not next
Prepare for the implementation of splitting SQN increments in SEQ and an IND
part; particularly to clearly show where the changes in auth/milenage_test's
expectations originate.
Rationale: the source of UMTS auth vectors, for us usually OsmoHLR, typically
stores the last used SQN, not the next one to be used. Particularly with the
upcoming fix of the SQN scheme, this change is important: the next SQN will
depend on which entity asks for it, because each auth consumer may have a
particular slot in the IND part of SQN. It does not make sense to store the
next SQN, because we will not know which consumer that will be for.
The milenage_test has always calculated a tuple for SQN == 34. To account for
the increment now happening before calculating a tuple, lower the test_aud->sqn
by one to 0x21 == 33, so that it is still calculating for SQN == 34.
Because we are no longer incrementing SQN after the tuple is generated,
milenage_test's expected output after doing an AUTS resync to 31 changes to the
next SQN = 32, the SQN used for the generated tuple.
(BTW, a subsequent patch will illustrate AUTS in detail.)
osmo-auc-gen now needs to pass the user requested SQN less one, because the SQN
will be incremented befor generating the auth vector. Also the SQN remains the
same after generating, so SQN output needs less decrementing. Note that the
expected output for osmo-auc-gen_test remains unchanged, hence the same input
arguments (particularly -s <sqn> and -A <auts>) still produce the same results.
Note: osmo-hlr regression tests will require adjustments when this patch is
merged, because it must now pass desired_sqn - 1 instead of just desired_sqn.
See osmo-hlr change-id I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 .
Related: OS#1968
Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3
Diffstat (limited to 'utils')
-rw-r--r-- | utils/osmo-auc-gen.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c index 6fa7cec7..4e2456a7 100644 --- a/utils/osmo-auc-gen.c +++ b/utils/osmo-auc-gen.c @@ -198,6 +198,10 @@ int main(int argc, char **argv) } ul = strtoul(optarg, 0, 10); test_aud.u.umts.sqn = ul; + /* Before calculating the UMTS auth vector, + * osmo_auth_gen_vec() increments the SQN. SQN-1 here + * to end up with the SQN the user requested. */ + test_aud.u.umts.sqn--; break; case 'r': rc = osmo_hexparse(optarg, _rand, sizeof(_rand)); @@ -260,16 +264,14 @@ int main(int argc, char **argv) else { dump_auth_vec(vec); if (test_aud.type == OSMO_AUTH_TYPE_UMTS) - /* After generating, SQN is incremented, so -1 */ - printf("SQN:\t%" PRIu64 "\n", test_aud.u.umts.sqn - 1); + printf("SQN:\t%" PRIu64 "\n", test_aud.u.umts.sqn); } /* After recovering SQN.MS from AUTS, milenage_gen_vec_auts() does - * aud->u.umts.sqn++, and after vector generation milenage_gen_vec() - * does another ++, so to show SQN.MS we need to -2 */ + * aud->u.umts.sqn++, so to show SQN.MS we need to -1 */ if (auts_is_set) printf("AUTS success: SQN.MS = %" PRIu64 "\n", - test_aud.u.umts.sqn - 2); + test_aud.u.umts.sqn - 1); exit(0); } |