From 82c9a0ec198d83452a4232f288e230b59fa1eaf8 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 13 Mar 2017 17:36:17 +0100 Subject: 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 and -A ) 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 --- tests/auth/milenage_test.c | 2 +- tests/auth/milenage_test.ok | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 187b9adb..405da658 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -36,7 +36,7 @@ static struct osmo_sub_auth_data test_aud = { .k = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, .amf = { 0x00, 0x00 }, - .sqn = 0x22, + .sqn = 0x21, }, }; diff --git a/tests/auth/milenage_test.ok b/tests/auth/milenage_test.ok index 20c47c61..b0eb44bb 100644 --- a/tests/auth/milenage_test.ok +++ b/tests/auth/milenage_test.ok @@ -5,7 +5,7 @@ CK: 72 00 a1 84 d8 f2 c7 58 fb df 87 90 0d db f2 75 RES: e9 fc 88 cc c8 a3 53 81 SRES: 21 5f db 4d Kc: 6d e8 16 a7 59 a4 29 12 -AUTS success: tuple generated with SQN = 33 +AUTS success: tuple generated with SQN = 32 MILENAGE supported: 1 OP: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 OPC: c6 a1 3b 37 87 8f 5b 82 6f 4f 81 62 a1 c8 d8 79 -- cgit v1.2.3