The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
EAP-SIM/EAP-AKA identity detection, creation, and decyption. More...
#include <freeradius-devel/tls/strerror.h>
#include <freeradius-devel/util/base64.h>
#include <freeradius-devel/util/rand.h>
#include <openssl/evp.h>
#include "base.h"
#include "id.h"
#include "crypto_priv.h"
Go to the source code of this file.
Macros | |
#define | us(x) (uint8_t) x |
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. | |
char const * | fr_aka_sim_domain (char const *nai, size_t nai_len) |
Find where in the NAI string the domain starts. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
size_t | fr_aka_sim_id_user_len (char const *nai, size_t nai_len) |
Find where the identity ends. | |
EAP-SIM/EAP-AKA identity detection, creation, and decyption.
Definition in file id.c.
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.
fr_table_num_sorted_t const fr_aka_sim_id_method_table[] |
size_t fr_aka_sim_id_method_table_len = NUM_ELEMENTS(fr_aka_sim_id_method_table) |
fr_table_num_sorted_t const fr_aka_sim_id_request_table[] |
size_t fr_aka_sim_id_request_table_len = NUM_ELEMENTS(fr_aka_sim_id_request_table) |
|
static |