Commit Graph

28 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 aa84b71f0f add osmo_auth_c3() (separate from gsm_milenage())
To send a Ciphering Mode Command, we may need to derive a Kc from UMTS AKA
tokens. gsm_milenage() derives Kc from 3G tokens, but also derives an SRES.
For SRES, it requires an OPC, which may need to be derived from OP first. All
we need is a Kc, so we could feed a zero OPC ...  but to simplify the function
call for cases where just a Kc is required, separate the c3 function out from
gsm_milenage(), as osmo_auth_c3(). Obviously call osmo_auth_c3() from
gsm_milenage() (meaning that osmo-hlr's 55.205 derived auc tests still cover
exactly that implementation).

Prepares: If04e405426c55a81341747a9b450a69188525d5c (osmo-msc)
Related: OS#2745
Change-Id: I85a1d6ae95ad9e5ce9524ef7fc06414848afc2aa
2017-12-18 23:05:24 +00:00
Harald Welte c368b5420a [doc] Provide proper name for 'auth' group
Change-Id: I5fb1c34475ea9db36c2ec5cddc988074a72a35f7
2017-10-17 07:53:02 +02:00
Neels Hofmeyr 1a02e36c4c auth: add OSMO_MILENAGE_IND_BITLEN_MAX
Will be used by OsmoHLR to validate VTY and CTRL input.

Change-Id: Ic39f3404d1a49ffd06070aa9897b36f219eacf4d
2017-10-09 16:30:45 +02:00
Neels Hofmeyr 26e30b1309 auth: add value_strings for osmo_sub_auth_type, comment on osmo_auth_alg_name()
Add osmo_sub_auth_type_names[] and osmo_sub_auth_type_name().

Also add a hint to enum osmo_auth_algo's API doc that osmo_auth_alg_name()
already exists (it is defined further below).

Change-Id: I652a929bcd11c694d86812fb03d0a1cbd985efda
2017-10-09 16:30:45 +02:00
Max 483cdffeb8 Add define for supported a5 key length limit
Change-Id: I8ed0f1dbc31aaff22a685ceb3bd2f8db4d2f34fd
2017-08-30 09:09:39 +00:00
Neels Hofmeyr 2066a42d5a umts aka: add sqn_ms out-param, print SQN.MS in osmo-auc-gen
When doing UMTS AKA with AUTS, it can be interesting to know the SQN.MS that
was encoded in the AUTS. The only way to know this is to provide it as a
separate out-parameter from milenage_gen_vec_auts(), because the SQN.MS from
AUTS stored in umts.sqn is immediately modified non-trivially by
milenage_gen_vec(). Add sqn_ms to struct osmo_sub_auth_data to retain SQN.MS
even after a vector was generated.

Use this to print out SQN.MS for 'osmo-auc-gen -3 -A'.

Adjust test suite expectations.

Related: OS#2464
Change-Id: I9fc05bbf169d06716f40b995154fd42a3f91bef3
2017-08-29 12:46:46 +00:00
Neels Hofmeyr 95500c88b4 cosmetic: umts aka: tweak comments for sqn and ind
Clearly indicate that 'sqn' is an in *and* out-parameter.

Clarify the effect of 'ind'.

Change-Id: Ia40cd4ddf35f4fbe895b45b8ea59378f5ce9eb1f
2017-08-29 12:46:46 +00:00
Neels Hofmeyr 17518fe393 doxygen: unify use of \file across the board
Considering the various styles and implications found in the sources, edit
scores of files to follow the same API doc guidelines around the doxygen
grouping and the \file tag.

Many files now show a short description in the generated API doc that was so
far only available as C comment.

The guidelines and reasoning behind it is documented at
https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation

In some instances, remove file comments and add to the corresponding group
instead, to be shared among several files (e.g. bitvec).

Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
2017-06-23 00:18:23 +00:00
Neels Hofmeyr 87e4550585 doxygen: enable AUTOBRIEF, drop \brief
Especially for short descriptions, it is annoying to have to type \brief for
every single API doc.

Drop all \brief and enable the AUTOBRIEF feature of doxygen, which always takes
the first sentence of an API doc as the brief description.

Change-Id: I11a8a821b065a128108641a2a63fb5a2b1916e87
2017-06-23 00:18:22 +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 03ab9a6500 osmo_auth*: fix ordering of function args
milenage_gen_vec() has parameter ordering of (..., auts, rand_auts, rand).

osmo_auth_gen_vec_auts() has (..., rand_auts, auts, rand), but actually feeds
args in the same order, so that its rand_auts becomes auts, and its auts
becomes rand_auts.

