The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
EAP-SIM/EAP-AKA identity detection, creation, and decyption. More...
#include <sys/types.h>
#include <freeradius-devel/util/token.h>
Go to the source code of this file.
Macros | |
#define | AKA_SIM_3GPP_PSEUDONYM_LEN 23U |
Length of a base64 encoded 3gpp pseudonym. More... | |
#define | AKA_SIM_IMSI_MAX_LEN 15U |
Length of an IMSI number in ASCII. More... | |
#define | AKA_SIM_IMSI_MIN_LEN 14U |
Minimum length of an IMSI number in ASCII. More... | |
#define | ID_TAG_AKA_FASTAUTH_B64 56 |
#define | ID_TAG_AKA_PRIME_FASTAUTH_B64 60 |
#define | ID_TAG_AKA_PRIME_PSEUDONYM_B64 59 |
#define | ID_TAG_AKA_PSEUDONYM_B64 54 |
#define | ID_TAG_SIM_FASTAUTH_B64 57 |
#define | ID_TAG_SIM_PSEUDONYM_B64 55 |
Enumerations | |
enum | fr_aka_sim_id_req_type_t { AKA_SIM_INIT_ID_REQ = 0 , AKA_SIM_NO_ID_REQ , AKA_SIM_ANY_ID_REQ , AKA_SIM_FULLAUTH_ID_REQ , AKA_SIM_PERMANENT_ID_REQ } |
Identity request types. More... | |
enum | fr_aka_sim_id_tag_t { ID_TAG_SIM_PERMANENT = '1' , ID_TAG_SIM_PSEUDONYM = '3' , ID_TAG_SIM_FASTAUTH = '5' , ID_TAG_AKA_PERMANENT = '0' , ID_TAG_AKA_PSEUDONYM = '2' , ID_TAG_AKA_FASTAUTH = '4' , ID_TAG_AKA_PRIME_PERMANENT = '6' , ID_TAG_AKA_PRIME_PSEUDONYM = '7' , ID_TAG_AKA_PRIME_FASTAUTH = '8' } |
enum | fr_aka_sim_id_type_t { AKA_SIM_ID_TYPE_UNKNOWN = 0 , AKA_SIM_ID_TYPE_PERMANENT , AKA_SIM_ID_TYPE_PSEUDONYM , AKA_SIM_ID_TYPE_FASTAUTH , AKA_SIM_ID_TYPE_MAX } |
SIM/AKA identity type hints. More... | |
enum | fr_aka_sim_method_hint_t { AKA_SIM_METHOD_HINT_UNKNOWN = 0 , AKA_SIM_METHOD_HINT_SIM , AKA_SIM_METHOD_HINT_AKA , AKA_SIM_METHOD_HINT_AKA_PRIME , AKA_SIM_METHOD_HINT_MAX } |
SIM/AKA method hints. More... | |
Functions | |
ssize_t | fr_aka_sim_3gpp_root_nai_domain_mcc_mnc (uint16_t *mnc, uint16_t *mcc, char const *domain, size_t domain_len) |
Extract the MCC and MCN from the 3GPP domain. More... | |
char const * | fr_aka_sim_domain (char const *nai, size_t nai_len) |
Find where in the NAI string the domain starts. More... | |
char | fr_aka_sim_hint_byte (fr_aka_sim_id_type_t type, fr_aka_sim_method_hint_t method) |
Return the expected identity hint for a given type/method combination. More... | |
int | fr_aka_sim_id_3gpp_pseudonym_decrypt (char out[AKA_SIM_IMSI_MAX_LEN+1], char const encr_id[AKA_SIM_3GPP_PSEUDONYM_LEN], uint8_t const key[16]) |
Decrypt the 3GPP pseudonym. More... | |
int | fr_aka_sim_id_3gpp_pseudonym_encrypt (char out[AKA_SIM_3GPP_PSEUDONYM_LEN+1], char const *imsi, size_t imsi_len, uint8_t tag, uint8_t key_ind, uint8_t const key[16]) |
Create a 3gpp pseudonym from a permanent ID. More... | |
uint8_t | fr_aka_sim_id_3gpp_pseudonym_key_index (char const encr_id[AKA_SIM_3GPP_PSEUDONYM_LEN]) |
Return the key index from a 3gpp pseudonym. More... | |
uint8_t | fr_aka_sim_id_3gpp_pseudonym_tag (char const encr_id[AKA_SIM_3GPP_PSEUDONYM_LEN]) |
Return the tag from a 3gpp pseudonym. More... | |
eap_type_t | fr_aka_sim_id_to_eap_type (char const *id, size_t len) |
Determine if a given identity is a 3gpp identity, and return the EAP method hinted. More... | |
int | fr_aka_sim_id_type (fr_aka_sim_id_type_t *type, fr_aka_sim_method_hint_t *hint, char const *id, size_t id_len) |
Determine what type of ID was provided in the initial identity response. More... | |
size_t | fr_aka_sim_id_user_len (char const *nai, size_t nai_len) |
Find where the identity ends. More... | |
EAP-SIM/EAP-AKA identity detection, creation, and decyption.
Definition in file id.h.
#define AKA_SIM_3GPP_PSEUDONYM_LEN 23U |
#define AKA_SIM_IMSI_MAX_LEN 15U |
#define AKA_SIM_IMSI_MIN_LEN 14U |
Identity request types.
enum fr_aka_sim_id_tag_t |
enum fr_aka_sim_id_type_t |
SIM/AKA identity type hints.
Derived from the processing the provided identity.
SIM/AKA method hints.
Derived from processing the provided identity.
ssize_t fr_aka_sim_3gpp_root_nai_domain_mcc_mnc | ( | uint16_t * | mnc, |
uint16_t * | mcc, | ||
char const * | domain, | ||
size_t | domain_len | ||
) |
Extract the MCC and MCN from the 3GPP domain.
3GPP Root NAI domain format wlan.mnc<MNC>.mcc<MCC>.3gppnetwork.org.
[out] | mnc | Mobile network code. |
[out] | mcc | Mobile country code. |
[in] | domain | to parse. |
[in] | domain_len | Length of the domain component. |
Definition at line 97 of file id.c.
char const* fr_aka_sim_domain | ( | char const * | nai, |
size_t | nai_len | ||
) |
Find where in the NAI string the domain starts.
[in] | nai | we're attempting to split. |
[in] | nai_len | The length of the NAI string. |
Definition at line 75 of file id.c.
char fr_aka_sim_hint_byte | ( | fr_aka_sim_id_type_t | type, |
fr_aka_sim_method_hint_t | method | ||
) |
Return the expected identity hint for a given type/method combination.
[in] | type | Whether this is a permanent, pseudonym or fastauth ID |
[in] | method | What EAP-Method the identity hints at. |
Definition at line 375 of file id.c.
int fr_aka_sim_id_3gpp_pseudonym_decrypt | ( | char | out[AKA_SIM_IMSI_MAX_LEN+1], |
char const | encr_id[AKA_SIM_3GPP_PSEUDONYM_LEN], | ||
uint8_t const | key[16] | ||
) |
Decrypt the 3GPP pseudonym.
[out] | out | Where to write the decypted, uncompressed IMSI. |
[in] | encr_id | to decypt. Will read exactly 23 bytes from the buffer. |
[in] | key | to use to decrypt the encrypted and compressed IMSI. Must be 128 bits (16 bytes). |
Definition at line 576 of file id.c.
int fr_aka_sim_id_3gpp_pseudonym_encrypt | ( | char | out[AKA_SIM_3GPP_PSEUDONYM_LEN+1], |
char const * | imsi, | ||
size_t | imsi_len, | ||
uint8_t | tag, | ||
uint8_t | key_ind, | ||
uint8_t const | key[16] | ||
) |
Create a 3gpp pseudonym from a permanent ID.
[out] | out | Where to write the resulting pseudonym, must be a buffer of exactly AKA_SIM_3GPP_PSEUDONYM_LEN + 1 bytes. |
[in] | imsi | Permanent ID to derive pseudonym from. Note: If the IMSI is less than 15 digits it will be rpadded with zeros. |
[in] | imsi_len | Length of the IMSI. Must be between 1-15. |
[in] | tag | Tag value to prepend to the pseudonym. This field is 6 bits (0-63). |
[in] | key_ind | Key indicator (or key index), the key number used to produce the encr ID. There may be up to 16 keys in use at any one time. This field is 4 bits (0-15). |
[in] | key | as described by the 'Security aspects of non-3GPP accesses' document. Must be 128 bits (16 bytes). |
Definition at line 397 of file id.c.
uint8_t fr_aka_sim_id_3gpp_pseudonym_key_index | ( | char const | encr_id[AKA_SIM_3GPP_PSEUDONYM_LEN] | ) |
uint8_t fr_aka_sim_id_3gpp_pseudonym_tag | ( | char const | encr_id[AKA_SIM_3GPP_PSEUDONYM_LEN] | ) |
eap_type_t fr_aka_sim_id_to_eap_type | ( | char const * | id, |
size_t | len | ||
) |
Determine if a given identity is a 3gpp identity, and return the EAP method hinted.
[in] | id | to check. |
[in] | len | Length of the id. |
Definition at line 306 of file id.c.
int fr_aka_sim_id_type | ( | fr_aka_sim_id_type_t * | type, |
fr_aka_sim_method_hint_t * | hint, | ||
char const * | id, | ||
size_t | id_len | ||
) |
Determine what type of ID was provided in the initial identity response.
[out] | hint | Whether this is a hint to do EAP-SIM or EAP-AKA[']:
|
[out] | type | What type of identity this is:
|
[in] | id | the NAI string provided. |
[in] | id_len | the length of the NAI string. |
Definition at line 167 of file id.c.
|
extern |
|
extern |