00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef EAPOL_AUTH_SM_H
00016 #define EAPOL_AUTH_SM_H
00017
00018 #define EAPOL_SM_PREAUTH BIT(0)
00019 #define EAPOL_SM_WAIT_START BIT(1)
00020 #define EAPOL_SM_USES_WPA BIT(2)
00021 #define EAPOL_SM_FROM_PMKSA_CACHE BIT(3)
00022
00023 struct eapol_auth_config {
00024 int eap_reauth_period;
00025 int wpa;
00026 int individual_wep_key_len;
00027 int eap_server;
00028 void *ssl_ctx;
00029 void *msg_ctx;
00030 void *eap_sim_db_priv;
00031 char *eap_req_id_text;
00032 size_t eap_req_id_text_len;
00033 u8 *pac_opaque_encr_key;
00034 u8 *eap_fast_a_id;
00035 size_t eap_fast_a_id_len;
00036 char *eap_fast_a_id_info;
00037 int eap_fast_prov;
00038 int pac_key_lifetime;
00039 int pac_key_refresh_time;
00040 int eap_sim_aka_result_ind;
00041 int tnc;
00042 struct wps_context *wps;
00043
00044
00045 void *ctx;
00046 };
00047
00048 struct eap_user;
00049
00050 typedef enum {
00051 EAPOL_LOGGER_DEBUG, EAPOL_LOGGER_INFO, EAPOL_LOGGER_WARNING
00052 } eapol_logger_level;
00053
00054 enum eapol_event {
00055 EAPOL_AUTH_SM_CHANGE,
00056 EAPOL_AUTH_REAUTHENTICATE
00057 };
00058
00059 struct eapol_auth_cb {
00060 void (*eapol_send)(void *ctx, void *sta_ctx, u8 type, const u8 *data,
00061 size_t datalen);
00062 void (*aaa_send)(void *ctx, void *sta_ctx, const u8 *data,
00063 size_t datalen);
00064 void (*finished)(void *ctx, void *sta_ctx, int success, int preauth);
00065 int (*get_eap_user)(void *ctx, const u8 *identity, size_t identity_len,
00066 int phase2, struct eap_user *user);
00067 int (*sta_entry_alive)(void *ctx, const u8 *addr);
00068 void (*logger)(void *ctx, const u8 *addr, eapol_logger_level level,
00069 const char *txt);
00070 void (*set_port_authorized)(void *ctx, void *sta_ctx, int authorized);
00071 void (*abort_auth)(void *ctx, void *sta_ctx);
00072 void (*tx_key)(void *ctx, void *sta_ctx);
00073 void (*eapol_event)(void *ctx, void *sta_ctx, enum eapol_event type);
00074 };
00075
00076
00077 struct eapol_authenticator * eapol_auth_init(struct eapol_auth_config *conf,
00078 struct eapol_auth_cb *cb);
00079 void eapol_auth_deinit(struct eapol_authenticator *eapol);
00080 struct eapol_state_machine *
00081 eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
00082 int flags, const struct wpabuf *assoc_wps_ie, void *sta_ctx);
00083 void eapol_auth_free(struct eapol_state_machine *sm);
00084 void eapol_auth_step(struct eapol_state_machine *sm);
00085 void eapol_auth_dump_state(FILE *f, const char *prefix,
00086 struct eapol_state_machine *sm);
00087 int eapol_auth_eap_pending_cb(struct eapol_state_machine *sm, void *ctx);
00088
00089 #endif