Interestingly enough, API user osmo-gen-vec.c also adheres to this misordering
and in turn passes auts for osmo_auth_gen_vec_auts()'s rand_auts and vice
versa, so that it matches milenage_gen_vec().

So both the implementation (milenage_*) and the API user use the same ordering,
just osmo_auth_gen_vec_auts() and osmo_auth_impl{ .gen_vec_auts() } in-between
have the argument names swapped.

Any current user of this API would need to adhere to this swapping or will not
get successful AUTS resolution to a SQN. So the least impact fix is to rename
the args without any actual functional change.

So swap the names rand_auts and auts for osmo_auth_gen_vec_auts() and
osmo_auth_impl{ .gen_vec_auts() }. (Also adjust API doc ordering)

Change-Id: I0dcbd49759fc32d3b8974102dbd1d6703364ebf4
2017-02-06 14:09:31 +00:00
Max 4f169500df Add GEA3 & GEA4 ciphers
Corresponding test code include both official test vectors from the
specs and data from over-the-air tests.

This obsoletes libosmo-crypt-a53 as it was last missing piece
unimplemented in libosmogsm.

Change-Id: I939e4f6b91b4a7c591ef3761fe2d46ed1c2fb2d3
Related: OS#1582
2016-07-11 19:15:24 +00:00
Max dda9dffca9 Clarify GPRS algorithm
Add spec reference and set explicit values for enum representing
ciphering algorithm for GPRS encryption.

Change-Id: Ia9ee429b73a37d52599fce70778cfe87b767411c
Related: OS#1582
2016-06-29 16:34:14 +00:00
Max c57e5daf22 Clarify GPRS ciphering direction
Add spec reference and set explicit values for enum representing
direction parameter for GPRS encryption.

Change-Id: Iaf1b13da2e889d55cc9dd7516710104dba48c992
Related: OS#1582
2016-06-29 16:33:57 +00:00
Max ceae123752 Make C4 function globally available
This function perform 64 -> 128 bit key expansion which useful for
converting between UMTS CK and GSM Kc, A5/3 and A5/4, GEA3 and GEA4
keys.

Change-Id: I5a6c6deef6027cd6af144c9062d4c9166be26904
Related: OS#1582
2016-06-29 16:32:55 +00:00
Max b897c42993 Add strings for GPRS ciphers
Change-Id: I050bda5fb50aad42fe2d72de39f8256b4fb12fb2
Related: OS#1582
2016-06-29 16:32:27 +00:00
Max bf990bb8fd Update internal GPRS cipher API
Update internal API (for GPRS cipher implementors): make it compliant
with ETSI TS 155.22. External API left untouched.
2016-04-22 15:09:27 +02:00
Sylvain Munaut 12ba778afd include: Switch to #pragma once pattern
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-06-16 10:17:27 +02:00
Harald Welte 007a71e332 authentication: More documentation 2012-07-18 19:47:56 +02:00
Diego Elio Pettenò d471a21920 build: simplify headers management and remove recursion
There is no real reason to keep the include directory a multi-level
recursion, so instead declare everything within include (so that we
can use proper nobase_ declarations) and be it.

Please note that since we removed the sub-Makefile.am, ./configure
will not create the directory structure for us on out-of-tree builds,
so we have to make sure the directory we're generating to exists first.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
2012-06-30 22:01:43 +02:00
Harald Welte a72e47b8a0 auth_milenage/osmo-auc-gen: compute OPC in case only OP is known 2012-03-21 09:04:14 +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 a5ab1620f4 auth_core: add functions for parsing algorithm names 2011-12-07 02:33:11 +01:00
Harald Welte d82e0eb697 Add a generic abstraction for GSM/3G authentication algorithms
Indiidual algorithms can be implemented as plugins.  libosmogsm itself
only provides COMP128v1 via this generic interface.
2011-12-06 21:53:42 +01:00
Pablo Neira Ayuso 8341934844 include: reorganize headers file to include/osmocom/[gsm|core]
This patch moves all GSM-specific definitions to include/osmocom/gsm.
Moreover, the headers in include/osmocore/ have been moved to
include/osmocom/core.

This has been proposed by Harald Welte and Sylvain Munaunt.

Tested with `make distcheck'.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-03-23 18:09:28 +01:00
Harald Welte e335b91ccd GPRS: Add 'input' generator functions for GPRS cipher algorithm 2010-06-30 19:50:14 +02:00
Harald Welte b9ce51c5fd Add support for plugins (and specifically GPRS encryption plugins) 2010-06-30 19:43:11 +02:00