$search
00001 /* 00002 * hostapd / EAP-SIM database/authenticator gateway 00003 * Copyright (c) 2005-2007, Jouni Malinen <j@w1.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation. 00008 * 00009 * Alternatively, this software may be distributed under the terms of BSD 00010 * license. 00011 * 00012 * See README and COPYING for more details. 00013 */ 00014 00015 #ifndef EAP_SIM_DB_H 00016 #define EAP_SIM_DB_H 00017 00018 #include "eap_common/eap_sim_common.h" 00019 00020 /* Identity prefixes */ 00021 #define EAP_SIM_PERMANENT_PREFIX '1' 00022 #define EAP_SIM_PSEUDONYM_PREFIX '3' 00023 #define EAP_SIM_REAUTH_ID_PREFIX '5' 00024 #define EAP_AKA_PERMANENT_PREFIX '0' 00025 #define EAP_AKA_PSEUDONYM_PREFIX '2' 00026 #define EAP_AKA_REAUTH_ID_PREFIX '4' 00027 00028 void * eap_sim_db_init(const char *config, 00029 void (*get_complete_cb)(void *ctx, void *session_ctx), 00030 void *ctx); 00031 00032 void eap_sim_db_deinit(void *priv); 00033 00034 int eap_sim_db_get_gsm_triplets(void *priv, const u8 *identity, 00035 size_t identity_len, int max_chal, 00036 u8 *_rand, u8 *kc, u8 *sres, 00037 void *cb_session_ctx); 00038 00039 #define EAP_SIM_DB_FAILURE -1 00040 #define EAP_SIM_DB_PENDING -2 00041 00042 int eap_sim_db_identity_known(void *priv, const u8 *identity, 00043 size_t identity_len); 00044 00045 char * eap_sim_db_get_next_pseudonym(void *priv, int aka); 00046 00047 char * eap_sim_db_get_next_reauth_id(void *priv, int aka); 00048 00049 int eap_sim_db_add_pseudonym(void *priv, const u8 *identity, 00050 size_t identity_len, char *pseudonym); 00051 00052 int eap_sim_db_add_reauth(void *priv, const u8 *identity, 00053 size_t identity_len, char *reauth_id, u16 counter, 00054 const u8 *mk); 00055 int eap_sim_db_add_reauth_prime(void *priv, const u8 *identity, 00056 size_t identity_len, char *reauth_id, 00057 u16 counter, const u8 *k_encr, const u8 *k_aut, 00058 const u8 *k_re); 00059 00060 const u8 * eap_sim_db_get_permanent(void *priv, const u8 *identity, 00061 size_t identity_len, size_t *len); 00062 00063 struct eap_sim_reauth { 00064 struct eap_sim_reauth *next; 00065 u8 *identity; 00066 size_t identity_len; 00067 char *reauth_id; 00068 u16 counter; 00069 int aka_prime; 00070 u8 mk[EAP_SIM_MK_LEN]; 00071 u8 k_encr[EAP_SIM_K_ENCR_LEN]; 00072 u8 k_aut[EAP_AKA_PRIME_K_AUT_LEN]; 00073 u8 k_re[EAP_AKA_PRIME_K_RE_LEN]; 00074 }; 00075 00076 struct eap_sim_reauth * 00077 eap_sim_db_get_reauth_entry(void *priv, const u8 *identity, 00078 size_t identity_len); 00079 00080 void eap_sim_db_remove_reauth(void *priv, struct eap_sim_reauth *reauth); 00081 00082 int eap_sim_db_get_aka_auth(void *priv, const u8 *identity, 00083 size_t identity_len, u8 *_rand, u8 *autn, u8 *ik, 00084 u8 *ck, u8 *res, size_t *res_len, 00085 void *cb_session_ctx); 00086 00087 int eap_sim_db_resynchronize(void *priv, const u8 *identity, 00088 size_t identity_len, const u8 *auts, 00089 const u8 *_rand); 00090 00091 #endif /* EAP_SIM_DB_H */