2 * hostapd / EAP-SIM database/authenticator gateway
3 * Copyright (c) 2005-2007, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
18 #include "eap_common/eap_sim_common.h"
20 /* Identity prefixes */
21 #define EAP_SIM_PERMANENT_PREFIX '1'
22 #define EAP_SIM_PSEUDONYM_PREFIX '3'
23 #define EAP_SIM_REAUTH_ID_PREFIX '5'
24 #define EAP_AKA_PERMANENT_PREFIX '0'
25 #define EAP_AKA_PSEUDONYM_PREFIX '2'
26 #define EAP_AKA_REAUTH_ID_PREFIX '4'
28 void * eap_sim_db_init(const char *config
,
29 void (*get_complete_cb
)(void *ctx
, void *session_ctx
),
32 void eap_sim_db_deinit(void *priv
);
34 int eap_sim_db_get_gsm_triplets(void *priv
, const u8
*identity
,
35 size_t identity_len
, int max_chal
,
36 u8
*_rand
, u8
*kc
, u8
*sres
,
37 void *cb_session_ctx
);
39 #define EAP_SIM_DB_FAILURE -1
40 #define EAP_SIM_DB_PENDING -2
42 int eap_sim_db_identity_known(void *priv
, const u8
*identity
,
45 char * eap_sim_db_get_next_pseudonym(void *priv
, int aka
);
47 char * eap_sim_db_get_next_reauth_id(void *priv
, int aka
);
49 int eap_sim_db_add_pseudonym(void *priv
, const u8
*identity
,
50 size_t identity_len
, char *pseudonym
);
52 int eap_sim_db_add_reauth(void *priv
, const u8
*identity
,
53 size_t identity_len
, char *reauth_id
, u16 counter
,
55 int eap_sim_db_add_reauth_prime(void *priv
, const u8
*identity
,
56 size_t identity_len
, char *reauth_id
,
57 u16 counter
, const u8
*k_encr
, const u8
*k_aut
,
60 const u8
* eap_sim_db_get_permanent(void *priv
, const u8
*identity
,
61 size_t identity_len
, size_t *len
);
63 struct eap_sim_reauth
{
64 struct eap_sim_reauth
*next
;
70 u8 mk
[EAP_SIM_MK_LEN
];
71 u8 k_encr
[EAP_SIM_K_ENCR_LEN
];
72 u8 k_aut
[EAP_AKA_PRIME_K_AUT_LEN
];
73 u8 k_re
[EAP_AKA_PRIME_K_RE_LEN
];
76 struct eap_sim_reauth
*
77 eap_sim_db_get_reauth_entry(void *priv
, const u8
*identity
,
80 void eap_sim_db_remove_reauth(void *priv
, struct eap_sim_reauth
*reauth
);
82 int eap_sim_db_get_aka_auth(void *priv
, const u8
*identity
,
83 size_t identity_len
, u8
*_rand
, u8
*autn
, u8
*ik
,
84 u8
*ck
, u8
*res
, size_t *res_len
,
85 void *cb_session_ctx
);
87 int eap_sim_db_resynchronize(void *priv
, const u8
*identity
,
88 size_t identity_len
, const u8
*auts
,
91 #endif /* EAP_SIM_DB_H */