28 RCSID(
"$Id: 8fc2cb43c5c0c41c73b6152456e8a7c6f90c5acb $")
30 #include <freeradius-devel/util/sha1.h>
32 #include <freeradius-devel/util/debug.h>
33 #include <freeradius-devel/server/module.h>
35 #include <freeradius-devel/tls/base.h>
37 #include <freeradius-devel/eap/types.h>
39 #include <freeradius-devel/eap_aka_sim/base.h>
40 #include <freeradius-devel/eap_aka_sim/attrs.h>
54 { .out = &
dict_eap_aka_sim, .base_dir =
"eap/aka-sim", .proto =
"eap-aka-sim" },
259 switch (
vp->vp_type) {
261 return vp->vp_length;
278 if (da->flags.array)
return 0;
279 if (!da->flags.length)
return 2;
280 if (!(da->flags.length % 4))
return 2;
292 PERROR(
"Failed loading libfreeradius-eap-aka-sim dictionaries");
296 PERROR(
"Failed loading libfreeradius-eap-aka-sim attributes");
301 PERROR(
"Failed loading libfreeradius-eap-aka-sim enumerations");
305 if (fr_openssl_init() < 0) {
306 PERROR(
"Failed setting up OpenSSL");
328 .
name =
"eap_aka_sim",
329 .default_type_size = 1,
330 .default_type_length = 1,
#define L(_str)
Helper for initialising arrays of string literals.
EAP-SIM/EAP-AKA Private crypto functions.
#define fr_cond_assert(_x)
Calls panic_action ifndef NDEBUG, else logs error and evaluates to value of _x.
int fr_dict_enum_autoload(fr_dict_enum_autoload_t const *to_load)
Process a dict_attr_autoload element to load/verify a dictionary attribute.
#define fr_dict_autofree(_to_free)
fr_value_box_t const ** out
Enumeration value.
fr_dict_attr_t const ** out
Where to write a pointer to the resolved fr_dict_attr_t.
fr_dict_t const ** out
Where to write a pointer to the loaded/resolved fr_dict_t.
int fr_dict_attr_autoload(fr_dict_attr_autoload_t const *to_load)
Process a dict_attr_autoload element to load/verify a dictionary attribute.
@ FR_DICT_ATTR_EXT_PROTOCOL_SPECIFIC
Protocol specific extensions.
#define fr_dict_autoload(_to_load)
char const * name
name of this protocol
Specifies an attribute which must be present for the module to function.
Specifies a dictionary which must be loaded/loadable for the module to function.
Specifies a value which must be present for the module to function.
Protocol specific custom flag definitnion.
Protocol-specific callbacks in libfreeradius-PROTOCOL.
static void * fr_dict_attr_ext(fr_dict_attr_t const *da, fr_dict_attr_ext_t ext)
fr_aka_sim_attr_flags_encrypt_t
@ AKA_SIM_FLAG_ENCRYPT_AES_CBC
Encrypt attribute RFC 2865 style.
@ AKA_SIM_FLAG_ENCRYPT_INVALID
Invalid encryption flag.
fr_aka_sim_attr_flags_encrypt_t encrypt
Attribute has a tag and is encrypted.
void aka_sim_crypto_cipher_ctx_free(void)
Explicitly free all thread load cipher ctxs.
fr_dict_attr_t const * attr_eap_identity
fr_dict_attr_t const * attr_eap_type
fr_dict_t const * dict_freeradius
fr_dict_t const * dict_radius
fr_dict_attr_t const * attr_ms_mppe_send_key
fr_dict_attr_t const * attr_ms_mppe_recv_key
fr_dict_attr_t const * attr_eap_aka_sim_subtype
fr_dict_attr_t const * attr_eap_aka_sim_permanent_identity
fr_dict_attr_t const * attr_eap_aka_sim_k_aut
fr_dict_attr_t const * attr_eap_aka_sim_next_pseudonym
fr_dict_attr_t const * attr_sim_amf
fr_dict_attr_t const * attr_eap_aka_sim_mk
size_t fr_aka_sim_attr_len(fr_pair_t const *vp)
Return the on-the-wire length of an attribute value.
fr_dict_attr_t const * attr_session_id
fr_dict_attr_t const * attr_eap_aka_sim_hmac_extra_request
fr_dict_protocol_t libfreeradius_eap_aka_sim_dict_protocol
static int dict_flag_encrypt(fr_dict_attr_t **da_p, char const *value, UNUSED fr_dict_flag_parser_rule_t const *rules)
fr_dict_attr_t const * attr_eap_aka_sim_counter_too_small
fr_dict_attr_t const * attr_eap_aka_sim_next_reauth_id
fr_dict_attr_t const * attr_eap_aka_sim_ak
fr_dict_attr_t const * attr_sim_op
fr_dict_attr_t const * attr_eap_aka_sim_kdf
fr_dict_attr_t const * attr_eap_aka_sim_ik
void fr_aka_sim_free(void)
fr_dict_attr_t const * attr_eap_aka_sim_xres
fr_dict_attr_t const * attr_eap_aka_sim_ck
fr_value_box_t const * enum_kdf_prime_with_ck_prime_ik_prime
fr_dict_attr_t const * attr_eap_aka_sim_permanent_id_req
fr_dict_attr_t const * attr_session_data
static uint32_t instance_count
fr_dict_attr_t const * attr_sim_ki
int fr_aka_sim_init(void)
fr_value_box_t const * enum_eap_type_aka
size_t fr_aka_sim_octets_prefix_len(fr_dict_attr_t const *da)
Return the number of bytes before the octets value.
fr_dict_attr_t const * attr_eap_aka_sim_sres
fr_dict_attr_t const * attr_eap_aka_sim_iv
fr_dict_attr_t const * attr_eap_aka_sim_kc
fr_value_box_t const * enum_eap_type_sim
fr_dict_attr_t const * attr_eap_aka_sim_notification
fr_dict_attr_t const * attr_eap_aka_sim_client_error_code
fr_dict_attr_t const * attr_eap_aka_sim_hmac_extra_response
fr_dict_attr_t const * attr_eap_aka_sim_auts
fr_dict_attr_t const * attr_eap_aka_sim_k_re
fr_dict_attr_t const * attr_eap_aka_sim_identity_type
fr_dict_attr_t const * attr_eap_aka_sim_any_id_req
fr_dict_attr_t const * attr_eap_aka_sim_k_encr
fr_dict_attr_t const * attr_sim_sqn
fr_dict_attr_t const * attr_eap_aka_sim_autn
fr_dict_attr_t const * attr_eap_aka_sim_nonce_mt
fr_dict_attr_t const * attr_eap_aka_sim_result_ind
fr_dict_enum_autoload_t libfreeradius_aka_sim_dict_enum[]
fr_dict_attr_t const * attr_eap_aka_sim_bidding
fr_dict_t const * dict_eap_aka_sim
fr_dict_attr_t const * attr_sim_opc
fr_value_box_t const * enum_eap_type_aka_prime
fr_dict_attr_t const * attr_sim_algo_version
fr_dict_attr_t const * attr_eap_aka_sim_version_list
fr_dict_attr_t const * attr_eap_aka_sim_mac
static fr_dict_flag_parser_t const eap_aka_sim_flags[]
fr_dict_autoload_t libfreeradius_aka_sim_dict[]
fr_dict_attr_t const * attr_eap_aka_sim_res
fr_dict_attr_t const * attr_eap_aka_sim_identity
fr_dict_attr_t const * attr_eap_aka_sim_nonce_s
fr_dict_attr_t const * attr_eap_aka_sim_encr_data
fr_dict_attr_t const * attr_eap_aka_sim_counter
fr_dict_attr_t const * attr_eap_aka_sim_selected_version
fr_dict_attr_t const * attr_eap_aka_sim_method_hint
fr_dict_attr_t const * attr_eap_aka_sim_kdf_identity
fr_dict_attr_t const * attr_eap_aka_sim_kdf_input
fr_dict_attr_t const * attr_eap_aka_sim_checkcode
fr_dict_attr_autoload_t libfreeradius_aka_sim_dict_attr[]
fr_dict_attr_t const * attr_eap_aka_sim_rand
fr_dict_attr_t const * attr_eap_aka_sim_fullauth_id_req
size_t const fr_aka_sim_attr_sizes[FR_TYPE_MAX+1][2]
SIM AT on-the-wire format attribute sizes.
@ FR_TYPE_TLV
Contains nested attributes.
@ FR_TYPE_STRING
String of printable characters.
@ FR_TYPE_MAX
Number of defined data types.
@ FR_TYPE_NULL
Invalid (uninitialised) attribute type.
@ FR_TYPE_UINT16
16 Bit unsigned integer.
@ FR_TYPE_UINT8
8 Bit unsigned integer.
@ FR_TYPE_UINT32
32 Bit unsigned integer.
@ FR_TYPE_UINT64
64 Bit unsigned integer.
@ FR_TYPE_BOOL
A truth value.
@ FR_TYPE_OCTETS
Raw octets.
Stores an attribute, a value and various bits of other data.
#define fr_table_value_by_str(_table, _name, _def)
Convert a string to a value using a sorted or ordered table.
An element in a lexicographically sorted array of name to num mappings.
#define fr_strerror_printf(_fmt,...)
Log to thread local error buffer.
#define FR_TYPE_VARIABLE_SIZE
#define FR_TYPE_STRUCTURAL