libosmogsm 1.13.1.1-afb4 Osmocom GSM library

Files | Data Structures | Macros | Enumerations | Enumerator | Functions | Variables
GSM/GPRS/3G Authentication

GSM/GPRS/3G authentication core infrastructure. More...

## Files
file | auth.h
file | auth_core.c
file | comp128.c
| COMP128 v1; common/old GSM Authentication Algorithm (A3/A8).
file | comp128v23.c
| COMP128 version 2 and 3 implementation, common algorithm used for GSM Authentication (A3/A8).

## Data Structures
struct | osmo_sub_auth_data2
| permanent (secret) subscriber auth data More...
struct | osmo_sub_auth_data
struct | osmo_auth_vector
struct | osmo_auth_impl

## Macros
#define | OSMO_A5_MAX_KEY_LEN_BYTES (128/8)
#define | OSMO_MILENAGE_IND_BITLEN_MAX 28
#define | OSMO_AUTH_ALG_XOR OSMO_AUTH_ALG_XOR_3G

## Enumerations
enum | osmo_sub_auth_type { OSMO_AUTH_TYPE_NONE = 0x00 , OSMO_AUTH_TYPE_GSM = 0x01 , OSMO_AUTH_TYPE_UMTS = 0x02 }
| Authentication Type (GSM/UMTS) More...
enum | osmo_auth_algo { OSMO_AUTH_ALG_NONE , OSMO_AUTH_ALG_COMP128v1 , OSMO_AUTH_ALG_COMP128v2 , OSMO_AUTH_ALG_COMP128v3 , OSMO_AUTH_ALG_XOR_3G , OSMO_AUTH_ALG_MILENAGE , OSMO_AUTH_ALG_XOR_2G , OSMO_AUTH_ALG_TUAK , _OSMO_AUTH_ALG_NUM }
| Authentication Algorithm. More...

