/** * eap_sim_db_add_reauth_prime - EAP-AKA' DB: Add new re-authentication entry * @data: Private data pointer from eap_sim_db_init() * @permanent: Permanent username * @reauth_id: reauth_id for this user. This needs to be an allocated buffer, * e.g., return value from eap_sim_db_get_next_reauth_id(). Caller must not * free it. * @counter: AT_COUNTER value for fast re-authentication * @k_encr: K_encr from the previous full authentication * @k_aut: K_aut from the previous full authentication * @k_re: 32-byte K_re from the previous full authentication * Returns: 0 on success, -1 on failure * * This function adds a new re-authentication entry for an EAP-AKA' user. * EAP-SIM DB is responsible of freeing reauth_id buffer once it is not needed * anymore. */ int eap_sim_db_add_reauth_prime(struct eap_sim_db_data *data, const char *permanent, char *reauth_id, u16 counter, const u8 *k_encr, const u8 *k_aut, const u8 *k_re) { struct eap_sim_reauth *r; wpa_printf(MSG_DEBUG, "EAP-SIM DB: Add reauth_id '%s' for permanent " "identity '%s'", reauth_id, permanent); #ifdef CONFIG_SQLITE if (data->sqlite_db) return db_add_reauth(data, permanent, reauth_id, counter, NULL, k_encr, k_aut, k_re); #endif /* CONFIG_SQLITE */ r = eap_sim_db_add_reauth_data(data, permanent, reauth_id, counter); if (r == NULL) return -1; os_memcpy(r->k_encr, k_encr, EAP_SIM_K_ENCR_LEN); os_memcpy(r->k_aut, k_aut, EAP_AKA_PRIME_K_AUT_LEN); os_memcpy(r->k_re, k_re, EAP_AKA_PRIME_K_RE_LEN); return 0; }
int eap_sim_db_add_reauth(void *priv, const u8 *identity, size_t identity_len, char *reauth_id, u16 counter, const u8 *mk) { struct eap_sim_db_data *data = priv; struct eap_sim_reauth *r; r = eap_sim_db_add_reauth_data(data, identity, identity_len, reauth_id, counter); if (r == NULL) return -1; os_memcpy(r->mk, mk, EAP_SIM_MK_LEN); r->aka_prime = 0; return 0; }
int eap_sim_db_add_reauth_prime(void *priv, const u8 *identity, size_t identity_len, char *reauth_id, u16 counter, const u8 *k_encr, const u8 *k_aut, const u8 *k_re) { struct eap_sim_db_data *data = priv; struct eap_sim_reauth *r; r = eap_sim_db_add_reauth_data(data, identity, identity_len, reauth_id, counter); if (r == NULL) return -1; r->aka_prime = 1; os_memcpy(r->k_encr, k_encr, EAP_SIM_K_ENCR_LEN); os_memcpy(r->k_aut, k_aut, EAP_AKA_PRIME_K_AUT_LEN); os_memcpy(r->k_re, k_re, EAP_AKA_PRIME_K_RE_LEN); return 0; }
/** * eap_sim_db_add_reauth - EAP-SIM DB: Add new re-authentication entry * @priv: Private data pointer from eap_sim_db_init() * @permanent: Permanent username * @identity_len: Length of identity * @reauth_id: reauth_id for this user. This needs to be an allocated buffer, * e.g., return value from eap_sim_db_get_next_reauth_id(). Caller must not * free it. * @counter: AT_COUNTER value for fast re-authentication * @mk: 16-byte MK from the previous full authentication or %NULL * Returns: 0 on success, -1 on failure * * This function adds a new re-authentication entry for an EAP-SIM user. * EAP-SIM DB is responsible of freeing reauth_id buffer once it is not needed * anymore. */ int eap_sim_db_add_reauth(struct eap_sim_db_data *data, const char *permanent, char *reauth_id, u16 counter, const u8 *mk) { struct eap_sim_reauth *r; wpa_printf(MSG_DEBUG, "EAP-SIM DB: Add reauth_id '%s' for permanent " "identity '%s'", reauth_id, permanent); #ifdef CONFIG_SQLITE if (data->sqlite_db) return db_add_reauth(data, permanent, reauth_id, counter, mk, NULL, NULL, NULL); #endif /* CONFIG_SQLITE */ r = eap_sim_db_add_reauth_data(data, permanent, reauth_id, counter); if (r == NULL) return -1; os_memcpy(r->mk, mk, EAP_SIM_MK_LEN); return 0; }