2008-02-28 02:34:43 +01:00
|
|
|
/*
|
2009-11-29 18:12:45 +01:00
|
|
|
* IEEE 802.1X-2004 Authenticator - EAPOL state machine
|
2015-07-12 09:44:20 +02:00
|
|
|
* Copyright (c) 2002-2015, Jouni Malinen <j@w1.fi>
|
2008-02-28 02:34:43 +01:00
|
|
|
*
|
2012-02-11 15:46:35 +01:00
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
2008-02-28 02:34:43 +01:00
|
|
|
*/
|
|
|
|
|
2009-11-29 19:03:28 +01:00
|
|
|
#ifndef EAPOL_AUTH_SM_H
|
|
|
|
#define EAPOL_AUTH_SM_H
|
2008-02-28 02:34:43 +01:00
|
|
|
|
2009-11-29 22:16:04 +01:00
|
|
|
#define EAPOL_SM_PREAUTH BIT(0)
|
|
|
|
#define EAPOL_SM_WAIT_START BIT(1)
|
|
|
|
#define EAPOL_SM_USES_WPA BIT(2)
|
|
|
|
#define EAPOL_SM_FROM_PMKSA_CACHE BIT(3)
|
2008-02-28 02:34:43 +01:00
|
|
|
|
|
|
|
struct eapol_auth_config {
|
|
|
|
int eap_reauth_period;
|
|
|
|
int wpa;
|
|
|
|
int individual_wep_key_len;
|
|
|
|
int eap_server;
|
|
|
|
void *ssl_ctx;
|
2010-04-07 10:13:14 +02:00
|
|
|
void *msg_ctx;
|
2008-02-28 02:34:43 +01:00
|
|
|
void *eap_sim_db_priv;
|
|
|
|
char *eap_req_id_text; /* a copy of this will be allocated */
|
|
|
|
size_t eap_req_id_text_len;
|
2014-11-29 19:33:09 +01:00
|
|
|
int erp_send_reauth_start;
|
|
|
|
char *erp_domain; /* a copy of this will be allocated */
|
2014-11-29 20:28:24 +01:00
|
|
|
int erp; /* Whether ERP is enabled on authentication server */
|
2015-08-23 20:26:39 +02:00
|
|
|
unsigned int tls_session_lifetime;
|
2017-09-16 23:11:37 +02:00
|
|
|
unsigned int tls_flags;
|
2008-02-28 02:34:43 +01:00
|
|
|
u8 *pac_opaque_encr_key;
|
2008-10-19 08:55:59 +02:00
|
|
|
u8 *eap_fast_a_id;
|
|
|
|
size_t eap_fast_a_id_len;
|
|
|
|
char *eap_fast_a_id_info;
|
2008-10-08 15:55:23 +02:00
|
|
|
int eap_fast_prov;
|
2008-10-08 16:25:47 +02:00
|
|
|
int pac_key_lifetime;
|
|
|
|
int pac_key_refresh_time;
|
2019-07-09 15:56:02 +02:00
|
|
|
int eap_teap_auth;
|
|
|
|
int eap_teap_pac_no_inner;
|
2019-08-16 22:54:51 +02:00
|
|
|
int eap_teap_separate_result;
|
2008-02-28 02:34:43 +01:00
|
|
|
int eap_sim_aka_result_ind;
|
2019-07-31 23:02:02 +02:00
|
|
|
int eap_sim_id;
|
2008-03-09 09:42:53 +01:00
|
|
|
int tnc;
|
2008-11-23 18:34:26 +01:00
|
|
|
struct wps_context *wps;
|
2010-07-19 04:28:53 +02:00
|
|
|
int fragment_size;
|
2010-09-15 09:51:40 +02:00
|
|
|
u16 pwd_group;
|
2011-05-17 18:53:02 +02:00
|
|
|
int pbc_in_m1;
|
2013-07-06 17:17:15 +02:00
|
|
|
const u8 *server_id;
|
|
|
|
size_t server_id_len;
|
2008-02-28 02:34:43 +01:00
|
|
|
|
2009-11-29 18:49:14 +01:00
|
|
|
/* Opaque context pointer to owner data for callback functions */
|
|
|
|
void *ctx;
|
2008-02-28 02:34:43 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct eap_user;
|
2014-11-29 20:28:24 +01:00
|
|
|
struct eap_server_erp_key;
|
2008-02-28 02:34:43 +01:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
EAPOL_LOGGER_DEBUG, EAPOL_LOGGER_INFO, EAPOL_LOGGER_WARNING
|
|
|
|
} eapol_logger_level;
|
|
|
|
|
2009-11-29 18:31:50 +01:00
|
|
|
enum eapol_event {
|
|
|
|
EAPOL_AUTH_SM_CHANGE,
|
|
|
|
EAPOL_AUTH_REAUTHENTICATE
|
|
|
|
};
|
|
|
|
|
2008-02-28 02:34:43 +01:00
|
|
|
struct eapol_auth_cb {
|
|
|
|
void (*eapol_send)(void *ctx, void *sta_ctx, u8 type, const u8 *data,
|
|
|
|
size_t datalen);
|
|
|
|
void (*aaa_send)(void *ctx, void *sta_ctx, const u8 *data,
|
|
|
|
size_t datalen);
|
2012-11-21 16:04:21 +01:00
|
|
|
void (*finished)(void *ctx, void *sta_ctx, int success, int preauth,
|
|
|
|
int remediation);
|
2008-02-28 02:34:43 +01:00
|
|
|
int (*get_eap_user)(void *ctx, const u8 *identity, size_t identity_len,
|
|
|
|
int phase2, struct eap_user *user);
|
|
|
|
int (*sta_entry_alive)(void *ctx, const u8 *addr);
|
|
|
|
void (*logger)(void *ctx, const u8 *addr, eapol_logger_level level,
|
|
|
|
const char *txt);
|
|
|
|
void (*set_port_authorized)(void *ctx, void *sta_ctx, int authorized);
|
|
|
|
void (*abort_auth)(void *ctx, void *sta_ctx);
|
|
|
|
void (*tx_key)(void *ctx, void *sta_ctx);
|
2009-11-29 18:31:50 +01:00
|
|
|
void (*eapol_event)(void *ctx, void *sta_ctx, enum eapol_event type);
|
2014-11-29 20:28:24 +01:00
|
|
|
struct eap_server_erp_key * (*erp_get_key)(void *ctx,
|
|
|
|
const char *keyname);
|
|
|
|
int (*erp_add_key)(void *ctx, struct eap_server_erp_key *erp);
|
2008-02-28 02:34:43 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct eapol_authenticator * eapol_auth_init(struct eapol_auth_config *conf,
|
|
|
|
struct eapol_auth_cb *cb);
|
|
|
|
void eapol_auth_deinit(struct eapol_authenticator *eapol);
|
|
|
|
struct eapol_state_machine *
|
|
|
|
eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
|
2010-07-18 23:30:25 +02:00
|
|
|
int flags, const struct wpabuf *assoc_wps_ie,
|
2012-08-19 13:23:20 +02:00
|
|
|
const struct wpabuf *assoc_p2p_ie, void *sta_ctx,
|
|
|
|
const char *identity, const char *radius_cui);
|
2008-02-28 02:34:43 +01:00
|
|
|
void eapol_auth_free(struct eapol_state_machine *sm);
|
|
|
|
void eapol_auth_step(struct eapol_state_machine *sm);
|
2014-01-02 16:37:21 +01:00
|
|
|
int eapol_auth_dump_state(struct eapol_state_machine *sm, char *buf,
|
|
|
|
size_t buflen);
|
2008-02-28 02:34:43 +01:00
|
|
|
int eapol_auth_eap_pending_cb(struct eapol_state_machine *sm, void *ctx);
|
2015-07-12 09:44:20 +02:00
|
|
|
void eapol_auth_reauthenticate(struct eapol_state_machine *sm);
|
2015-07-12 10:31:28 +02:00
|
|
|
int eapol_auth_set_conf(struct eapol_state_machine *sm, const char *param,
|
|
|
|
const char *value);
|
2008-02-28 02:34:43 +01:00
|
|
|
|
2009-11-29 19:03:28 +01:00
|
|
|
#endif /* EAPOL_AUTH_SM_H */
|