## Functions
static const char * | osmo_sub_auth_type_name (enum osmo_sub_auth_type val)
int | osmo_auth_gen_vec (struct osmo_auth_vector *vec, struct osmo_sub_auth_data *aud, const uint8_t *_rand)
| Generate authentication vector. More...
int | osmo_auth_gen_vec2 (struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
| Generate authentication vector. More...
int | osmo_auth_gen_vec_auts (struct osmo_auth_vector *vec, struct osmo_sub_auth_data *aud, const uint8_t *auts, const uint8_t *rand_auts, const uint8_t *_rand)
| Generate authentication vector and re-sync sequence. More...
int | osmo_auth_gen_vec_auts2 (struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *auts, const uint8_t *rand_auts, const uint8_t *_rand)
| Generate authentication vector and re-sync sequence. More...
int | osmo_auth_register (struct osmo_auth_impl *impl)
| Register an authentication algorithm implementation with the core. More...
int | osmo_auth_load (const char *path)
| Load all available authentication plugins from the given path. More...
int | osmo_auth_supported (enum osmo_auth_algo algo)
| Determine if a given authentication algorithm is supported. More...
void | osmo_c4 (uint8_t *ck, const uint8_t *kc)
const char * | osmo_auth_alg_name (enum osmo_auth_algo alg)
| Get human-readable name of authentication algorithm. More...
enum osmo_auth_algo | osmo_auth_alg_parse (const char *name)
| Parse human-readable name of authentication algorithm. More...
void | osmo_auth_c3 (uint8_t kc[], const uint8_t ck[], const uint8_t ik[])
void | osmo_auth_c2 (uint8_t sres[4], const uint8_t *res, size_t res_len, uint8_t sres_deriv_func)
| Derive GSM SRES from UMTS [X]RES (auth function c2 from 3GPP TS 33.103 Section 6.8.1.2. More...
static int | c128v1_gen_vec (struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
static | __attribute__ ((constructor))
static int | c128v2_gen_vec (struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
static int | c128v3_gen_vec (struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
static | LLIST_HEAD (osmo_auths)
static int | auth_data2auth_data2 (struct osmo_sub_auth_data2 *out, const struct osmo_sub_auth_data *in)
static void | c5_function (uint8_t *ik, const uint8_t *kc)
int | osmo_auth_3g_from_2g (struct osmo_auth_vector *vec)
| Generate 3G CK + IK from 2G authentication vector. More...
static const uint8_t * | gen_opc_if_needed (const struct osmo_sub_auth_data2 *aud, uint8_t *gen_opc)
static int | milenage_gen_vec (struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
static int | milenage_gen_vec_auts (struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *auts, const uint8_t *rand_auts, const uint8_t *_rand)
static int | tuak_gen_vec (struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
static int | tuak_gen_vec_auts (struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *auts, const uint8_t *rand_auts, const uint8_t *_rand)
static void | xor (uint8_t *out, const uint8_t *a, const uint8_t *b, size_t len)
static int | xor_gen_vec (struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
static int | xor_gen_vec_auts (struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *auts, const uint8_t *rand_auts, const uint8_t *_rand)
static int | xor2g_gen_vec (struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
static void | _comp128_compression_round (uint8_t *x, int n, const uint8_t *tbl)
static void | _comp128_compression (uint8_t *x)
static void | _comp128_bitsfrombytes (uint8_t *x, uint8_t *bits)
static void | _comp128_permutation (uint8_t *x, uint8_t *bits)
void | comp128v1 (const uint8_t *ki, const uint8_t *rand, uint8_t *sres, uint8_t *kc)
| Perform COMP128v1 algorithm. More...
void | comp128 (const uint8_t *ki, const uint8_t *rand, uint8_t *sres, uint8_t *kc)
| Perform COMP128v1 algorithm. More...
static void | _comp128v23_internal (uint8_t *output, const uint8_t *kxor, const uint8_t *rand)
int | comp128v3 (const uint8_t *ki, const uint8_t *rand, uint8_t *sres, uint8_t *kc)
| Perform COMP128v3 algorithm. More...
int | comp128v2 (const uint8_t *ki, const uint8_t *rand, uint8_t *sres, uint8_t *kc)
| Perform COMP128v2 algorithm. More...

## Variables
const struct value_string | osmo_sub_auth_type_names []
enum osmo_sub_auth_type | osmo_sub_auth_data2::type
enum osmo_auth_algo | osmo_sub_auth_data2::algo
uint8_t osmo_sub_auth_data2::opc [32]
| operator invariant value More...
uint8_t osmo_sub_auth_data2::opc_len
| OPc length (in bytes): 16 or 32. More...
uint8_t osmo_sub_auth_data2::k [32]
| secret key of the subscriber More...
uint8_t osmo_sub_auth_data2::k_len
| K length (in bytes): 16 or 32. More...
uint8_t osmo_sub_auth_data2::amf [2]
uint64_t osmo_sub_auth_data2::sqn
| sequence number (in: prev sqn; out: used sqn) More...
int osmo_sub_auth_data2::opc_is_op
| is the OPC field OPC (0) or OP (1) ? More...
unsigned int osmo_sub_auth_data2::ind_bitlen
| nr of bits not in SEQ, only SQN More...
unsigned int osmo_sub_auth_data2::ind
| which IND slot to use an SQN from More...
uint64_t osmo_sub_auth_data2::sqn_ms
| sqn from AUTS (output value only) More...
struct {
uint8_t osmo_sub_auth_data2::opc [32]
| operator invariant value More...
uint8_t osmo_sub_auth_data2::opc_len
| OPc length (in bytes): 16 or 32. More...
uint8_t osmo_sub_auth_data2::k [32]
| secret key of the subscriber More...
uint8_t osmo_sub_auth_data2::k_len
| K length (in bytes): 16 or 32. More...
uint8_t osmo_sub_auth_data2::amf [2]
uint64_t osmo_sub_auth_data2::sqn
| sequence number (in: prev sqn; out: used sqn) More...
int osmo_sub_auth_data2::opc_is_op
| is the OPC field OPC (0) or OP (1) ? More...
unsigned int osmo_sub_auth_data2::ind_bitlen
| nr of bits not in SEQ, only SQN More...
unsigned int osmo_sub_auth_data2::ind
| which IND slot to use an SQN from More...
uint64_t osmo_sub_auth_data2::sqn_ms
| sqn from AUTS (output value only) More...
} osmo_sub_auth_data2::umts
uint8_t osmo_sub_auth_data2::ki [OSMO_A5_MAX_KEY_LEN_BYTES]
| secret key More...
struct {
uint8_t osmo_sub_auth_data2::ki [OSMO_A5_MAX_KEY_LEN_BYTES]
| secret key More...
} osmo_sub_auth_data2::gsm
union {
struct {
uint8_t osmo_sub_auth_data2::opc [32]
| operator invariant value More...
uint8_t osmo_sub_auth_data2::opc_len
| OPc length (in bytes): 16 or 32. More...
uint8_t osmo_sub_auth_data2::k [32]
| secret key of the subscriber More...
uint8_t osmo_sub_auth_data2::k_len
| K length (in bytes): 16 or 32. More...
uint8_t osmo_sub_auth_data2::amf [2]
uint64_t osmo_sub_auth_data2::sqn
| sequence number (in: prev sqn; out: used sqn) More...
int osmo_sub_auth_data2::opc_is_op
| is the OPC field OPC (0) or OP (1) ? More...
unsigned int osmo_sub_auth_data2::ind_bitlen
| nr of bits not in SEQ, only SQN More...
unsigned int osmo_sub_auth_data2::ind
| which IND slot to use an SQN from More...
uint64_t osmo_sub_auth_data2::sqn_ms
| sqn from AUTS (output value only) More...
} osmo_sub_auth_data2::umts
struct {
uint8_t osmo_sub_auth_data2::ki [OSMO_A5_MAX_KEY_LEN_BYTES]
| secret key More...
} osmo_sub_auth_data2::gsm
} | osmo_sub_auth_data2::u
enum osmo_sub_auth_type | osmo_sub_auth_data::type
enum osmo_auth_algo | osmo_sub_auth_data::algo
uint8_t osmo_sub_auth_data::opc [16]
| operator invariant value More...
uint8_t osmo_sub_auth_data::k [OSMO_A5_MAX_KEY_LEN_BYTES]
| secret key of the subscriber More...
uint8_t osmo_sub_auth_data::amf [2]
uint64_t osmo_sub_auth_data::sqn
| sequence number (in: prev sqn; out: used sqn) More...
int osmo_sub_auth_data::opc_is_op
| is the OPC field OPC (0) or OP (1) ? More...
unsigned int osmo_sub_auth_data::ind_bitlen
| nr of bits not in SEQ, only SQN More...
unsigned int osmo_sub_auth_data::ind
| which IND slot to use an SQN from More...
uint64_t osmo_sub_auth_data::sqn_ms
| sqn from AUTS (output value only) More...
struct {
uint8_t osmo_sub_auth_data::opc [16]
| operator invariant value More...
uint8_t osmo_sub_auth_data::k [OSMO_A5_MAX_KEY_LEN_BYTES]
| secret key of the subscriber More...
uint8_t osmo_sub_auth_data::amf [2]
uint64_t osmo_sub_auth_data::sqn
| sequence number (in: prev sqn; out: used sqn) More...
int osmo_sub_auth_data::opc_is_op
| is the OPC field OPC (0) or OP (1) ? More...
unsigned int osmo_sub_auth_data::ind_bitlen
| nr of bits not in SEQ, only SQN More...
unsigned int osmo_sub_auth_data::ind
| which IND slot to use an SQN from More...
uint64_t osmo_sub_auth_data::sqn_ms
| sqn from AUTS (output value only) More...
} osmo_sub_auth_data::umts
uint8_t osmo_sub_auth_data::ki [OSMO_A5_MAX_KEY_LEN_BYTES]
| secret key More...
struct {
uint8_t osmo_sub_auth_data::ki [OSMO_A5_MAX_KEY_LEN_BYTES]
| secret key More...
} osmo_sub_auth_data::gsm
union {
struct {
uint8_t osmo_sub_auth_data::opc [16]
| operator invariant value More...
uint8_t osmo_sub_auth_data::k [OSMO_A5_MAX_KEY_LEN_BYTES]
| secret key of the subscriber More...
uint8_t osmo_sub_auth_data::amf [2]
uint64_t osmo_sub_auth_data::sqn
| sequence number (in: prev sqn; out: used sqn) More...
int osmo_sub_auth_data::opc_is_op
| is the OPC field OPC (0) or OP (1) ? More...
unsigned int osmo_sub_auth_data::ind_bitlen
| nr of bits not in SEQ, only SQN More...
unsigned int osmo_sub_auth_data::ind
| which IND slot to use an SQN from More...
uint64_t osmo_sub_auth_data::sqn_ms
| sqn from AUTS (output value only) More...
} osmo_sub_auth_data::umts
struct {
uint8_t osmo_sub_auth_data::ki [OSMO_A5_MAX_KEY_LEN_BYTES]
| secret key More...
} osmo_sub_auth_data::gsm
} | osmo_sub_auth_data::u
uint8_t | osmo_auth_vector::rand [16]
| random challenge More...
uint8_t | osmo_auth_vector::autn [16]
| authentication nonce More...
uint8_t | osmo_auth_vector::ck [OSMO_A5_MAX_KEY_LEN_BYTES]
| ciphering key More...
uint8_t | osmo_auth_vector::ik [OSMO_A5_MAX_KEY_LEN_BYTES]
| integrity key More...
uint8_t | osmo_auth_vector::res [16]
| authentication result More...
uint8_t | osmo_auth_vector::res_len
| length (in bytes) of res: 4..16 bytes More...
uint8_t | osmo_auth_vector::kc [8]
| Kc for GSM encryption (A5) More...
uint8_t | osmo_auth_vector::sres [4]
| authentication result for GSM More...
uint32_t | osmo_auth_vector::auth_types
| bitmask of OSMO_AUTH_TYPE_* More...
struct llist_head | osmo_auth_impl::list
enum osmo_auth_algo | osmo_auth_impl::algo
| algorithm we implement More...
const char * | osmo_auth_impl::name
| name of the implementation More...
unsigned int | osmo_auth_impl::priority
| priority value (resp. More...
int(* | osmo_auth_impl::gen_vec )(struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
| callback for generate authentication vectors More...
int(* | osmo_auth_impl::gen_vec_auts )(struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *auts, const uint8_t *rand_auts, const uint8_t *_rand)
| callback for generating auth vectors + re-sync More...
static struct osmo_auth_impl | c128v1_alg
static struct osmo_auth_impl | c128v2_alg
static struct osmo_auth_impl | c128v3_alg
static struct osmo_auth_impl * | selected_auths [_OSMO_AUTH_ALG_NUM]
static const struct value_string | auth_alg_vals []
const struct value_string | osmo_sub_auth_type_names []
static struct osmo_auth_impl | milenage_alg
static struct osmo_auth_impl | tuak_alg
static struct osmo_auth_impl | xor_alg
static struct osmo_auth_impl | xor2g_alg
static const uint8_t | table_0 [512]
static const uint8_t | table_1 [256]
static const uint8_t | table_2 [128]
static const uint8_t | table_3 [64]
static const uint8_t | table_4 [32]
static const uint8_t * | _comp128_table [5] = { table_0, table_1, table_2, table_3, table_4 }
static const uint8_t | table0 [256]
static const uint8_t | table1 [256]

## Detailed Description

GSM/GPRS/3G authentication core infrastructure.

## Macro Definition Documentation

## ◆ OSMO_A5_MAX_KEY_LEN_BYTES

#define OSMO_A5_MAX_KEY_LEN_BYTES (128/8)

## ◆ OSMO_AUTH_ALG_XOR

#define OSMO_AUTH_ALG_XOR OSMO_AUTH_ALG_XOR_3G

## ◆ OSMO_MILENAGE_IND_BITLEN_MAX

#define OSMO_MILENAGE_IND_BITLEN_MAX 28

## Enumeration Type Documentation

## ◆ osmo_auth_algo

enum osmo_auth_algo

Authentication Algorithm.

See also osmo_auth_alg_name() and osmo_auth_alg_parse().

Enumerator
OSMO_AUTH_ALG_NONE |
OSMO_AUTH_ALG_COMP128v1 |
OSMO_AUTH_ALG_COMP128v2 |
OSMO_AUTH_ALG_COMP128v3 |
OSMO_AUTH_ALG_XOR_3G |
OSMO_AUTH_ALG_MILENAGE |
OSMO_AUTH_ALG_XOR_2G |
OSMO_AUTH_ALG_TUAK |
_OSMO_AUTH_ALG_NUM |

## ◆ osmo_sub_auth_type

enum osmo_sub_auth_type

Authentication Type (GSM/UMTS)

Enumerator
OSMO_AUTH_TYPE_NONE |
OSMO_AUTH_TYPE_GSM |
OSMO_AUTH_TYPE_UMTS |

## Function Documentation

## ◆ __attribute__()

static __attribute__ | ( | (constructor) |  | ) |
| static

References c128v1_alg, and osmo_auth_register().

## ◆ _comp128_bitsfrombytes()

static void _comp128_bitsfrombytes | ( | uint8_t * | x,
|  | uint8_t * | bits
| ) |  |
| inline static

References x.

Referenced by comp128v1().

## ◆ _comp128_compression()

static void _comp128_compression | ( | uint8_t * | x | ) |
| inline static

References _comp128_compression_round(), _comp128_table, n, and x.

Referenced by comp128v1().

## ◆ _comp128_compression_round()

static void _comp128_compression_round | ( | uint8_t * | x,
|  | int | n,
|  | const uint8_t * | tbl
| ) |  |
| inline static

References n, and x.

Referenced by _comp128_compression().

## ◆ _comp128_permutation()

static void _comp128_permutation | ( | uint8_t * | x,
|  | uint8_t * | bits
| ) |  |
| inline static

References x.

Referenced by comp128v1().

## ◆ _comp128v23_internal()

static void _comp128v23_internal | ( | uint8_t * | output,
|  | const uint8_t * | kxor,
|  | const uint8_t * | rand
| ) |  |
| static

References table0, and table1.

Referenced by comp128v3().

## ◆ auth_data2auth_data2()

static int auth_data2auth_data2 | ( | struct osmo_sub_auth_data2 * | out,
|  | const struct osmo_sub_auth_data * | in
| ) |  |
| static

References osmo_sub_auth_data2::algo, osmo_sub_auth_data::algo, osmo_sub_auth_data2::amf, osmo_sub_auth_data::amf, osmo_sub_auth_data2::gsm, osmo_sub_auth_data::gsm, osmo_sub_auth_data2::ind, osmo_sub_auth_data::ind, osmo_sub_auth_data2::ind_bitlen, osmo_sub_auth_data::ind_bitlen, osmo_sub_auth_data2::k, osmo_sub_auth_data::k, osmo_sub_auth_data2::k_len, osmo_sub_auth_data2::ki, osmo_sub_auth_data::ki, osmo_sub_auth_data::opc, osmo_sub_auth_data2::opc, osmo_sub_auth_data2::opc_is_op, osmo_sub_auth_data::opc_is_op, osmo_sub_auth_data2::opc_len, OSMO_AUTH_TYPE_GSM, OSMO_AUTH_TYPE_NONE, OSMO_AUTH_TYPE_UMTS, osmo_sub_auth_data2::sqn, osmo_sub_auth_data::sqn, osmo_sub_auth_data2::sqn_ms, osmo_sub_auth_data::sqn_ms, osmo_sub_auth_data2::type, osmo_sub_auth_data::type, osmo_sub_auth_data2::u, osmo_sub_auth_data::u, osmo_sub_auth_data2::umts, and osmo_sub_auth_data::umts.

Referenced by osmo_auth_gen_vec(), and osmo_auth_gen_vec_auts().

## ◆ c128v1_gen_vec()

static int c128v1_gen_vec | ( | struct osmo_auth_vector * | vec,
|  | struct osmo_sub_auth_data2 * | aud,
|  | const uint8_t * | _rand
| ) |  |
| static

References osmo_sub_auth_data2::algo, osmo_auth_vector::auth_types, comp128v1(), osmo_sub_auth_data2::gsm, osmo_auth_vector::kc, osmo_sub_auth_data2::ki, OSMO_ASSERT, OSMO_AUTH_ALG_COMP128v1, OSMO_AUTH_TYPE_GSM, osmo_auth_vector::sres, and osmo_sub_auth_data2::u.

## ◆ c128v2_gen_vec()

static int c128v2_gen_vec | ( | struct osmo_auth_vector * | vec,
|  | struct osmo_sub_auth_data2 * | aud,
|  | const uint8_t * | _rand
| ) |  |
| static

References osmo_sub_auth_data2::algo, osmo_auth_vector::auth_types, comp128v2(), osmo_sub_auth_data2::gsm, osmo_auth_vector::kc, osmo_sub_auth_data2::ki, OSMO_ASSERT, OSMO_AUTH_ALG_COMP128v2, OSMO_AUTH_TYPE_GSM, osmo_auth_vector::sres, and osmo_sub_auth_data2::u.

## ◆ c128v3_gen_vec()

static int c128v3_gen_vec | ( | struct osmo_auth_vector * | vec,
|  | struct osmo_sub_auth_data2 * | aud,
|  | const uint8_t * | _rand
| ) |  |
| static

References osmo_sub_auth_data2::algo, osmo_auth_vector::auth_types, comp128v3(), osmo_sub_auth_data2::gsm, osmo_auth_vector::kc, osmo_sub_auth_data2::ki, OSMO_ASSERT, OSMO_AUTH_ALG_COMP128v3, OSMO_AUTH_TYPE_GSM, osmo_auth_vector::sres, and osmo_sub_auth_data2::u.

## ◆ c5_function()

static void c5_function | ( | uint8_t * | ik,
|  | const uint8_t * | kc
| ) |  |
| inline static

Referenced by osmo_auth_3g_from_2g().

## ◆ comp128()

void comp128 | ( | const uint8_t * | ki,
|  | const uint8_t * | rand,
|  | uint8_t * | sres,
|  | uint8_t * | kc
| ) |  |

Perform COMP128v1 algorithm.

Parameters

  [in] | ki | Secret Key K(i) of subscriber
  [in] | rand | Random Challenge
  [out] | sres | user-supplied buffer for storing computed SRES value
  [out] | kc | user-supplied buffer for storing computed Kc value

References comp128v1(), and sres.

## ◆ comp128v1()

void comp128v1 | ( | const uint8_t * | ki,
|  | const uint8_t * | rand,
|  | uint8_t * | sres,
|  | uint8_t * | kc
| ) |  |

Perform COMP128v1 algorithm.

Parameters

  [in] | ki | Secret Key K(i) of subscriber
  [in] | rand | Random Challenge
  [out] | sres | user-supplied buffer for storing computed SRES value
  [out] | kc | user-supplied buffer for storing computed Kc value

References _comp128_bitsfrombytes(), _comp128_compression(), _comp128_permutation(), sres, and x.

Referenced by c128v1_gen_vec(), and comp128().

## ◆ comp128v2()

int comp128v2 | ( | const uint8_t * | ki,
|  | const uint8_t * | rand,
|  | uint8_t * | sres,
|  | uint8_t * | kc
| ) |  |

Perform COMP128v2 algorithm.

Parameters

  [in] | ki | Secret Key K(i) of subscriber
  [in] | rand | Random Challenge
  [out] | sres | user-supplied buffer for storing computed SRES value
  [out] | kc | user-supplied buffer for storing computed Kc value

Returns
  0

References comp128v3(), and sres.

Referenced by c128v2_gen_vec().

## ◆ comp128v3()

int comp128v3 | ( | const uint8_t * | ki,
|  | const uint8_t * | rand,
|  | uint8_t * | sres,
|  | uint8_t * | kc
| ) |  |

Perform COMP128v3 algorithm.

Parameters

  [in] | ki | Secret Key K(i) of subscriber
  [in] | rand | Random Challenge
  [out] | sres | user-supplied buffer for storing computed SRES value
  [out] | kc | user-supplied buffer for storing computed Kc value

Returns
  0

References _comp128v23_internal(), and sres.

Referenced by c128v3_gen_vec(), and comp128v2().

## ◆ gen_opc_if_needed()

static const uint8_t * gen_opc_if_needed | ( | const struct osmo_sub_auth_data2 * | aud,
|  | uint8_t * | gen_opc
| ) |  |
| static

References osmo_sub_auth_data2::k, milenage_opc_gen(), osmo_sub_auth_data2::opc, osmo_sub_auth_data2::opc_is_op, OSMO_AUTH_TYPE_UMTS, osmo_sub_auth_data2::type, osmo_sub_auth_data2::u, and osmo_sub_auth_data2::umts.

Referenced by milenage_gen_vec(), and milenage_gen_vec_auts().

## ◆ LLIST_HEAD()

static LLIST_HEAD | ( | osmo_auths |  | ) |
| static

## ◆ milenage_gen_vec()

static int milenage_gen_vec | ( | struct osmo_auth_vector * | vec,
|  | struct osmo_sub_auth_data2 * | aud,
|  | const uint8_t * | _rand
| ) |  |
| static

References osmo_sub_auth_data2::algo, osmo_sub_auth_data2::amf, osmo_auth_vector::auth_types, osmo_auth_vector::autn, osmo_auth_vector::ck, gen_opc_if_needed(), osmo_auth_vector::ik, osmo_sub_auth_data2::ind, osmo_sub_auth_data2::ind_bitlen, osmo_sub_auth_data2::k, osmo_sub_auth_data2::k_len, osmo_auth_vector::kc, milenage_generate(), osmo_sub_auth_data2::opc_len, OSMO_ASSERT, OSMO_AUTH_ALG_MILENAGE, osmo_auth_c2(), osmo_auth_c3(), OSMO_AUTH_TYPE_GSM, OSMO_AUTH_TYPE_UMTS, OSMO_MILENAGE_IND_BITLEN_MAX, osmo_auth_vector::res, osmo_auth_vector::res_len, osmo_sub_auth_data2::sqn, osmo_auth_vector::sres, osmo_sub_auth_data2::u, and osmo_sub_auth_data2::umts.

Referenced by milenage_gen_vec_auts().

## ◆ milenage_gen_vec_auts()

static int milenage_gen_vec_auts | ( | struct osmo_auth_vector * | vec,
|  | struct osmo_sub_auth_data2 * | aud,
|  | const uint8_t * | auts,
|  | const uint8_t * | rand_auts,
|  | const uint8_t * | _rand
| ) |  |
| static

References osmo_sub_auth_data2::algo, gen_opc_if_needed(), osmo_sub_auth_data2::k, osmo_sub_auth_data2::k_len, milenage_auts(), milenage_gen_vec(), osmo_sub_auth_data2::opc_len, OSMO_ASSERT, OSMO_AUTH_ALG_MILENAGE, osmo_sub_auth_data2::sqn, osmo_sub_auth_data2::sqn_ms, osmo_sub_auth_data2::u, and osmo_sub_auth_data2::umts.

## ◆ osmo_auth_3g_from_2g()

int osmo_auth_3g_from_2g | ( | struct osmo_auth_vector * | vec | ) |

Generate 3G CK + IK from 2G authentication vector.

Parameters

  vec | Authentication Vector to be modified

Returns
  1 if the vector was changed, 0 otherwise

This function performs the C5 and C4 functions to derive the UMTS key material from the GSM key material in the supplied vector, if the input vector doesn't yet have UMTS authentication capability.

References osmo_auth_vector::auth_types, c5_function(), osmo_auth_vector::ck, osmo_auth_vector::ik, osmo_auth_vector::kc, OSMO_AUTH_TYPE_GSM, OSMO_AUTH_TYPE_UMTS, and osmo_c4().

## ◆ osmo_auth_alg_name()

const char * osmo_auth_alg_name | ( | enum osmo_auth_algo | alg | ) |

Get human-readable name of authentication algorithm.

References auth_alg_vals, and get_value_string().

## ◆ osmo_auth_alg_parse()

enum osmo_auth_algo osmo_auth_alg_parse | ( | const char * | name | ) |

Parse human-readable name of authentication algorithm.

References auth_alg_vals, get_string_value(), and name.

## ◆ osmo_auth_c2()

void osmo_auth_c2 | ( | uint8_t | sres[4],
|  | const uint8_t * | res,
|  | size_t | res_len,
|  | uint8_t | sres_deriv_func
| ) |  |

Derive GSM SRES from UMTS [X]RES (auth function c2 from 3GPP TS 33.103 Section 6.8.1.2.

Parameters

  [out] | sres | GSM SRES value, 4 byte target buffer
  [in] | res | UMTS XRES, 4..16 bytes input buffer
  [in] | res_len | length of res parameter (in bytes)
  [in] | sres_deriv_func | SRES derivation function (1 or 2, see 3GPP TS 55.205 Section 4

References OSMO_ASSERT, res, and sres.

Referenced by gsm_milenage(), milenage_gen_vec(), and tuak_gen_vec().

## ◆ osmo_auth_c3()

void osmo_auth_c3 | ( | uint8_t | kc[],
|  | const uint8_t | ck[],
|  | const uint8_t | ik[]
| ) |  |

Referenced by gsm_milenage(), milenage_gen_vec(), tuak_gen_vec(), and xor_gen_vec().

## ◆ osmo_auth_gen_vec()

int osmo_auth_gen_vec | ( | struct osmo_auth_vector * | vec,
|  | struct osmo_sub_auth_data * | aud,
|  | const uint8_t * | _rand
| ) |  |

Generate authentication vector.

Parameters

  [out] | vec | Generated authentication vector
  [in] | aud | Subscriber-specific key material
  [in] | _rand | Random challenge to be used

Returns
  0 on success, negative error on failure

This function performs the core cryptographic function of the AUC, computing authentication triples/quintuples based on the permanent subscriber data and a random value. The result is what is forwarded by the AUC via HLR and VLR to the MSC which will then be able to invoke authentication with the MS

References auth_data2auth_data2(), osmo_auth_gen_vec2(), OSMO_AUTH_TYPE_UMTS, osmo_auth_vector::res_len, osmo_sub_auth_data2::sqn, osmo_sub_auth_data::sqn, osmo_sub_auth_data::type, osmo_sub_auth_data2::u, osmo_sub_auth_data::u, osmo_sub_auth_data2::umts, and osmo_sub_auth_data::umts.

Referenced by oap_evaluate_challenge().

## ◆ osmo_auth_gen_vec2()

int osmo_auth_gen_vec2 | ( | struct osmo_auth_vector * | vec,
|  | struct osmo_sub_auth_data2 * | aud,
|  | const uint8_t * | _rand
| ) |  |

Generate authentication vector.

Parameters

  [out] | vec | Generated authentication vector. See below!
  [in] | aud | Subscriber-specific key material
  [in] | _rand | Random challenge to be used

Returns
  0 on success, negative error on failure

This function performs the core cryptographic function of the AUC, computing authentication triples/quintuples based on the permanent subscriber data and a random value. The result is what is forwarded by the AUC via HLR and VLR to the MSC which will then be able to invoke authentication with the MS.

Contrary to the older osmo_auth_gen_vec(), the caller must specify the desired RES length in the vec->res_len field prior to calling this function. The requested length must match the capabilities of the chosen algorithm (e.g. 4/8 for MILENAGE).

References osmo_sub_auth_data2::algo, osmo_auth_impl::gen_vec, osmo_auth_vector::rand, and selected_auths.

Referenced by osmo_auth_gen_vec().

## ◆ osmo_auth_gen_vec_auts()

int osmo_auth_gen_vec_auts | ( | struct osmo_auth_vector * | vec,
|  | struct osmo_sub_auth_data * | aud,
|  | const uint8_t * | auts,
|  | const uint8_t * | rand_auts,
|  | const uint8_t * | _rand
| ) |  |

Generate authentication vector and re-sync sequence.

Parameters

  [out] | vec | Generated authentication vector
  [in] | aud | Subscriber-specific key material
  [in] | auts | AUTS value sent by the SIM/MS
  [in] | rand_auts | RAND value sent by the SIM/MS
  [in] | _rand | Random challenge to be used to generate vector

Returns
  0 on success, negative error on failure

This function performs a special variant of the core cryptographic function of the AUC: computing authentication triples/quintuples based on the permanent subscriber data, a random value as well as the AUTS and RAND values returned by the SIM/MS. This special variant is needed if the sequence numbers between MS and AUC have for some reason become different.

References auth_data2auth_data2(), osmo_auth_gen_vec_auts2(), OSMO_AUTH_TYPE_UMTS, osmo_auth_vector::res_len, osmo_sub_auth_data2::sqn, osmo_sub_auth_data::sqn, osmo_sub_auth_data2::sqn_ms, osmo_sub_auth_data::sqn_ms, osmo_sub_auth_data::type, osmo_sub_auth_data2::u, osmo_sub_auth_data::u, osmo_sub_auth_data2::umts, and osmo_sub_auth_data::umts.

## ◆ osmo_auth_gen_vec_auts2()

int osmo_auth_gen_vec_auts2 | ( | struct osmo_auth_vector * | vec,
|  | struct osmo_sub_auth_data2 * | aud,
|  | const uint8_t * | auts,
|  | const uint8_t * | rand_auts,
|  | const uint8_t * | _rand
| ) |  |

Generate authentication vector and re-sync sequence.

Parameters

  [out] | vec | Generated authentication vector. See below!
  [in] | aud | Subscriber-specific key material
  [in] | auts | AUTS value sent by the SIM/MS
  [in] | rand_auts | RAND value sent by the SIM/MS
  [in] | _rand | Random challenge to be used to generate vector

Returns
  0 on success, negative error on failure

This function performs a special variant of the core cryptographic function of the AUC: computing authentication triples/quintuples based on the permanent subscriber data, a random value as well as the AUTS and RAND values returned by the SIM/MS. This special variant is needed if the sequence numbers between MS and AUC have for some reason become different.

Contrary to the older osmo_auth_gen_vec_auts(), the caller must specify the desired RES length in the vec->res_len field prior to calling this function. The requested length must match the capabilities of the chosen algorithm (e.g. 4/8 for MILENAGE).

References osmo_sub_auth_data2::algo, osmo_auth_impl::gen_vec_auts, osmo_auth_vector::rand, and selected_auths.

Referenced by osmo_auth_gen_vec_auts().

## ◆ osmo_auth_load()

int osmo_auth_load | ( | const char * | path | ) |

Load all available authentication plugins from the given path.

Parameters

  [in] | path | Path name of the directory containing the plugins

Returns
  number of plugins loaded in case of success, negative in case of error

This function will load all plugins contained in the specified path.

References osmo_plugin_load_all().

## ◆ osmo_auth_register()

int osmo_auth_register | ( | struct osmo_auth_impl * | impl | ) |

Register an authentication algorithm implementation with the core.

Parameters

  [in] | impl | Structure describing implementation and it's callbacks

Returns
  0 on success, or a negative error code on failure

This function is called by an authentication implementation plugin to register itself with the authentication core.

References osmo_auth_impl::algo, ARRAY_SIZE, osmo_auth_impl::list, llist_add_tail(), osmo_auth_impl::priority, and selected_auths.

Referenced by __attribute__().

## ◆ osmo_auth_supported()

int osmo_auth_supported | ( | enum osmo_auth_algo | algo | ) |

Determine if a given authentication algorithm is supported.

Parameters

  [in] | algo | Algorithm which should be checked

Returns
  1 if algo is supported, 0 if not, negative error on failure

This function is used by an application to determine at runtime if a given authentication algorithm is supported or not.

References osmo_auth_impl::algo, ARRAY_SIZE, and selected_auths.

## ◆ osmo_c4()

void osmo_c4 | ( | uint8_t * | ck,
|  | const uint8_t * | kc
| ) |  |

Referenced by _a5_3(), gea3(), and osmo_auth_3g_from_2g().

## ◆ osmo_sub_auth_type_name()

static const char * osmo_sub_auth_type_name | ( | enum osmo_sub_auth_type | val | ) |
| inline static

References get_value_string(), and osmo_sub_auth_type_names.

## ◆ tuak_gen_vec()

static int tuak_gen_vec | ( | struct osmo_auth_vector * | vec,
|  | struct osmo_sub_auth_data2 * | aud,
|  | const uint8_t * | _rand
| ) |  |
| static

References osmo_sub_auth_data2::algo, osmo_sub_auth_data2::amf, osmo_auth_vector::auth_types, osmo_auth_vector::autn, osmo_auth_vector::ck, gen_opc_if_needed(), osmo_auth_vector::ik, osmo_sub_auth_data2::ind, osmo_sub_auth_data2::ind_bitlen, osmo_sub_auth_data2::k, osmo_sub_auth_data2::k_len, osmo_auth_vector::kc, osmo_sub_auth_data2::opc_len, OSMO_ASSERT, OSMO_AUTH_ALG_TUAK, osmo_auth_c2(), osmo_auth_c3(), OSMO_AUTH_TYPE_GSM, OSMO_AUTH_TYPE_UMTS, OSMO_MILENAGE_IND_BITLEN_MAX, osmo_auth_vector::res, osmo_auth_vector::res_len, osmo_sub_auth_data2::sqn, osmo_auth_vector::sres, tuak_generate(), osmo_sub_auth_data2::u, and osmo_sub_auth_data2::umts.

Referenced by tuak_gen_vec_auts().

## ◆ tuak_gen_vec_auts()

static int tuak_gen_vec_auts | ( | struct osmo_auth_vector * | vec,
|  | struct osmo_sub_auth_data2 * | aud,
|  | const uint8_t * | auts,
|  | const uint8_t * | rand_auts,
|  | const uint8_t * | _rand
| ) |  |
| static

References osmo_sub_auth_data2::algo, gen_opc_if_needed(), osmo_sub_auth_data2::k, osmo_sub_auth_data2::k_len, osmo_sub_auth_data2::opc_len, OSMO_ASSERT, OSMO_AUTH_ALG_TUAK, osmo_sub_auth_data2::sqn, osmo_sub_auth_data2::sqn_ms, tuak_auts(), tuak_gen_vec(), osmo_sub_auth_data2::u, and osmo_sub_auth_data2::umts.

## ◆ xor()

static void xor | ( | uint8_t * | out,
|  | const uint8_t * | a,
|  | const uint8_t * | b,
|  | size_t | len
| ) |  |
| static

References len.

Referenced by xor_gen_vec(), and xor_gen_vec_auts().

## ◆ xor2g_gen_vec()

static int xor2g_gen_vec | ( | struct osmo_auth_vector * | vec,
|  | struct osmo_sub_auth_data2 * | aud,
|  | const uint8_t * | _rand
| ) |  |
| static

References osmo_sub_auth_data2::algo, osmo_auth_vector::auth_types, ENOTSUP, osmo_sub_auth_data2::gsm, osmo_auth_vector::kc, osmo_sub_auth_data2::ki, OSMO_ASSERT, OSMO_AUTH_ALG_XOR_2G, OSMO_AUTH_TYPE_GSM, osmo_auth_vector::sres, osmo_sub_auth_data2::type, osmo_sub_auth_data2::u, and xor().

## ◆ xor_gen_vec()

static int xor_gen_vec | ( | struct osmo_auth_vector * | vec,
|  | struct osmo_sub_auth_data2 * | aud,
|  | const uint8_t * | _rand
| ) |  |
| static

Step 2: res = xdout

Suggested length for res is 128 bits, i.e. 16 bytes, but also can be in range: 30 < n < 128 bits.

3GPP TS 33.102, clause 6.8.1.2, b sres = c2(res) = res[0-3] ^ res[4-7] ^ res[8-11] ^ res[12-15]

3GPP TS 33.102, clause 6.8.1.2, c kc = c3(ck, ik) = ck[0-7] ^ ck[8-15] ^ ik[0-7] ^ ik[8-15] FIXME: do we really have CK/IK for GSM?

Step 3: cdout = sqn[0-5] || amf[0-1] NOTE (for USIM): sqn[0-5] = autn[0-5] ^ ak[0-5]

Step 5: autn = sqn ^ ak || amf || mac NOTE: cdout still contains SQN from step 3

References osmo_sub_auth_data2::algo, osmo_sub_auth_data2::amf, osmo_auth_vector::auth_types, osmo_auth_vector::autn, osmo_auth_vector::ck, ENOTSUP, osmo_sub_auth_data2::gsm, osmo_auth_vector::ik, osmo_sub_auth_data2::k, osmo_sub_auth_data2::k_len, osmo_auth_vector::kc, osmo_sub_auth_data2::ki, OSMO_ASSERT, OSMO_AUTH_ALG_XOR_3G, osmo_auth_c3(), OSMO_AUTH_TYPE_GSM, OSMO_AUTH_TYPE_UMTS, osmo_auth_vector::res, osmo_auth_vector::res_len, osmo_sub_auth_data2::sqn, osmo_auth_vector::sres, osmo_sub_auth_data2::type, osmo_sub_auth_data2::u, osmo_sub_auth_data2::umts, and xor().

Referenced by xor_gen_vec_auts().

## ◆ xor_gen_vec_auts()

static int xor_gen_vec_auts | ( | struct osmo_auth_vector * | vec,
|  | struct osmo_sub_auth_data2 * | aud,
|  | const uint8_t * | auts,
|  | const uint8_t * | rand_auts,
|  | const uint8_t * | _rand
| ) |  |
| static

References osmo_sub_auth_data2::algo, ENOTSUP, osmo_sub_auth_data2::gsm, osmo_sub_auth_data2::k, osmo_sub_auth_data2::k_len, osmo_sub_auth_data2::ki, OSMO_ASSERT, OSMO_AUTH_ALG_XOR_3G, OSMO_AUTH_TYPE_GSM, OSMO_AUTH_TYPE_UMTS, osmo_sub_auth_data2::sqn, osmo_sub_auth_data2::sqn_ms, osmo_sub_auth_data2::type, osmo_sub_auth_data2::u, osmo_sub_auth_data2::umts, xor(), and xor_gen_vec().

## Variable Documentation

## ◆ _comp128_table

const uint8_t* _comp128_table[5] = { table_0, table_1, table_2, table_3, table_4 }
| static

Referenced by _comp128_compression().

## ◆ algo [1/3]

enum osmo_auth_algo osmo_sub_auth_data2::algo

Referenced by auth_data2auth_data2(), c128v1_gen_vec(), c128v2_gen_vec(), c128v3_gen_vec(), milenage_gen_vec(), milenage_gen_vec_auts(), osmo_auth_gen_vec2(), osmo_auth_gen_vec_auts2(), tuak_gen_vec(), tuak_gen_vec_auts(), xor2g_gen_vec(), xor_gen_vec(), and xor_gen_vec_auts().

## ◆ algo [2/3]

enum osmo_auth_algo osmo_sub_auth_data::algo

Referenced by auth_data2auth_data2().

## ◆ algo [3/3]

enum osmo_auth_algo osmo_auth_impl::algo

algorithm we implement

Referenced by osmo_auth_register(), and osmo_auth_supported().

## ◆ amf [1/4]

uint8_t osmo_sub_auth_data2::amf[2]

Referenced by auth_data2auth_data2(), milenage_gen_vec(), tuak_gen_vec(), and xor_gen_vec().

## ◆ [2/4]

uint8_t { ... } ::amf[2]

## ◆ [3/4]

uint8_t { ... } ::amf[2]

## ◆ amf [4/4]

uint8_t osmo_sub_auth_data::amf[2]

Referenced by auth_data2auth_data2(), and oap_evaluate_challenge().

## ◆ auth_alg_vals

const struct value_string auth_alg_vals[]
| static

Initial value:
= {
{ OSMO_AUTH_ALG_NONE, "None" },
{ OSMO_AUTH_ALG_COMP128v1, "COMP128v1" },
{ OSMO_AUTH_ALG_COMP128v2, "COMP128v2" },
{ OSMO_AUTH_ALG_COMP128v3, "COMP128v3" },
{ OSMO_AUTH_ALG_XOR_3G, "XOR-3G" },
{ OSMO_AUTH_ALG_MILENAGE, "MILENAGE" },
{ OSMO_AUTH_ALG_XOR_2G, "XOR-2G" },
{ OSMO_AUTH_ALG_TUAK, "TUAK" },
{ 0, NULL }
}
OSMO_AUTH_ALG_COMP128v2
@ OSMO_AUTH_ALG_COMP128v2
Definition: auth.h:31
OSMO_AUTH_ALG_NONE
@ OSMO_AUTH_ALG_NONE
Definition: auth.h:29
OSMO_AUTH_ALG_COMP128v1
@ OSMO_AUTH_ALG_COMP128v1
Definition: auth.h:30
OSMO_AUTH_ALG_TUAK
@ OSMO_AUTH_ALG_TUAK
Definition: auth.h:36
OSMO_AUTH_ALG_XOR_3G
@ OSMO_AUTH_ALG_XOR_3G
Definition: auth.h:33
OSMO_AUTH_ALG_COMP128v3
@ OSMO_AUTH_ALG_COMP128v3
Definition: auth.h:32
OSMO_AUTH_ALG_XOR_2G
@ OSMO_AUTH_ALG_XOR_2G
Definition: auth.h:35
OSMO_AUTH_ALG_MILENAGE
@ OSMO_AUTH_ALG_MILENAGE
Definition: auth.h:34

Referenced by osmo_auth_alg_name(), and osmo_auth_alg_parse().

## ◆ auth_types

uint32_t osmo_auth_vector::auth_types

bitmask of OSMO_AUTH_TYPE_*

Referenced by c128v1_gen_vec(), c128v2_gen_vec(), c128v3_gen_vec(), decode_auth_info(), encode_auth_info(), milenage_gen_vec(), osmo_auth_3g_from_2g(), tuak_gen_vec(), xor2g_gen_vec(), and xor_gen_vec().

## ◆ autn

uint8_t osmo_auth_vector::autn[16]

authentication nonce

Referenced by decode_auth_info(), encode_auth_info(), milenage_gen_vec(), oap_evaluate_challenge(), tuak_gen_vec(), and xor_gen_vec().

## ◆ c128v1_alg

struct osmo_auth_impl c128v1_alg
| static

Initial value:
= {
.algo = OSMO_AUTH_ALG_COMP128v1,
.name = "COMP128v1 (libosmogsm built-in)",
.priority = 1000,
.gen_vec = &c128v1_gen_vec,
}
c128v1_gen_vec
static int c128v1_gen_vec(struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
Definition: auth_comp128v1.c:29

Referenced by __attribute__().

## ◆ c128v2_alg

struct osmo_auth_impl c128v2_alg
| static

Initial value:
= {
.algo = OSMO_AUTH_ALG_COMP128v2,
.name = "COMP128v2 (libosmogsm built-in)",
.priority = 1000,
.gen_vec = &c128v2_gen_vec,
}
c128v2_gen_vec
static int c128v2_gen_vec(struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
Definition: auth_comp128v23.c:31

Referenced by __attribute__().

## ◆ c128v3_alg

struct osmo_auth_impl c128v3_alg
| static

Initial value:
= {
.algo = OSMO_AUTH_ALG_COMP128v3,
.name = "COMP128v3 (libosmogsm built-in)",
.priority = 1000,
.gen_vec = &c128v3_gen_vec,
}
c128v3_gen_vec
static int c128v3_gen_vec(struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
Definition: auth_comp128v23.c:49

Referenced by __attribute__().

## ◆ ck

uint8_t osmo_auth_vector::ck[OSMO_A5_MAX_KEY_LEN_BYTES]

ciphering key

Referenced by decode_auth_info(), encode_auth_info(), milenage_gen_vec(), osmo_auth_3g_from_2g(), tuak_gen_vec(), and xor_gen_vec().

## ◆ gen_vec

int(* osmo_auth_impl::gen_vec) (struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)

callback for generate authentication vectors

Referenced by osmo_auth_gen_vec2().

## ◆ gen_vec_auts

int(* osmo_auth_impl::gen_vec_auts) (struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *auts, const uint8_t *rand_auts, const uint8_t *_rand)

callback for generating auth vectors + re-sync

Referenced by osmo_auth_gen_vec_auts2().

## ◆ [1/4]

struct { ... } osmo_sub_auth_data2::@125::gsm

## ◆ [2/4]

struct { ... } osmo_sub_auth_data2::gsm

Referenced by auth_data2auth_data2(), c128v1_gen_vec(), c128v2_gen_vec(), c128v3_gen_vec(), xor2g_gen_vec(), xor_gen_vec(), and xor_gen_vec_auts().

## ◆ [3/4]

struct { ... } osmo_sub_auth_data::gsm

Referenced by auth_data2auth_data2().

## ◆ [4/4]

struct { ... } osmo_sub_auth_data::@128::gsm

## ◆ ik

uint8_t osmo_auth_vector::ik[OSMO_A5_MAX_KEY_LEN_BYTES]

integrity key

Referenced by decode_auth_info(), encode_auth_info(), milenage_gen_vec(), osmo_auth_3g_from_2g(), tuak_gen_vec(), and xor_gen_vec().

## ◆ [1/4]

unsigned int { ... } ::ind

which IND slot to use an SQN from

## ◆ ind [2/4]

unsigned int osmo_sub_auth_data2::ind

which IND slot to use an SQN from

Referenced by auth_data2auth_data2(), milenage_gen_vec(), and tuak_gen_vec().

## ◆ [3/4]

unsigned int { ... } ::ind

which IND slot to use an SQN from

## ◆ ind [4/4]

unsigned int osmo_sub_auth_data::ind

which IND slot to use an SQN from

Referenced by auth_data2auth_data2().

## ◆ [1/4]

unsigned int { ... } ::ind_bitlen

nr of bits not in SEQ, only SQN

## ◆ ind_bitlen [2/4]

unsigned int osmo_sub_auth_data2::ind_bitlen

nr of bits not in SEQ, only SQN

Referenced by auth_data2auth_data2(), milenage_gen_vec(), and tuak_gen_vec().

## ◆ [3/4]

unsigned int { ... } ::ind_bitlen

nr of bits not in SEQ, only SQN

## ◆ ind_bitlen [4/4]

unsigned int osmo_sub_auth_data::ind_bitlen

nr of bits not in SEQ, only SQN

Referenced by auth_data2auth_data2().

## ◆ k [1/4]

uint8_t osmo_sub_auth_data2::k[32]

secret key of the subscriber

Referenced by auth_data2auth_data2(), gen_opc_if_needed(), milenage_gen_vec(), milenage_gen_vec_auts(), tuak_gen_vec(), tuak_gen_vec_auts(), xor_gen_vec(), and xor_gen_vec_auts().

## ◆ [2/4]

uint8_t { ... } ::k[32]

secret key of the subscriber

## ◆ k [3/4]

uint8_t osmo_sub_auth_data::k[OSMO_A5_MAX_KEY_LEN_BYTES]

secret key of the subscriber

Referenced by auth_data2auth_data2(), and oap_evaluate_challenge().

## ◆ [4/4]

uint8_t { ... } ::k[OSMO_A5_MAX_KEY_LEN_BYTES]

secret key of the subscriber

## ◆ [1/2]

uint8_t { ... } ::k_len

K length (in bytes): 16 or 32.

## ◆ k_len [2/2]

uint8_t osmo_sub_auth_data2::k_len

K length (in bytes): 16 or 32.

Referenced by auth_data2auth_data2(), gen_opc_if_needed(), milenage_gen_vec(), milenage_gen_vec_auts(), tuak_gen_vec(), tuak_gen_vec_auts(), xor_gen_vec(), and xor_gen_vec_auts().

## ◆ kc

uint8_t osmo_auth_vector::kc[8]

Kc for GSM encryption (A5)

Referenced by c128v1_gen_vec(), c128v2_gen_vec(), c128v3_gen_vec(), decode_auth_info(), encode_auth_info(), milenage_gen_vec(), osmo_auth_3g_from_2g(), tuak_gen_vec(), xor2g_gen_vec(), and xor_gen_vec().

## ◆ ki [1/4]

uint8_t osmo_sub_auth_data2::ki[OSMO_A5_MAX_KEY_LEN_BYTES]

secret key

Referenced by auth_data2auth_data2(), c128v1_gen_vec(), c128v2_gen_vec(), c128v3_gen_vec(), xor2g_gen_vec(), xor_gen_vec(), and xor_gen_vec_auts().

## ◆ [2/4]

uint8_t { ... } ::ki[OSMO_A5_MAX_KEY_LEN_BYTES]

secret key

## ◆ [3/4]

uint8_t { ... } ::ki[OSMO_A5_MAX_KEY_LEN_BYTES]

secret key

## ◆ ki [4/4]

uint8_t osmo_sub_auth_data::ki[OSMO_A5_MAX_KEY_LEN_BYTES]

secret key

Referenced by auth_data2auth_data2().

## ◆ list

struct llist_head osmo_auth_impl::list

Referenced by osmo_auth_register().

## ◆ milenage_alg

struct osmo_auth_impl milenage_alg
| static

Initial value:
= {
.algo = OSMO_AUTH_ALG_MILENAGE,
.name = "MILENAGE (libosmogsm built-in)",
.priority = 1000,
.gen_vec = &milenage_gen_vec,
.gen_vec_auts = &milenage_gen_vec_auts,
}
milenage_gen_vec_auts
static int milenage_gen_vec_auts(struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *auts, const uint8_t *rand_auts, const uint8_t *_rand)
Definition: auth_milenage.c:151
milenage_gen_vec
static int milenage_gen_vec(struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
Definition: auth_milenage.c:46

Referenced by __attribute__().

## ◆ name

const char* osmo_auth_impl::name

name of the implementation

## ◆ [1/4]

uint8_t { ... } ::opc[16]

operator invariant value

## ◆ opc [2/4]

uint8_t osmo_sub_auth_data::opc[16]

operator invariant value

Referenced by auth_data2auth_data2(), and oap_evaluate_challenge().

## ◆ [3/4]

uint8_t { ... } ::opc[32]

operator invariant value

## ◆ opc [4/4]

uint8_t osmo_sub_auth_data2::opc[32]

operator invariant value

Referenced by auth_data2auth_data2(), and gen_opc_if_needed().

## ◆ [1/4]

int { ... } ::opc_is_op

is the OPC field OPC (0) or OP (1) ?

## ◆ opc_is_op [2/4]

int osmo_sub_auth_data2::opc_is_op

is the OPC field OPC (0) or OP (1) ?

Referenced by auth_data2auth_data2(), and gen_opc_if_needed().

## ◆ [3/4]

int { ... } ::opc_is_op

is the OPC field OPC (0) or OP (1) ?

## ◆ opc_is_op [4/4]

int osmo_sub_auth_data::opc_is_op

is the OPC field OPC (0) or OP (1) ?

Referenced by auth_data2auth_data2().

## ◆ [1/2]

uint8_t { ... } ::opc_len

OPc length (in bytes): 16 or 32.

## ◆ opc_len [2/2]

uint8_t osmo_sub_auth_data2::opc_len

OPc length (in bytes): 16 or 32.

Referenced by auth_data2auth_data2(), milenage_gen_vec(), milenage_gen_vec_auts(), tuak_gen_vec(), and tuak_gen_vec_auts().

## ◆ osmo_sub_auth_type_names [1/2]

const struct value_string osmo_sub_auth_type_names[]
| extern

Referenced by osmo_sub_auth_type_name().

## ◆ osmo_sub_auth_type_names [2/2]

const struct value_string osmo_sub_auth_type_names[]

Initial value:
= {
{ OSMO_AUTH_TYPE_NONE, "None" },
{ OSMO_AUTH_TYPE_GSM, "GSM" },
{ OSMO_AUTH_TYPE_UMTS, "UMTS" },
{ 0, NULL }
}
OSMO_AUTH_TYPE_UMTS
@ OSMO_AUTH_TYPE_UMTS
Definition: auth.h:19
OSMO_AUTH_TYPE_GSM
@ OSMO_AUTH_TYPE_GSM
Definition: auth.h:18
OSMO_AUTH_TYPE_NONE
@ OSMO_AUTH_TYPE_NONE
Definition: auth.h:17

Referenced by osmo_sub_auth_type_name().

## ◆ priority

unsigned int osmo_auth_impl::priority

priority value (resp.

othe implementations

Referenced by osmo_auth_register().

## ◆ rand

uint8_t osmo_auth_vector::rand[16]

random challenge

Referenced by decode_auth_info(), encode_auth_info(), osmo_auth_gen_vec2(), and osmo_auth_gen_vec_auts2().

## ◆ res

uint8_t osmo_auth_vector::res[16]

authentication result

Referenced by decode_auth_info(), encode_auth_info(), milenage_gen_vec(), oap_evaluate_challenge(), tuak_gen_vec(), and xor_gen_vec().

## ◆ res_len

uint8_t osmo_auth_vector::res_len

length (in bytes) of res: 4..16 bytes

Referenced by decode_auth_info(), encode_auth_info(), milenage_gen_vec(), oap_evaluate_challenge(), osmo_auth_gen_vec(), osmo_auth_gen_vec_auts(), tuak_gen_vec(), and xor_gen_vec().

## ◆ selected_auths

struct osmo_auth_impl* selected_auths[_OSMO_AUTH_ALG_NUM]
| static

Referenced by osmo_auth_gen_vec2(), osmo_auth_gen_vec_auts2(), osmo_auth_register(), and osmo_auth_supported().

## ◆ [1/4]

uint64_t { ... } ::sqn

sequence number (in: prev sqn; out: used sqn)

## ◆ sqn [2/4]

uint64_t osmo_sub_auth_data2::sqn

sequence number (in: prev sqn; out: used sqn)

Referenced by auth_data2auth_data2(), milenage_gen_vec(), milenage_gen_vec_auts(), osmo_auth_gen_vec(), osmo_auth_gen_vec_auts(), tuak_gen_vec(), tuak_gen_vec_auts(), xor_gen_vec(), and xor_gen_vec_auts().

## ◆ [3/4]

uint64_t { ... } ::sqn

sequence number (in: prev sqn; out: used sqn)

## ◆ sqn [4/4]

uint64_t osmo_sub_auth_data::sqn

sequence number (in: prev sqn; out: used sqn)

Referenced by auth_data2auth_data2(), oap_evaluate_challenge(), osmo_auth_gen_vec(), and osmo_auth_gen_vec_auts().

## ◆ [1/4]

uint64_t { ... } ::sqn_ms

sqn from AUTS (output value only)

## ◆ sqn_ms [2/4]

uint64_t osmo_sub_auth_data2::sqn_ms

sqn from AUTS (output value only)

Referenced by auth_data2auth_data2(), milenage_gen_vec_auts(), osmo_auth_gen_vec_auts(), tuak_gen_vec_auts(), and xor_gen_vec_auts().

## ◆ [3/4]

uint64_t { ... } ::sqn_ms

sqn from AUTS (output value only)

## ◆ sqn_ms [4/4]

uint64_t osmo_sub_auth_data::sqn_ms

sqn from AUTS (output value only)

Referenced by auth_data2auth_data2(), and osmo_auth_gen_vec_auts().

## ◆ sres

uint8_t osmo_auth_vector::sres[4]

authentication result for GSM

Referenced by c128v1_gen_vec(), c128v2_gen_vec(), c128v3_gen_vec(), decode_auth_info(), encode_auth_info(), milenage_gen_vec(), tuak_gen_vec(), xor2g_gen_vec(), and xor_gen_vec().

## ◆ table0

const uint8_t table0[256]
| static

Initial value:
= {
197, 235, 60, 151, 98, 96, 3, 100, 248, 118, 42, 117, 172, 211, 181, 203, 61,
126, 156, 87, 149, 224, 55, 132, 186, 63, 238, 255, 85, 83, 152, 33, 160,
184, 210, 219, 159, 11, 180, 194, 130, 212, 147, 5, 215, 92, 27, 46, 113,
187, 52, 25, 185, 79, 221, 48, 70, 31, 101, 15, 195, 201, 50, 222, 137,
233, 229, 106, 122, 183, 178, 177, 144, 207, 234, 182, 37, 254, 227, 231, 54,
209, 133, 65, 202, 69, 237, 220, 189, 146, 120, 68, 21, 125, 38, 30, 2,
155, 53, 196, 174, 176, 51, 246, 167, 76, 110, 20, 82, 121, 103, 112, 56,
173, 49, 217, 252, 0, 114, 228, 123, 12, 93, 161, 253, 232, 240, 175, 67,
128, 22, 158, 89, 18, 77, 109, 190, 17, 62, 4, 153, 163, 59, 145, 138,
7, 74, 205, 10, 162, 80, 45, 104, 111, 150, 214, 154, 28, 191, 169, 213,
88, 193, 198, 200, 245, 39, 164, 124, 84, 78, 1, 188, 170, 23, 86, 226,
141, 32, 6, 131, 127, 199, 40, 135, 16, 57, 71, 91, 225, 168, 242, 206,
97, 166, 44, 14, 90, 236, 239, 230, 244, 223, 108, 102, 119, 148, 251, 29,
216, 8, 9, 249, 208, 24, 105, 94, 34, 64, 95, 115, 72, 134, 204, 43,
247, 243, 218, 47, 58, 73, 107, 241, 179, 116, 66, 36, 143, 81, 250, 139,
19, 13, 142, 140, 129, 192, 99, 171, 157, 136, 41, 75, 35, 165, 26
}

Referenced by _comp128v23_internal().

## ◆ table1

const uint8_t table1[256]
| static

Initial value:
= {
170, 42, 95, 141, 109, 30, 71, 89, 26, 147, 231, 205, 239, 212, 124, 129, 216,
79, 15, 185, 153, 14, 251, 162, 0, 241, 172, 197, 43, 10, 194, 235, 6,
20, 72, 45, 143, 104, 161, 119, 41, 136, 38, 189, 135, 25, 93, 18, 224,
171, 252, 195, 63, 19, 58, 165, 23, 55, 133, 254, 214, 144, 220, 178, 156,
52, 110, 225, 97, 183, 140, 39, 53, 88, 219, 167, 16, 198, 62, 222, 76,
139, 175, 94, 51, 134, 115, 22, 67, 1, 249, 217, 3, 5, 232, 138, 31,
56, 116, 163, 70, 128, 234, 132, 229, 184, 244, 13, 34, 73, 233, 154, 179,
131, 215, 236, 142, 223, 27, 57, 246, 108, 211, 8, 253, 85, 66, 245, 193,
78, 190, 4, 17, 7, 150, 127, 152, 213, 37, 186, 2, 243, 46, 169, 68,
101, 60, 174, 208, 158, 176, 69, 238, 191, 90, 83, 166, 125, 77, 59, 21,
92, 49, 151, 168, 99, 9, 50, 146, 113, 117, 228, 65, 230, 40, 82, 54,
237, 227, 102, 28, 36, 107, 24, 44, 126, 206, 201, 61, 114, 164, 207, 181,
29, 91, 64, 221, 255, 48, 155, 192, 111, 180, 210, 182, 247, 203, 148, 209,
98, 173, 11, 75, 123, 250, 118, 32, 47, 240, 202, 74, 177, 100, 80, 196,
33, 248, 86, 157, 137, 120, 130, 84, 204, 122, 81, 242, 188, 200, 149, 226,
218, 160, 187, 106, 35, 87, 105, 96, 145, 199, 159, 12, 121, 103, 112
}

Referenced by _comp128v23_internal().

## ◆ table_0

const uint8_t table_0[512]
| static

## ◆ table_1

const uint8_t table_1[256]
| static

Initial value:
= {
19, 11, 80, 114, 43, 1, 69, 94, 39, 18, 127, 117, 97, 3, 85, 43,
27, 124, 70, 83, 47, 71, 63, 10, 47, 89, 79, 4, 14, 59, 11, 5,
35, 107, 103, 68, 21, 86, 36, 91, 85, 126, 32, 50, 109, 94, 120, 6,
53, 79, 28, 45, 99, 95, 41, 34, 88, 68, 93, 55, 110, 125, 105, 20,
90, 80, 76, 96, 23, 60, 89, 64, 121, 56, 14, 74, 101, 8, 19, 78,
76, 66, 104, 46, 111, 50, 32, 3, 39, 0, 58, 25, 92, 22, 18, 51,
57, 65, 119, 116, 22, 109, 7, 86, 59, 93, 62, 110, 78, 99, 77, 67,
12, 113, 87, 98, 102, 5, 88, 33, 38, 56, 23, 8, 75, 45, 13, 75,
95, 63, 28, 49, 123, 120, 20, 112, 44, 30, 15, 98, 106, 2, 103, 29,
82, 107, 42, 124, 24, 30, 41, 16, 108, 100, 117, 40, 73, 40, 7, 114,
82, 115, 36, 112, 12, 102, 100, 84, 92, 48, 72, 97, 9, 54, 55, 74,
113, 123, 17, 26, 53, 58, 4, 9, 69, 122, 21, 118, 42, 60, 27, 73,
118, 125, 34, 15, 65, 115, 84, 64, 62, 81, 70, 1, 24, 111, 121, 83,
104, 81, 49, 127, 48, 105, 31, 10, 6, 91, 87, 37, 16, 54, 116, 126,
31, 38, 13, 0, 72, 106, 77, 61, 26, 67, 46, 29, 96, 37, 61, 52,
101, 17, 44, 108, 71, 52, 66, 57, 33, 51, 25, 90, 2, 119, 122, 35,
}

## ◆ table_2

const uint8_t table_2[128]
| static

Initial value:
= {
52, 50, 44, 6, 21, 49, 41, 59, 39, 51, 25, 32, 51, 47, 52, 43,
37, 4, 40, 34, 61, 12, 28, 4, 58, 23, 8, 15, 12, 22, 9, 18,
55, 10, 33, 35, 50, 1, 43, 3, 57, 13, 62, 14, 7, 42, 44, 59,
62, 57, 27, 6, 8, 31, 26, 54, 41, 22, 45, 20, 39, 3, 16, 56,
48, 2, 21, 28, 36, 42, 60, 33, 34, 18, 0, 11, 24, 10, 17, 61,
29, 14, 45, 26, 55, 46, 11, 17, 54, 46, 9, 24, 30, 60, 32, 0,
20, 38, 2, 30, 58, 35, 1, 16, 56, 40, 23, 48, 13, 19, 19, 27,
31, 53, 47, 38, 63, 15, 49, 5, 37, 53, 25, 36, 63, 29, 5, 7,
}

## ◆ table_3

const uint8_t table_3[64]
| static

Initial value:
= {
1, 5, 29, 6, 25, 1, 18, 23, 17, 19, 0, 9, 24, 25, 6, 31,
28, 20, 24, 30, 4, 27, 3, 13, 15, 16, 14, 18, 4, 3, 8, 9,
20, 0, 12, 26, 21, 8, 28, 2, 29, 2, 15, 7, 11, 22, 14, 10,
17, 21, 12, 30, 26, 27, 16, 31, 11, 7, 13, 23, 10, 5, 22, 19,
}

## ◆ table_4

const uint8_t table_4[32]
| static

Initial value:
= {
15, 12, 10, 4, 1, 14, 11, 7, 5, 0, 14, 7, 1, 2, 13, 8,
10, 3, 4, 9, 6, 0, 3, 2, 5, 6, 8, 9, 11, 13, 15, 12,
}

## ◆ tuak_alg

struct osmo_auth_impl tuak_alg
| static

Initial value:
= {
.algo = OSMO_AUTH_ALG_TUAK,
.name = "TUAK (libosmogsm built-in)",
.priority = 1000,
.gen_vec = &tuak_gen_vec,
.gen_vec_auts = &tuak_gen_vec_auts,
}
tuak_gen_vec
static int tuak_gen_vec(struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
Definition: auth_tuak.c:50
tuak_gen_vec_auts
static int tuak_gen_vec_auts(struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *auts, const uint8_t *rand_auts, const uint8_t *_rand)
Definition: auth_tuak.c:163

Referenced by __attribute__().

## ◆ type [1/2]

enum osmo_sub_auth_type osmo_sub_auth_data2::type

Referenced by auth_data2auth_data2(), gen_opc_if_needed(), xor2g_gen_vec(), xor_gen_vec(), and xor_gen_vec_auts().

## ◆ type [2/2]

enum osmo_sub_auth_type osmo_sub_auth_data::type

Referenced by auth_data2auth_data2(), oap_evaluate_challenge(), osmo_auth_gen_vec(), and osmo_auth_gen_vec_auts().

## ◆ [1/2]

union { ... } osmo_sub_auth_data2::u

Referenced by auth_data2auth_data2(), c128v1_gen_vec(), c128v2_gen_vec(), c128v3_gen_vec(), gen_opc_if_needed(), milenage_gen_vec(), milenage_gen_vec_auts(), osmo_auth_gen_vec(), osmo_auth_gen_vec_auts(), tuak_gen_vec(), tuak_gen_vec_auts(), xor2g_gen_vec(), xor_gen_vec(), and xor_gen_vec_auts().

## ◆ [2/2]

union { ... } osmo_sub_auth_data::u

Referenced by auth_data2auth_data2(), oap_evaluate_challenge(), osmo_auth_gen_vec(), and osmo_auth_gen_vec_auts().

## ◆ [1/4]

struct { ... } osmo_sub_auth_data2::@125::umts

## ◆ [2/4]

struct { ... } osmo_sub_auth_data2::umts

Referenced by auth_data2auth_data2(), gen_opc_if_needed(), milenage_gen_vec(), milenage_gen_vec_auts(), osmo_auth_gen_vec(), osmo_auth_gen_vec_auts(), tuak_gen_vec(), tuak_gen_vec_auts(), xor_gen_vec(), and xor_gen_vec_auts().

## ◆ [3/4]

struct { ... } osmo_sub_auth_data::@128::umts

## ◆ [4/4]

struct { ... } osmo_sub_auth_data::umts

Referenced by auth_data2auth_data2(), oap_evaluate_challenge(), osmo_auth_gen_vec(), and osmo_auth_gen_vec_auts().

## ◆ xor2g_alg

struct osmo_auth_impl xor2g_alg
| static

Initial value:
= {
.algo = OSMO_AUTH_ALG_XOR_2G,
.name = "XOR-2G (libosmogsm built-in)",
.priority = 1000,
.gen_vec = &xor2g_gen_vec,
}
xor2g_gen_vec
static int xor2g_gen_vec(struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
Definition: auth_xor_2g.c:45

Referenced by __attribute__().

## ◆ xor_alg

struct osmo_auth_impl xor_alg
| static

Initial value:
= {
.algo = OSMO_AUTH_ALG_XOR_3G,
.name = "XOR-3G (libosmogsm built-in)",
.priority = 1000,
.gen_vec = &xor_gen_vec,
.gen_vec_auts = &xor_gen_vec_auts,
}
xor_gen_vec_auts
static int xor_gen_vec_auts(struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *auts, const uint8_t *rand_auts, const uint8_t *_rand)
Definition: auth_xor.c:131
xor_gen_vec
static int xor_gen_vec(struct osmo_auth_vector *vec, struct osmo_sub_auth_data2 *aud, const uint8_t *_rand)
Definition: auth_xor.c:45

Referenced by __attribute__().