wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
eap_sim_db.h
Go to the documentation of this file.
1 
5 #ifndef EAP_SIM_DB_H
6 #define EAP_SIM_DB_H
7 
9 
10 /* Identity prefixes */
11 #define EAP_SIM_PERMANENT_PREFIX '1'
12 #define EAP_SIM_PSEUDONYM_PREFIX '3'
13 #define EAP_SIM_REAUTH_ID_PREFIX '5'
14 #define EAP_AKA_PERMANENT_PREFIX '0'
15 #define EAP_AKA_PSEUDONYM_PREFIX '2'
16 #define EAP_AKA_REAUTH_ID_PREFIX '4'
17 #define EAP_AKA_PRIME_PERMANENT_PREFIX '6'
18 #define EAP_AKA_PRIME_PSEUDONYM_PREFIX '7'
19 #define EAP_AKA_PRIME_REAUTH_ID_PREFIX '8'
20 
21 enum eap_sim_db_method {
22  EAP_SIM_DB_SIM,
23  EAP_SIM_DB_AKA,
24  EAP_SIM_DB_AKA_PRIME
25 };
26 
27 struct eap_sim_db_data;
28 
29 struct eap_sim_db_data *
30 eap_sim_db_init(const char *config,
31  void (*get_complete_cb)(void *ctx, void *session_ctx),
32  void *ctx);
33 
34 void eap_sim_db_deinit(void *priv);
35 
37  const char *username, int max_chal,
38  u8 *_rand, u8 *kc, u8 *sres,
39  void *cb_session_ctx);
40 
41 #define EAP_SIM_DB_FAILURE -1
42 #define EAP_SIM_DB_PENDING -2
43 
45  enum eap_sim_db_method method);
46 
48  enum eap_sim_db_method method);
49 
51  const char *permanent, char *pseudonym);
52 
53 int eap_sim_db_add_reauth(struct eap_sim_db_data *data, const char *permanent,
54  char *reauth_id, u16 counter, const u8 *mk);
55 int eap_sim_db_add_reauth_prime(struct eap_sim_db_data *data,
56  const char *permanent,
57  char *reauth_id, u16 counter, const u8 *k_encr,
58  const u8 *k_aut, const u8 *k_re);
59 
60 const char * eap_sim_db_get_permanent(struct eap_sim_db_data *data,
61  const char *pseudonym);
62 
64  struct eap_sim_reauth *next;
65  char *permanent; /* Permanent username */
66  char *reauth_id; /* Fast re-authentication username */
67  u16 counter;
68  u8 mk[EAP_SIM_MK_LEN];
69  u8 k_encr[EAP_SIM_K_ENCR_LEN];
70  u8 k_aut[EAP_AKA_PRIME_K_AUT_LEN];
71  u8 k_re[EAP_AKA_PRIME_K_RE_LEN];
72 };
73 
74 struct eap_sim_reauth *
76  const char *reauth_id);
77 
79  struct eap_sim_reauth *reauth);
80 
81 int eap_sim_db_get_aka_auth(struct eap_sim_db_data *data, const char *username,
82  u8 *_rand, u8 *autn, u8 *ik, u8 *ck,
83  u8 *res, size_t *res_len, void *cb_session_ctx);
84 
86  const char *username, const u8 *auts,
87  const u8 *_rand);
88 
89 char * sim_get_username(const u8 *identity, size_t identity_len);
90 
91 #endif /* EAP_SIM_DB_H */
int eap_sim_db_resynchronize(struct eap_sim_db_data *data, const char *username, const u8 *auts, const u8 *_rand)
Resynchronize AKA AUTN.
Definition: eap_sim_db.c:1425
int eap_sim_db_add_pseudonym(struct eap_sim_db_data *data, const char *permanent, char *pseudonym)
EAP-SIM DB: Add new pseudonym.
Definition: eap_sim_db.c:1047
int eap_sim_db_add_reauth(struct eap_sim_db_data *data, const char *permanent, char *reauth_id, u16 counter, const u8 *mk)
EAP-SIM DB: Add new re-authentication entry.
Definition: eap_sim_db.c:1150
char * eap_sim_db_get_next_reauth_id(struct eap_sim_db_data *data, enum eap_sim_db_method method)
EAP-SIM DB: Get next reauth_id.
Definition: eap_sim_db.c:1014
int eap_sim_db_get_aka_auth(struct eap_sim_db_data *data, const char *username, u8 *_rand, u8 *autn, u8 *ik, u8 *ck, u8 *res, size_t *res_len, void *cb_session_ctx)
Get AKA authentication values.
Definition: eap_sim_db.c:1330
int eap_sim_db_get_gsm_triplets(struct eap_sim_db_data *data, const char *username, int max_chal, u8 *_rand, u8 *kc, u8 *sres, void *cb_session_ctx)
Get GSM triplets.
Definition: eap_sim_db.c:863
Definition: eap_sim_db.c:56
EAP peer/server: EAP-SIM/AKA/AKA' shared routines.
void eap_sim_db_remove_reauth(struct eap_sim_db_data *data, struct eap_sim_reauth *reauth)
EAP-SIM DB: Remove re-authentication entry.
Definition: eap_sim_db.c:1280
struct eap_sim_reauth * eap_sim_db_get_reauth_entry(struct eap_sim_db_data *data, const char *reauth_id)
EAP-SIM DB: Get re-authentication entry.
Definition: eap_sim_db.c:1253
char * eap_sim_db_get_next_pseudonym(struct eap_sim_db_data *data, enum eap_sim_db_method method)
EAP-SIM DB: Get next pseudonym.
Definition: eap_sim_db.c:981
char * sim_get_username(const u8 *identity, size_t identity_len)
Extract username from SIM identity.
Definition: eap_sim_db.c:1486
Definition: eap_sim_db.h:63
struct eap_sim_db_data * eap_sim_db_init(const char *config, void(*get_complete_cb)(void *ctx, void *session_ctx), void *ctx)
Initialize EAP-SIM DB / authentication gateway interface.
Definition: eap_sim_db.c:694
const char * eap_sim_db_get_permanent(struct eap_sim_db_data *data, const char *pseudonym)
EAP-SIM DB: Get permanent identity.
Definition: eap_sim_db.c:1226
void eap_sim_db_deinit(void *priv)
Deinitialize EAP-SIM DB/authentication gw interface.
Definition: eap_sim_db.c:760