libm: Import fdim{,f,l} functions from FreeBSD.
[dragonfly.git] / contrib / hostapd-0.5.8 / eap_sim_db.h
blob6754bc3d4ccd5eea91ebd548d0432215efed6c03
1 /*
2 * hostapd / EAP-SIM database/authenticator gateway
3 * Copyright (c) 2005-2006, 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
10 * license.
12 * See README and COPYING for more details.
15 #ifndef EAP_SIM_DB_H
16 #define EAP_SIM_DB_H
18 #ifdef EAP_SIM
20 #include "eap_sim_common.h"
22 /* Identity prefixes */
23 #define EAP_SIM_PERMANENT_PREFIX '1'
24 #define EAP_SIM_PSEUDONYM_PREFIX '3'
25 #define EAP_SIM_REAUTH_ID_PREFIX '5'
26 #define EAP_AKA_PERMANENT_PREFIX '0'
27 #define EAP_AKA_PSEUDONYM_PREFIX '2'
28 #define EAP_AKA_REAUTH_ID_PREFIX '4'
30 void * eap_sim_db_init(const char *config,
31 void (*get_complete_cb)(void *ctx, void *session_ctx),
32 void *ctx);
34 void eap_sim_db_deinit(void *priv);
36 int eap_sim_db_get_gsm_triplets(void *priv, const u8 *identity,
37 size_t identity_len, int max_chal,
38 u8 *_rand, u8 *kc, u8 *sres,
39 void *cb_session_ctx);
41 #define EAP_SIM_DB_FAILURE -1
42 #define EAP_SIM_DB_PENDING -2
44 int eap_sim_db_identity_known(void *priv, const u8 *identity,
45 size_t identity_len);
47 char * eap_sim_db_get_next_pseudonym(void *priv, int aka);
49 char * eap_sim_db_get_next_reauth_id(void *priv, int aka);
51 int eap_sim_db_add_pseudonym(void *priv, const u8 *identity,
52 size_t identity_len, char *pseudonym);
54 int eap_sim_db_add_reauth(void *priv, const u8 *identity,
55 size_t identity_len, char *reauth_id, u16 counter,
56 const u8 *mk);
58 const u8 * eap_sim_db_get_permanent(void *priv, const u8 *identity,
59 size_t identity_len, size_t *len);
61 struct eap_sim_reauth {
62 struct eap_sim_reauth *next;
63 u8 *identity;
64 size_t identity_len;
65 char *reauth_id;
66 u16 counter;
67 u8 mk[EAP_SIM_MK_LEN];
70 struct eap_sim_reauth *
71 eap_sim_db_get_reauth_entry(void *priv, const u8 *identity,
72 size_t identity_len);
74 void eap_sim_db_remove_reauth(void *priv, struct eap_sim_reauth *reauth);
76 int eap_sim_db_get_aka_auth(void *priv, const u8 *identity,
77 size_t identity_len, u8 *_rand, u8 *autn, u8 *ik,
78 u8 *ck, u8 *res, size_t *res_len,
79 void *cb_session_ctx);
81 int eap_sim_db_resynchronize(void *priv, const u8 *identity,
82 size_t identity_len, const u8 *auts,
83 const u8 *_rand);
85 #else /* EAP_SIM */
86 static inline void *
87 eap_sim_db_init(const char *config,
88 void (*get_complete_cb)(void *ctx, void *session_ctx),
89 void *ctx)
91 return (void *) 1;
94 static inline void eap_sim_db_deinit(void *priv)
97 #endif /* EAP_SIM */
99 #endif /* EAP_SIM_DB_H */