The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
3GPP AKA - Milenage algorithm (3GPP TS 35.205, .206, .207, .208) More...
#include <stddef.h>
Go to the source code of this file.
Macros | |
#define | MILENAGE_AK_SIZE 6 |
Anonymisation key. More... | |
#define | MILENAGE_AMF_SIZE 2 |
Authentication management field. More... | |
#define | MILENAGE_AUTN_SIZE 16 |
Network authentication key. More... | |
#define | MILENAGE_AUTS_SIZE 14 |
#define | MILENAGE_CK_SIZE 16 |
Ciphering key. More... | |
#define | MILENAGE_IK_SIZE 16 |
Integrity key. More... | |
#define | MILENAGE_KC_SIZE 8 |
#define | MILENAGE_KI_SIZE 16 |
Subscriber key. More... | |
#define | MILENAGE_OP_SIZE 16 |
Operator code (unique to the operator) More... | |
#define | MILENAGE_OPC_SIZE 16 |
Derived operator code (unique to the operator and subscriber). More... | |
#define | MILENAGE_RAND_SIZE 16 |
Random challenge. More... | |
#define | MILENAGE_RES_SIZE 8 |
#define | MILENAGE_SQN_SIZE 6 |
Sequence number. More... | |
#define | MILENAGE_SRES_SIZE 4 |
3GPP AKA - Milenage algorithm (3GPP TS 35.205, .206, .207, .208)
This file implements an example authentication algorithm defined for 3GPP AKA. This can be used to implement a simple HLR/AuC into hlr_auc_gw to allow EAP-AKA to be tested properly with real USIM cards.
This implementations assumes that the r1..r5 and c1..c5 constants defined in TS 35.206 are used, i.e., r1=64, r2=0, r3=32, r4=64, r5=96, c1=00..00, c2=00..01, c3=00..02, c4=00..04, c5=00..08. The block cipher is assumed to be AES (Rijndael).
This software may be distributed under the terms of the BSD license. See README for more details.
Definition in file milenage.h.
#define MILENAGE_AK_SIZE 6 |
Anonymisation key.
Definition at line 36 of file milenage.h.
#define MILENAGE_AMF_SIZE 2 |
Authentication management field.
Definition at line 29 of file milenage.h.
#define MILENAGE_AUTN_SIZE 16 |
Network authentication key.
Definition at line 37 of file milenage.h.
#define MILENAGE_AUTS_SIZE 14 |
Definition at line 41 of file milenage.h.
#define MILENAGE_CK_SIZE 16 |
Ciphering key.
Definition at line 39 of file milenage.h.
#define MILENAGE_IK_SIZE 16 |
Integrity key.
Definition at line 38 of file milenage.h.
#define MILENAGE_KC_SIZE 8 |
Definition at line 47 of file milenage.h.
#define MILENAGE_KI_SIZE 16 |
Subscriber key.
Definition at line 26 of file milenage.h.
#define MILENAGE_OP_SIZE 16 |
Operator code (unique to the operator)
Definition at line 27 of file milenage.h.
#define MILENAGE_OPC_SIZE 16 |
Derived operator code (unique to the operator and subscriber).
Definition at line 28 of file milenage.h.
#define MILENAGE_RAND_SIZE 16 |
Random challenge.
Definition at line 31 of file milenage.h.
#define MILENAGE_RES_SIZE 8 |
Definition at line 40 of file milenage.h.
#define MILENAGE_SQN_SIZE 6 |
Sequence number.
Definition at line 30 of file milenage.h.
#define MILENAGE_SRES_SIZE 4 |
Definition at line 46 of file milenage.h.
int milenage_auts | ( | uint64_t * | sqn, |
uint8_t const | opc[MILENAGE_OPC_SIZE], | ||
uint8_t const | ki[MILENAGE_KI_SIZE], | ||
uint8_t const | rand[MILENAGE_RAND_SIZE], | ||
uint8_t const | auts[MILENAGE_AUTS_SIZE] | ||
) |
Milenage AUTS validation.
[out] | sqn | SQN = 48-bit sequence number (host byte order). |
[in] | opc | 128-bit operator variant algorithm configuration field (encr.). |
[in] | ki | 128-bit subscriber key. |
[in] | rand | 128-bit random challenge. |
[in] | auts | 112-bit authentication token from client. |
Definition at line 329 of file milenage.c.
int milenage_check | ( | uint8_t | ik[MILENAGE_IK_SIZE], |
uint8_t | ck[MILENAGE_CK_SIZE], | ||
uint8_t | res[MILENAGE_RES_SIZE], | ||
uint8_t | auts[MILENAGE_AUTS_SIZE], | ||
uint8_t const | opc[MILENAGE_OPC_SIZE], | ||
uint8_t const | ki[MILENAGE_KI_SIZE], | ||
uint64_t | sqn, | ||
uint8_t const | rand[MILENAGE_RAND_SIZE], | ||
uint8_t const | autn[MILENAGE_AUTN_SIZE] | ||
) |
Milenage check.
[out] | ik | Buffer for IK = 128-bit integrity key (f4), or NULL. |
[out] | ck | Buffer for CK = 128-bit confidentiality key (f3), or NULL. |
[out] | res | Buffer for RES = 64-bit signed response (f2), or NULL. |
[in] | auts | 112-bit buffer for AUTS. |
[in] | opc | 128-bit operator variant algorithm configuration field (encr.). |
[in] | ki | 128-bit subscriber key. |
[in] | sqn | 48-bit sequence number. |
[in] | rand | 128-bit random challenge. |
[in] | autn | 128-bit authentication token. |
Definition at line 417 of file milenage.c.
void milenage_gsm_from_umts | ( | uint8_t | sres[MILENAGE_SRES_SIZE], |
uint8_t | kc[MILENAGE_KC_SIZE], | ||
uint8_t const | ik[MILENAGE_IK_SIZE], | ||
uint8_t const | ck[MILENAGE_CK_SIZE], | ||
uint8_t const | res[MILENAGE_RES_SIZE] | ||
) |
Generate GSM-Milenage (3GPP TS 55.205) authentication triplet from a quintuplet.
[out] | sres | Buffer for SRES = 32-bit SRES. |
[out] | kc | 64-bit Kc. |
[in] | ik | 128-bit integrity. |
[in] | ck | Confidentiality key. |
[in] | res | 64-bit signed response. |
Definition at line 358 of file milenage.c.
int milenage_gsm_generate | ( | uint8_t | sres[MILENAGE_SRES_SIZE], |
uint8_t | kc[MILENAGE_KC_SIZE], | ||
uint8_t const | opc[MILENAGE_OPC_SIZE], | ||
uint8_t const | ki[MILENAGE_KI_SIZE], | ||
uint8_t const | rand[MILENAGE_RAND_SIZE] | ||
) |
Generate GSM-Milenage (3GPP TS 55.205) authentication triplet.
[out] | sres | Buffer for SRES = 32-bit SRES. |
[out] | kc | 64-bit Kc. |
[in] | opc | 128-bit operator variant algorithm configuration field (encr.). |
[in] | ki | 128-bit subscriber key. |
[in] | rand | 128-bit random challenge. |
Definition at line 386 of file milenage.c.
int milenage_opc_generate | ( | uint8_t | opc[MILENAGE_OPC_SIZE], |
uint8_t const | op[MILENAGE_OP_SIZE], | ||
uint8_t const | ki[MILENAGE_KI_SIZE] | ||
) |
Derive OPc from OP and Ki.
[out] | opc | The derived Operator Code used as an input to other Milenage functions. |
[in] | op | Operator Code. |
[in] | ki | Subscriber key. |
Definition at line 243 of file milenage.c.
int milenage_umts_generate | ( | uint8_t | autn[MILENAGE_AUTN_SIZE], |
uint8_t | ik[MILENAGE_IK_SIZE], | ||
uint8_t | ck[MILENAGE_CK_SIZE], | ||
uint8_t | ak[MILENAGE_AK_SIZE], | ||
uint8_t | res[MILENAGE_RES_SIZE], | ||
uint8_t const | opc[MILENAGE_OPC_SIZE], | ||
uint8_t const | amf[MILENAGE_AMF_SIZE], | ||
uint8_t const | ki[MILENAGE_KI_SIZE], | ||
uint64_t | sqn, | ||
uint8_t const | rand[MILENAGE_RAND_SIZE] | ||
) |
Generate AKA AUTN, IK, CK, RES.
[out] | autn | Buffer for AUTN = 128-bit authentication token. |
[out] | ik | Buffer for IK = 128-bit integrity key (f4), or NULL. |
[out] | ck | Buffer for CK = 128-bit confidentiality key (f3), or NULL. |
[out] | ak | Buffer for AK = 48-bit anonymity key (f5), or NULL |
[out] | res | Buffer for RES = 64-bit signed response (f2), or NULL. |
[in] | opc | 128-bit operator variant algorithm configuration field (encr.). |
[in] | amf | 16-bit authentication management field. |
[in] | ki | 128-bit subscriber key. |
[in] | sqn | 48-bit sequence number (host byte order). |
[in] | rand | 128-bit random challenge. |
Definition at line 282 of file milenage.c.