|  | The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
    | 
Functions common to SIM protocols (EAP-SIM/EAP-AKA/EAP-AKA') More...
#include <assert.h>#include <freeradius-devel/tls/openssl_user_macros.h>#include <openssl/evp.h>#include <freeradius-devel/eap/compose.h>#include <freeradius-devel/eap/types.h>#include "id.h" Include dependency graph for base.h:
 Include dependency graph for base.h: This graph shows which files directly or indirectly include this file:
 This graph shows which files directly or indirectly include this file:Go to the source code of this file.
| Data Structures | |
| struct | fr_aka_sim_attr_flags_t | 
| struct | fr_aka_sim_checkcode_t | 
| Stores our checkcode state.  More... | |
| struct | fr_aka_sim_ctx_t | 
| Encoder/decoder ctx.  More... | |
| struct | fr_aka_sim_keys_t | 
| Master key state struct for all SIMlike EAP protocols.  More... | |
| struct | fr_aka_sim_keys_t.__unnamed16__ | 
| union | fr_aka_sim_keys_t.__unnamed16__.__unnamed18__ | 
| struct | fr_aka_sim_keys_t.__unnamed16__.__unnamed18__.gsm | 
| Input to kdf_0_gsm.  More... | |
| struct | fr_aka_sim_keys_t.__unnamed16__.__unnamed18__.reauth | 
| Input/output from kdf_*_reauth_*.  More... | |
| struct | fr_aka_sim_keys_t.__unnamed16__.__unnamed18__.umts | 
| Input to kdf_*_umts.  More... | |
| struct | fr_aka_sim_keys_t.__unnamed16__.auc | 
| struct | fr_aka_sim_vector_gsm_t | 
| union | fr_aka_sim_vector_gsm_t.__unnamed12__ | 
| union | fr_aka_sim_vector_gsm_t.__unnamed14__ | 
| struct | fr_aka_sim_vector_umts_t | 
| Macros | |
| #define | AKA_PRIME_MK_REAUTH_SIZE 80U | 
| The portion of the MK used for re-auth. | |
| #define | AKA_PRIME_MK_SIZE 208U | 
| #define | AKA_SIM_AUTH_SIZE 16U | 
| #define | AKA_SIM_IV_SIZE 16U | 
| Length of the IV used when processing AT_ENCR. | |
| #define | AKA_SIM_K_RE_SIZE 32U | 
| Reauthentication key size. | |
| #define | AKA_SIM_KI_SIZE 16U | 
| Length of secret data shared between SIM and AuC. | |
| #define | AKA_SIM_MAC_DIGEST_SIZE 16U | 
| Length of MAC used to prevent packet modification. | |
| #define | AKA_SIM_MAC_SIZE 20U | 
| Length of MAC used to prevent packet modification. | |
| #define | AKA_SIM_MAX_STRING_LENGTH 1016U | 
| Maximum size of a SIM/AKA['] string ((4 * 255) - 4). | |
| #define | AKA_SIM_MK_MAX_SIZE 208U | 
| Master key size, 20 for EAP-SIM/EAP-AKA 208 for EAP-AKA'. | |
| #define | AKA_SIM_MK_SIZE 20U | 
| #define | AKA_SIM_NONCE_S_SIZE 16U | 
| Length of re-authentication nonce. | |
| #define | AKA_SIM_OP_SIZE 16U | 
| Length of Operator Algorithm Configuration. | |
| #define | AKA_SIM_OPC_SIZE 16U | 
| Length of modified Operator Algorithm Configuration. | |
| #define | AKA_SIM_SKIPPABLE_MAX 127U | 
| The last non-skippable attribute. | |
| #define | AKA_SIM_SQN_AK_SIZE 6U | 
| #define | AKA_SIM_VECTOR_GSM_KC_SIZE 8U | 
| Length of Kc in GSM triplet. | |
| #define | AKA_SIM_VECTOR_GSM_RAND_SIZE 16U | 
| Length of RAND in GSM triplet. | |
| #define | AKA_SIM_VECTOR_GSM_SRES_SIZE 4U | 
| Length of SRES in GSM triplet. | |
| #define | AKA_SIM_VECTOR_UMTS_AK_SIZE 6U | 
| #define | AKA_SIM_VECTOR_UMTS_AUTN_SIZE 16U | 
| #define | AKA_SIM_VECTOR_UMTS_CK_SIZE 16U | 
| #define | AKA_SIM_VECTOR_UMTS_IK_SIZE 16U | 
| #define | AKA_SIM_VECTOR_UMTS_RAND_SIZE 16U | 
| #define | AKA_SIM_VECTOR_UMTS_XRES_MAX_SIZE 16U | 
| #define | EAP_AKA_AUTH_SIZE 16U | 
| #define | EAP_AKA_AUTS_SIZE 14U | 
| Server sequence number. | |
| #define | EAP_AKA_PRIME_AUTH_SIZE 32U | 
| #define | EAP_AKA_SIM_AUTH_SIZE 16U | 
| #define | EAP_SIM_NONCE_MT_SIZE 16U | 
| Length of challenge from SIM client. | |
| #define | EAP_SIM_VERSION 1U | 
| #define | fr_aka_sim_flag_encrypted(_da) fr_aka_sim_attr_flags(_da)->encrypt | 
| Enumerations | |
| enum | fr_aka_sim_attr_flags_encrypt_t { AKA_SIM_FLAG_ENCRYPT_INVALID = -1 , AKA_SIM_FLAG_ENCRYPT_NONE = 0 , AKA_SIM_FLAG_ENCRYPT_AES_CBC = 1 } | 
| enum | fr_aka_sim_vector_src_t { AKA_SIM_VECTOR_SRC_AUTO , AKA_SIM_VECTOR_SRC_TRIPLETS , AKA_SIM_VECTOR_SRC_QUINTUPLETS , AKA_SIM_VECTOR_SRC_KI , AKA_SIM_VECTOR_SRC_REAUTH } | 
| Where to get EAP-SIM vectors from.  More... | |
| enum | fr_aka_sim_vector_type_t { AKA_SIM_VECTOR_NONE = 0 , AKA_SIM_VECTOR_GSM , AKA_SIM_VECTOR_UMTS , AKA_SIM_VECTOR_UMTS_REAUTH_KDF_0_REAUTH , AKA_SIM_VECTOR_UMTS_REAUTH_KDF_1_REAUTH } | 
| The type of auth vector held by a fr_aka_sim_keys_t.  More... | |
| Functions | |
| static fr_aka_sim_attr_flags_t const * | fr_aka_sim_attr_flags (fr_dict_attr_t const *da) | 
| size_t | fr_aka_sim_attr_len (fr_pair_t const *vp) | 
| Return the on-the-wire length of an attribute value. | |
| ssize_t | fr_aka_sim_crypto_finalise_checkcode (TALLOC_CTX *ctx, uint8_t **out, fr_aka_sim_checkcode_t *checkcode) | 
| Write out the final checkcode value. | |
| int | fr_aka_sim_crypto_gsm_kdf_0 (fr_aka_sim_keys_t *keys) | 
| Key Derivation Function as described in RFC4186 (EAP-SIM) section 7. | |
| int | fr_aka_sim_crypto_init_checkcode (TALLOC_CTX *ctx, fr_aka_sim_checkcode_t **checkcode, EVP_MD const *md) | 
| Initialise checkcode message digest. | |
| int | fr_aka_sim_crypto_kdf_0_reauth (fr_aka_sim_keys_t *keys) | 
| Key Derivation Function (Fast-Reauthentication) as described in RFC4186/7 (EAP-SIM/AKA) section 7. | |
| void | fr_aka_sim_crypto_keys_init_kdf_0_reauth (fr_aka_sim_keys_t *keys, uint8_t const mk[static AKA_SIM_MK_SIZE], uint16_t counter) | 
| Initialise fr_aka_sim_keys_t with EAP-SIM reauthentication data. | |
| void | fr_aka_sim_crypto_keys_init_umts_kdf_1_reauth (fr_aka_sim_keys_t *keys, uint8_t const mk[static AKA_PRIME_MK_REAUTH_SIZE], uint16_t counter) | 
| Initialise fr_aka_sim_keys_t with EAP-AKA['] reauthentication data. | |
| void | fr_aka_sim_crypto_keys_log (request_t *request, fr_aka_sim_keys_t *keys) | 
| Dump the current state of all keys associated with the EAP SIM session. | |
| ssize_t | fr_aka_sim_crypto_sign_packet (uint8_t out[static AKA_SIM_MAC_DIGEST_SIZE], eap_packet_t *eap_packet, bool zero_mac, EVP_MD const *md, uint8_t const *key, size_t const key_len, uint8_t const *hmac_extra, size_t const hmac_extra_len) | 
| Calculate the digest value for a packet. | |
| int | fr_aka_sim_crypto_umts_kdf_0 (fr_aka_sim_keys_t *keys) | 
| Key Derivation Function as described in RFC4187 (EAP-AKA) section 7. | |
| int | fr_aka_sim_crypto_umts_kdf_1 (fr_aka_sim_keys_t *keys) | 
| Key Derivation Function as described in RFC 5448 (EAP-AKA') section 3.3. | |
| int | fr_aka_sim_crypto_umts_kdf_1_reauth (fr_aka_sim_keys_t *keys) | 
| Key Derivation Function (Fast-Reauthentication) as described in RFC 5448 (EAP-AKA') section 3.3. | |
| int | fr_aka_sim_crypto_update_checkcode (fr_aka_sim_checkcode_t *checkcode, eap_packet_t *eap_packet) | 
| Digest a packet, updating the checkcode. | |
| int | fr_aka_sim_decode (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_t const *dict, uint8_t const *data, size_t data_len, fr_aka_sim_ctx_t *decode_ctx) | 
| Decode SIM/AKA/AKA' specific packet data. | |
| ssize_t | fr_aka_sim_decode_pair (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, uint8_t const *data, size_t data_len, void *decode_ctx) | 
| Decode SIM/AKA/AKA' attributes. | |
| ssize_t | fr_aka_sim_encode (request_t *request, fr_pair_list_t *to_encode, void *encode_ctx) | 
| ssize_t | fr_aka_sim_encode_pair (fr_dbuff_t *dbuff, fr_dcursor_t *cursor, void *encode_ctx) | 
| void | fr_aka_sim_fips186_2prf (uint8_t out[static 160], uint8_t mk[static 20]) | 
| Implement the FIPS-186-2 PRF to derive keying material from the MK. | |
| void | fr_aka_sim_free (void) | 
| int | fr_aka_sim_init (void) | 
| size_t | fr_aka_sim_octets_prefix_len (fr_dict_attr_t const *da) | 
| Return the number of bytes before the octets value. | |
| int | fr_aka_sim_umts_resync_from_attrs (uint64_t *new_sqn, request_t *request, fr_pair_t *auts_vp, fr_aka_sim_keys_t *keys) | 
| Perform milenage AUTS validation and resynchronisation. | |
| int | fr_aka_sim_vector_gsm_from_attrs (request_t *request, fr_pair_list_t *vps, int idx, fr_aka_sim_keys_t *keys, fr_aka_sim_vector_src_t *src) | 
| Retrieve GSM triplets from sets of attributes. | |
| int | fr_aka_sim_vector_gsm_umts_kdf_0_reauth_from_attrs (request_t *request, fr_pair_list_t *vps, fr_aka_sim_keys_t *keys) | 
| Populate a fr_aka_sim_keys_t structure from attributes in the session-state list. | |
| int | fr_aka_sim_vector_umts_from_attrs (request_t *request, fr_pair_list_t *vps, fr_aka_sim_keys_t *keys, fr_aka_sim_vector_src_t *src) | 
| Retrieve UMTS quintuplets from sets of attributes. | |
| int | fr_aka_sim_vector_umts_kdf_1_reauth_from_attrs (request_t *request, fr_pair_list_t *vps, fr_aka_sim_keys_t *keys) | 
| Populate a fr_aka_sim_keys_t structure from attributes in the session-state list. | |
| void | fr_aka_sim_vector_umts_reauth_clear (fr_aka_sim_keys_t *keys) | 
| Clear reauth data if reauthentication failed. | |
| int | fr_aka_sim_xlat_func_register (void) | 
| void | fr_aka_sim_xlat_func_unregister (void) | 
| Variables | |
| size_t const | fr_aka_sim_attr_sizes [FR_TYPE_MAX+1][2] | 
| SIM AT on-the-wire format attribute sizes. | |
Functions common to SIM protocols (EAP-SIM/EAP-AKA/EAP-AKA')
The development of the EAP/SIM support was funded by Internet Foundation Austria (http://www.nic.at/ipa).
Definition in file base.h.
| struct fr_aka_sim_attr_flags_t | 
| Data Fields | ||
|---|---|---|
| fr_aka_sim_attr_flags_encrypt_t | encrypt | Attribute has a tag and is encrypted. | 
| struct fr_aka_sim_checkcode_t | 
| struct fr_aka_sim_ctx_t | 
 Collaboration diagram for fr_aka_sim_ctx_t:
 Collaboration diagram for fr_aka_sim_ctx_t:| Data Fields | ||
|---|---|---|
| EVP_MD const * | checkcode_md | HMAC we use for calculating the checkcode. | 
| eap_packet_t * | eap_packet | Needed for validating AT_MAC. | 
| bool | have_iv | Whether we found the IV already. | 
| uint8_t const * | hmac_extra | Extra data for the HMAC function. | 
| size_t | hmac_extra_len | |
| EVP_MD const * | hmac_md | HMAC digest algorithm, usually EVP_sha1(). | 
| uint8_t | iv[AKA_SIM_IV_SIZE] | From the current packet. | 
| uint8_t const * | k_aut | The authentication key used for signing. | 
| size_t | k_aut_len | |
| uint8_t const * | k_encr | The encryption key used for encrypting. always 16 bytes. | 
| struct fr_aka_sim_keys_t | 
| Data Fields | ||
|---|---|---|
| struct fr_aka_sim_keys_t.__unnamed16__ | __unnamed__ | |
| uint8_t | ck_prime[AKA_SIM_VECTOR_UMTS_CK_SIZE] | Derived from CK, for AKA'. | 
| uint8_t | emsk[64] | Derived extended master session key. | 
| uint8_t * | identity | Identity from AT_IDENTITY. | 
| size_t | identity_len | Length of the identity. | 
| uint8_t | ik_prime[AKA_SIM_VECTOR_UMTS_IK_SIZE] | Derived from IK, for AKA'. | 
| uint8_t | k_aut[32] | Derived authentication key. | 
| size_t | k_aut_len | Length of k_aut. 16 for AKA/SIM, 32 for AKA'. | 
| uint8_t | k_encr[16] | Derived encryption key. | 
| uint8_t | k_re[AKA_SIM_K_RE_SIZE] | Derived reauthentication key for AKA'(kdf 1). | 
| uint8_t | mk[AKA_SIM_MK_MAX_SIZE] | Master key from session attributes. | 
| size_t | mk_len | |
| uint8_t | msk[64] | Derived master session key. | 
| uint8_t * | network | Network name (EAP-AKA-Prime only). | 
| size_t | network_len | Length of the network name (EAP-AKA-Prime only). | 
| uint64_t | sqn | Sequence number. | 
| struct fr_aka_sim_keys_t.__unnamed16__ | 
| Data Fields | ||
|---|---|---|
| union fr_aka_sim_keys_t.__unnamed16__.__unnamed18__ | __unnamed__ | |
| struct fr_aka_sim_keys_t.__unnamed16__.auc | auc | |
| fr_aka_sim_vector_src_t | vector_src | Where the vector came from. | 
| fr_aka_sim_vector_type_t | vector_type | What type of authentication vector we're using to authenticate the SIM. | 
| union fr_aka_sim_keys_t.__unnamed16__.__unnamed18__ | 
| Data Fields | ||
|---|---|---|
| struct fr_aka_sim_keys_t.__unnamed16__.__unnamed18__.gsm | gsm | Input to kdf_0_gsm. | 
| struct fr_aka_sim_keys_t.__unnamed16__.__unnamed18__.reauth | reauth | Input/output from kdf_*_reauth_*. | 
| struct fr_aka_sim_keys_t.__unnamed16__.__unnamed18__.umts | umts | Input to kdf_*_umts. | 
| struct fr_aka_sim_keys_t.__unnamed16__.__unnamed18__.gsm | 
| Data Fields | ||
|---|---|---|
| uint8_t | nonce_mt[EAP_SIM_NONCE_MT_SIZE] | Nonce provided by the client. | 
| uint32_t | num_vectors | Number of input vectors we're using (2 or 3). | 
| fr_aka_sim_vector_gsm_t | vector[3] | GSM vectors. | 
| uint8_t | version_list[FR_MAX_STRING_LEN] | Version list from negotiation. | 
| uint8_t | version_list_len | Length of version list. | 
| uint8_t | version_select[2] | Version we agreed. | 
| struct fr_aka_sim_keys_t.__unnamed16__.__unnamed18__.reauth | 
| struct fr_aka_sim_keys_t.__unnamed16__.__unnamed18__.umts | 
| Data Fields | ||
|---|---|---|
| uint16_t | kdf_selected | |
| fr_aka_sim_vector_umts_t | vector | UMTS vector. | 
| struct fr_aka_sim_keys_t.__unnamed16__.auc | 
| Data Fields | ||
|---|---|---|
| uint8_t | ki[AKA_SIM_KI_SIZE] | Secret shared between AuC and SIM. | 
| uint8_t | opc[AKA_SIM_OPC_SIZE] | Operator algorithm input. | 
| struct fr_aka_sim_vector_gsm_t | 
| Data Fields | ||
|---|---|---|
| union fr_aka_sim_vector_gsm_t.__unnamed12__ | __unnamed__ | |
| union fr_aka_sim_vector_gsm_t.__unnamed14__ | __unnamed__ | |
| uint8_t | rand[AKA_SIM_VECTOR_GSM_RAND_SIZE] | RAND challenge to the SIM. | 
| union fr_aka_sim_vector_gsm_t.__unnamed12__ | 
| Data Fields | ||
|---|---|---|
| uint8_t | sres[AKA_SIM_VECTOR_GSM_SRES_SIZE] | Signing response. | 
| uint32_t | sres_uint32 | |
| union fr_aka_sim_vector_gsm_t.__unnamed14__ | 
| Data Fields | ||
|---|---|---|
| uint8_t | kc[AKA_SIM_VECTOR_GSM_KC_SIZE] | Keying response. | 
| uint64_t | kc_uint64 | |
| struct fr_aka_sim_vector_umts_t | 
| Data Fields | ||
|---|---|---|
| uint8_t | ak[AKA_SIM_VECTOR_UMTS_AK_SIZE] | Anonymity key. | 
| uint8_t | autn[AKA_SIM_VECTOR_UMTS_AUTN_SIZE] | Authentication vector from the AuC. | 
| uint8_t | ck[AKA_SIM_VECTOR_UMTS_CK_SIZE] | Ciphering key. | 
| uint8_t | ik[AKA_SIM_VECTOR_UMTS_IK_SIZE] | Integrity key. | 
| uint8_t | rand[AKA_SIM_VECTOR_UMTS_RAND_SIZE] | RAND challenge to the SIM. | 
| uint8_t | xres[AKA_SIM_VECTOR_UMTS_XRES_MAX_SIZE] | Signing response. | 
| size_t | xres_len | Length of res (it's variable). | 
| #define AKA_PRIME_MK_REAUTH_SIZE 80U | 
| #define AKA_SIM_IV_SIZE 16U | 
| #define AKA_SIM_KI_SIZE 16U | 
| #define AKA_SIM_MAC_DIGEST_SIZE 16U | 
| #define AKA_SIM_MAC_SIZE 20U | 
| #define AKA_SIM_MAX_STRING_LENGTH 1016U | 
| #define AKA_SIM_MK_MAX_SIZE 208U | 
| #define AKA_SIM_NONCE_S_SIZE 16U | 
| #define AKA_SIM_OP_SIZE 16U | 
| #define AKA_SIM_OPC_SIZE 16U | 
| #define AKA_SIM_SKIPPABLE_MAX 127U | 
| #define AKA_SIM_VECTOR_GSM_KC_SIZE 8U | 
| #define AKA_SIM_VECTOR_GSM_RAND_SIZE 16U | 
| #define AKA_SIM_VECTOR_GSM_SRES_SIZE 4U | 
| #define EAP_AKA_AUTS_SIZE 14U | 
| #define EAP_SIM_NONCE_MT_SIZE 16U | 
| #define fr_aka_sim_flag_encrypted | ( | _da | ) | fr_aka_sim_attr_flags(_da)->encrypt | 
Where to get EAP-SIM vectors from.
The type of auth vector held by a fr_aka_sim_keys_t.
| 
 | inlinestatic | 
| ssize_t fr_aka_sim_crypto_finalise_checkcode | ( | TALLOC_CTX * | ctx, | 
| uint8_t ** | out, | ||
| fr_aka_sim_checkcode_t * | checkcode | ||
| ) | 
Write out the final checkcode value.
| [in] | ctx | ctx to allocate buffer containing the checkcode. | 
| [out] | out | talloced buffer containing the checkcode. bytes if MD was SHA1, or 32 bytes if MD was SHA256. | 
| [in,out] | checkcode | structure to get final digest from and to tree. | 
Definition at line 196 of file crypto.c.
 Here is the caller graph for this function:
 Here is the caller graph for this function:| int fr_aka_sim_crypto_gsm_kdf_0 | ( | fr_aka_sim_keys_t * | keys | ) | 
Key Derivation Function as described in RFC4186 (EAP-SIM) section 7.
       MK     = SHA1(Identity|n*Kc| NONCE_MT| Version List| Selected Version)
       FK     = PRF(MK)
       K_encr = FK[0..127]
       K_aut  = FK[128..255]
       MSK    = FK[256..767]
       EMSK   = FK[768..1279]
 | [in,out] | keys | Contains the authentication vectors and the buffers to store the result of the derivation. | 
Definition at line 462 of file crypto.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| int fr_aka_sim_crypto_init_checkcode | ( | TALLOC_CTX * | ctx, | 
| fr_aka_sim_checkcode_t ** | checkcode, | ||
| EVP_MD const * | md | ||
| ) | 
Initialise checkcode message digest.
| [in] | ctx | to allocate checkcode structure in. | 
| [out] | checkcode | a new checkcode structure. | 
| [in] | md | to use when calculating the checkcode, either EVP_sha1(), or EVP_sha256(). | 
Definition at line 114 of file crypto.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| int fr_aka_sim_crypto_kdf_0_reauth | ( | fr_aka_sim_keys_t * | keys | ) | 
Key Derivation Function (Fast-Reauthentication) as described in RFC4186/7 (EAP-SIM/AKA) section 7.
       XKEY' = SHA1(Identity|counter|NONCE_S|MK)
       FK    = PRF(XKEY')
       MSK   = FK[0..511]
       EMSK  = FK[512..1023]
Derives new MSK, EMSK, k_aut, k_encr
Use fr_aka_sim_crypto_keys_init_kdf_0_reauth to populate the fr_aka_sim_keys_t structure.
| [in,out] | keys | Contains the authentication vectors and the buffers to store the result of the derivation. | 
Definition at line 990 of file crypto.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| void fr_aka_sim_crypto_keys_init_kdf_0_reauth | ( | fr_aka_sim_keys_t * | keys, | 
| uint8_t const | mk[static AKA_SIM_MK_SIZE], | ||
| uint16_t | counter | ||
| ) | 
Initialise fr_aka_sim_keys_t with EAP-SIM reauthentication data.
Generates a new nonce_s and copies the mk and counter values into the fr_aka_sim_keys_t.
| [out] | keys | structure to populate. | 
| [in] | mk | from original authentication. | 
| [in] | counter | re-authentication counter. | 
Definition at line 917 of file crypto.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| void fr_aka_sim_crypto_keys_init_umts_kdf_1_reauth | ( | fr_aka_sim_keys_t * | keys, | 
| uint8_t const | mk[static AKA_PRIME_MK_REAUTH_SIZE], | ||
| uint16_t | counter | ||
| ) | 
Initialise fr_aka_sim_keys_t with EAP-AKA['] reauthentication data.
Generates a new nonce_s and copies the mk and counter values into the fr_aka_sim_keys_t.
| [out] | keys | structure to populate. | 
| [in] | mk | from original authentication. | 
| [in] | counter | re-authentication counter. | 
Definition at line 947 of file crypto.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| void fr_aka_sim_crypto_keys_log | ( | request_t * | request, | 
| fr_aka_sim_keys_t * | keys | ||
| ) | 
| ssize_t fr_aka_sim_crypto_sign_packet | ( | uint8_t | out[static AKA_SIM_MAC_DIGEST_SIZE], | 
| eap_packet_t * | eap_packet, | ||
| bool | zero_mac, | ||
| EVP_MD const * | md, | ||
| uint8_t const * | key, | ||
| size_t const | key_len, | ||
| uint8_t const * | hmac_extra, | ||
| size_t const | hmac_extra_len | ||
| ) | 
Calculate the digest value for a packet.
Run a digest over a fake EAP header, the entire SIM packet and any extra HMAC data, writing a truncated (16 byte) digest value to out.
| [out] | out | Where to write the digest. | 
| [in] | eap_packet | to extract header values from. | 
| [in] | zero_mac | Assume the mac field is not zeroed (i.e. received packet) and skip it during mac calculation feeding in 16 zeroed bytes in its place. | 
| [in] | md | to use to create the HMAC. | 
| [in] | key | to use to sign the packet. | 
| [in] | key_len | Length of the key. | 
| [in] | hmac_extra | data to concatenate with the packet when calculating the HMAC (may be NULL). | 
| [in] | hmac_extra_len | Length of hmac_extra (may be zero). | 
Definition at line 284 of file crypto.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| int fr_aka_sim_crypto_umts_kdf_0 | ( | fr_aka_sim_keys_t * | keys | ) | 
Key Derivation Function as described in RFC4187 (EAP-AKA) section 7.
       MK     = SHA1(Identity|IK|CK)
       FK     = PRF(MK)
       K_encr = FK[0..127]
       K_aut  = FK[128..255]
       MSK    = FK[256..767]
       EMSK   = FK[768..1279]
| [in,out] | keys | Contains the authentication vectors and the buffers to store the result of the derivation. | 
Definition at line 564 of file crypto.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| int fr_aka_sim_crypto_umts_kdf_1 | ( | fr_aka_sim_keys_t * | keys | ) | 
Key Derivation Function as described in RFC 5448 (EAP-AKA') section 3.3.
       MK     = PRF'(IK'|CK',"EAP-AKA'"|Identity)
       K_encr = MK[0..127]
       K_aut  = MK[128..383]
       K_re   = MK[384..639]
       MSK    = MK[640..1151]
       EMSK   = MK[1152..1663]
| [in,out] | keys | Contains the authentication vectors and the buffers to store the result of the derivation. | 
Definition at line 846 of file crypto.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| int fr_aka_sim_crypto_umts_kdf_1_reauth | ( | fr_aka_sim_keys_t * | keys | ) | 
Key Derivation Function (Fast-Reauthentication) as described in RFC 5448 (EAP-AKA') section 3.3.
       MK   = PRF'(K_re,"EAP-AKA' re-auth"|Identity|counter|NONCE_S)
       MSK  = MK[0..511]
       EMSK = MK[512..1023]
| [in,out] | keys | Contains the authentication vectors and the buffers to store the result of the derivation. | 
Definition at line 1139 of file crypto.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| int fr_aka_sim_crypto_update_checkcode | ( | fr_aka_sim_checkcode_t * | checkcode, | 
| eap_packet_t * | eap_packet | ||
| ) | 
Digest a packet, updating the checkcode.
Call fr_aka_sim_crypto_finalise_checkcode to obtain the final checkcode value.
| [in,out] | checkcode | if *checkcode is NULL, a new checkcode structure will be allocated and the message digest context will be initialised before the provided eap_packet is fed into the digest. | 
| [in] | eap_packet | to digest. | 
Definition at line 152 of file crypto.c.
 Here is the caller graph for this function:
 Here is the caller graph for this function:| int fr_aka_sim_decode | ( | TALLOC_CTX * | ctx, | 
| fr_pair_list_t * | out, | ||
| fr_dict_t const * | dict, | ||
| uint8_t const * | data, | ||
| size_t | data_len, | ||
| fr_aka_sim_ctx_t * | decode_ctx | ||
| ) | 
Decode SIM/AKA/AKA' specific packet data.
Extracts the SUBTYPE and adds it an attribute, then decodes any TLVs in the SIM/AKA/AKA' packet.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Code | Identifier | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Subtype | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The first byte of the data pointer should be the subtype.
| [in] | ctx | where to allocate the pairs. | 
| [in] | out | where to write out attributes. | 
| [in] | dict | for looking up attributes. | 
| [in] | data | to convert to pairs. | 
| [in] | data_len | length of data to convert. | 
| [in] | decode_ctx | holds the state of the decoder. | 
Definition at line 942 of file decode.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| ssize_t fr_aka_sim_decode_pair | ( | TALLOC_CTX * | ctx, | 
| fr_pair_list_t * | out, | ||
| fr_dict_attr_t const * | parent, | ||
| uint8_t const * | data, | ||
| size_t | data_len, | ||
| void * | decode_ctx | ||
| ) | 
Decode SIM/AKA/AKA' attributes.
| [in] | ctx | to allocate attributes in. | 
| [in] | out | where to insert the attributes. | 
| [in] | parent | for looking up attributes. | 
| [in] | data | data to parse. | 
| [in] | data_len | length of data. For top level attributes packet_ctx must be the length of the packet (so we can hunt for AT_IV), for Sub-TLVs it should be the length of the container value. | 
| [in] | decode_ctx | extra context to pass to the decoder. | 
Definition at line 909 of file decode.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| ssize_t fr_aka_sim_encode | ( | request_t * | request, | 
| fr_pair_list_t * | to_encode, | ||
| void * | encode_ctx | ||
| ) | 
| ssize_t fr_aka_sim_encode_pair | ( | fr_dbuff_t * | dbuff, | 
| fr_dcursor_t * | cursor, | ||
| void * | encode_ctx | ||
| ) | 
Implement the FIPS-186-2 PRF to derive keying material from the MK.
run the FIPS-186-2 PRF on the given Master Key (160 bits) in order to derive 1280 bits (160 bytes) of keying data from it.
Given that in EAP-SIM, this is coming from a 64-bit Kc it seems like an awful lot of "randomness" to pull out..
| [out] | out | Buffer to contain the data derived from the mk. | 
| [in] | mk | The master key we use to derive all other keying data. | 
Definition at line 91 of file fips186prf.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| void fr_aka_sim_free | ( | void | ) | 
| int fr_aka_sim_init | ( | void | ) | 
| size_t fr_aka_sim_octets_prefix_len | ( | fr_dict_attr_t const * | da | ) | 
| int fr_aka_sim_umts_resync_from_attrs | ( | uint64_t * | new_sqn, | 
| request_t * | request, | ||
| fr_pair_t * | auts_vp, | ||
| fr_aka_sim_keys_t * | keys | ||
| ) | 
Perform milenage AUTS validation and resynchronisation.
| [out] | new_sqn | The new sequence number provided by the AUTS. | 
| [in] | request | The current request. | 
| [in] | auts_vp | The AUTS response. | 
| [in] | keys | UMTS keys. | 
Definition at line 935 of file vector.c.
 Here is the call graph for this function:
 Here is the call graph for this function:| int fr_aka_sim_vector_gsm_from_attrs | ( | request_t * | request, | 
| fr_pair_list_t * | vps, | ||
| int | idx, | ||
| fr_aka_sim_keys_t * | keys, | ||
| fr_aka_sim_vector_src_t * | src | ||
| ) | 
Retrieve GSM triplets from sets of attributes.
Hunt for a source of SIM triplets
| [in] | request | The current subrequest. | 
| [in] | vps | List to hunt for triplets in. | 
| [in] | idx | To write EAP-SIM triplets to. | 
| [in] | keys | EAP session keys. | 
| [in] | src | Forces triplets to be retrieved from a particular src and ensures if multiple triplets are being retrieved that they all come from the same src. | 
Definition at line 330 of file vector.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| int fr_aka_sim_vector_gsm_umts_kdf_0_reauth_from_attrs | ( | request_t * | request, | 
| fr_pair_list_t * | vps, | ||
| fr_aka_sim_keys_t * | keys | ||
| ) | 
Populate a fr_aka_sim_keys_t structure from attributes in the session-state list.
| [in] | request | The current request. | 
| [in] | vps | Session-state list | 
| [in] | keys | key structure to populate. | 
Definition at line 824 of file vector.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| int fr_aka_sim_vector_umts_from_attrs | ( | request_t * | request, | 
| fr_pair_list_t * | vps, | ||
| fr_aka_sim_keys_t * | keys, | ||
| fr_aka_sim_vector_src_t * | src | ||
| ) | 
Retrieve UMTS quintuplets from sets of attributes.
Hunt for a source of UMTS quintuplets
| request | The current request. | 
| vps | List to hunt for triplets in. | 
| keys | UMTS keys. | 
| src | Forces quintuplets to be retrieved from a particular src. | 
Definition at line 755 of file vector.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| int fr_aka_sim_vector_umts_kdf_1_reauth_from_attrs | ( | request_t * | request, | 
| fr_pair_list_t * | vps, | ||
| fr_aka_sim_keys_t * | keys | ||
| ) | 
Populate a fr_aka_sim_keys_t structure from attributes in the session-state list.
| [in] | request | The current request. | 
| [in] | vps | Session-state list | 
| [in] | keys | key structure to populate. | 
Definition at line 873 of file vector.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| void fr_aka_sim_vector_umts_reauth_clear | ( | fr_aka_sim_keys_t * | keys | ) | 
| int fr_aka_sim_xlat_func_register | ( | void | ) | 
| void fr_aka_sim_xlat_func_unregister | ( | void | ) | 
| 
 | extern | 
SIM AT on-the-wire format attribute sizes.
Holds the min/max sizes of all supported SIM AT attribute values as they would be found in a SIM AT packet.
These sizes may be different than the sizes of INTERNAL formats, PRESENTATION formats and generic NETWORK formats.
 1.9.8
 1.9.8