Commit Graph

13 Commits

Author SHA1 Message Date
Max af25c37f90 Use define for key buffers
Add corresponding spec. references and comments where appropriate.

Change-Id: If5e2aad86eaecd8eada667b3488ba415d81c6312
2018-12-20 09:51:02 +00:00
Neels Hofmeyr 6761c3f626 milenage_test: cosmetic: verify AUTS in comments
In a comment and by code #if'd away, illustrate that the AUTS used in the unit
test is accurate.

Related: OS#1968
Change-Id: Iefeaaf33570f8e40245fdf9b810390ec61cfc7e0
2017-03-15 13:46:58 +00:00
Neels Hofmeyr 45e778d397 milenage_test: enhance to verify new SQN increments
After the legacy mode incrementing with ind_bitlen == 0 is through, do another
AUTS run with sensible ind_bitlen and ind, and then two more normal vector
generations to verify proper SQN increments.

Related: OS#1968
Change-Id: Id6947899ff7b1c82b939f969e163e51ce282bce2
2017-03-15 12:46:08 +00:00
Neels Hofmeyr bb6f7b7bec 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
2017-03-15 12:46:08 +00:00
Neels Hofmeyr 82c9a0ec19 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
2017-03-15 12:46:08 +00:00
Neels Hofmeyr 8e1b598c8a milenage_test: cosmetic fix: shown value is not SEQ.MS
In the milenage_test, the console output printed "SEQ.MS = 33", but 33 is
a) the SQN, not SEQ;
b) the SQN *after* the next auth generation, i.e. SQN.MS would have been 31.

While at it also use the proper PRIu64 from inttypes.h to output the sqn value.

This prepares for upcoming sparation of SQN incrementing by SEQ and IND,
particularly to clearly show where the changes in auth/milenage_test's
expectations originate.

Related: OS#1968
Change-Id: Ie83201f1362f3d793ada774f3fc5f89cc0b3fbb7
2017-03-15 12:46:08 +00:00
Max eb59f241ec tests: test actual support status for auth. algo
Check if library actually support Milenage, COMP128 v2 and v3 algorithms
instead of just printing enum values or nothing.

Change-Id: I2b98481f56a8381058d4b29db5e8a36eb193eee9
2016-06-29 16:33:40 +00:00
Jacob Erlbeck 73ae7a9ca0 tests: Fix warnings
This fixes warnings that are raised by missing includes, missing casts,
missing return statements, using printf %lu with uint64_t, and unused
symbols.
2013-10-08 14:00:24 +02:00
Harald Welte 042afe7fe7 milenage: Add function to compute OPC from OP and K 2012-03-21 08:19:47 +01:00
Harald Welte aae2362455 auth_core: don't use anonymous unions to make certain gcc versions happy 2011-12-07 11:35:02 +01:00
Harald Welte 57143a4361 milenage_test: make sure test output is what .ok file expects 2011-12-07 03:12:44 +01:00
Harald Welte 9df00bb857 milenage_test: make sure test result matches expectations 2011-12-07 02:56:11 +01:00
Harald Welte e076ac087c add autotest script for milenage/auth testing 2011-12-07 00:10:18 +01:00