2008-02-27 17:34:43 -08:00
|
|
|
/*
|
|
|
|
* hostapd / EAP Full Authenticator state machine (RFC 4137)
|
2014-11-29 21:28:24 +02:00
|
|
|
* Copyright (c) 2004-2014, Jouni Malinen <j@w1.fi>
|
2008-02-27 17:34:43 -08:00
|
|
|
*
|
2012-02-11 16:46:35 +02:00
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
2008-02-27 17:34:43 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef EAP_H
|
|
|
|
#define EAP_H
|
|
|
|
|
2009-11-29 17:51:55 +02:00
|
|
|
#include "common/defs.h"
|
2014-11-29 21:28:24 +02:00
|
|
|
#include "utils/list.h"
|
2008-02-27 17:34:43 -08:00
|
|
|
#include "eap_common/eap_defs.h"
|
|
|
|
#include "eap_server/eap_methods.h"
|
|
|
|
#include "wpabuf.h"
|
|
|
|
|
|
|
|
struct eap_sm;
|
|
|
|
|
|
|
|
#define EAP_TTLS_AUTH_PAP 1
|
|
|
|
#define EAP_TTLS_AUTH_CHAP 2
|
|
|
|
#define EAP_TTLS_AUTH_MSCHAP 4
|
|
|
|
#define EAP_TTLS_AUTH_MSCHAPV2 8
|
|
|
|
|
|
|
|
struct eap_user {
|
|
|
|
struct {
|
|
|
|
int vendor;
|
|
|
|
u32 method;
|
|
|
|
} methods[EAP_MAX_METHODS];
|
|
|
|
u8 *password;
|
|
|
|
size_t password_len;
|
|
|
|
int password_hash; /* whether password is hashed with
|
|
|
|
* nt_password_hash() */
|
2018-05-25 21:40:04 +03:00
|
|
|
u8 *salt;
|
|
|
|
size_t salt_len;
|
2008-02-27 17:34:43 -08:00
|
|
|
int phase2;
|
|
|
|
int force_version;
|
2012-11-21 17:04:21 +02:00
|
|
|
unsigned int remediation:1;
|
2014-03-29 19:31:56 +02:00
|
|
|
unsigned int macacl:1;
|
2008-02-27 17:34:43 -08:00
|
|
|
int ttls_auth; /* bitfield of
|
|
|
|
* EAP_TTLS_AUTH_{PAP,CHAP,MSCHAP,MSCHAPV2} */
|
2014-03-07 23:19:52 +02:00
|
|
|
struct hostapd_radius_attr *accept_attr;
|
2018-04-26 00:57:44 +03:00
|
|
|
u32 t_c_timestamp;
|
2008-02-27 17:34:43 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct eap_eapol_interface {
|
|
|
|
/* Lower layer to full authenticator variables */
|
|
|
|
Boolean eapResp; /* shared with EAPOL Backend Authentication */
|
|
|
|
struct wpabuf *eapRespData;
|
|
|
|
Boolean portEnabled;
|
|
|
|
int retransWhile;
|
|
|
|
Boolean eapRestart; /* shared with EAPOL Authenticator PAE */
|
|
|
|
int eapSRTT;
|
|
|
|
int eapRTTVAR;
|
|
|
|
|
|
|
|
/* Full authenticator to lower layer variables */
|
|
|
|
Boolean eapReq; /* shared with EAPOL Backend Authentication */
|
|
|
|
Boolean eapNoReq; /* shared with EAPOL Backend Authentication */
|
|
|
|
Boolean eapSuccess;
|
|
|
|
Boolean eapFail;
|
|
|
|
Boolean eapTimeout;
|
|
|
|
struct wpabuf *eapReqData;
|
|
|
|
u8 *eapKeyData;
|
|
|
|
size_t eapKeyDataLen;
|
2014-11-29 23:46:45 +02:00
|
|
|
u8 *eapSessionId;
|
|
|
|
size_t eapSessionIdLen;
|
2008-02-27 17:34:43 -08:00
|
|
|
Boolean eapKeyAvailable; /* called keyAvailable in IEEE 802.1X-2004 */
|
|
|
|
|
|
|
|
/* AAA interface to full authenticator variables */
|
|
|
|
Boolean aaaEapReq;
|
|
|
|
Boolean aaaEapNoReq;
|
|
|
|
Boolean aaaSuccess;
|
|
|
|
Boolean aaaFail;
|
|
|
|
struct wpabuf *aaaEapReqData;
|
|
|
|
u8 *aaaEapKeyData;
|
|
|
|
size_t aaaEapKeyDataLen;
|
|
|
|
Boolean aaaEapKeyAvailable;
|
|
|
|
int aaaMethodTimeout;
|
|
|
|
|
|
|
|
/* Full authenticator to AAA interface variables */
|
|
|
|
Boolean aaaEapResp;
|
|
|
|
struct wpabuf *aaaEapRespData;
|
|
|
|
/* aaaIdentity -> eap_get_identity() */
|
|
|
|
Boolean aaaTimeout;
|
|
|
|
};
|
|
|
|
|
2014-11-29 21:28:24 +02:00
|
|
|
struct eap_server_erp_key {
|
|
|
|
struct dl_list list;
|
|
|
|
size_t rRK_len;
|
|
|
|
size_t rIK_len;
|
|
|
|
u8 rRK[ERP_MAX_KEY_LEN];
|
|
|
|
u8 rIK[ERP_MAX_KEY_LEN];
|
|
|
|
u32 recv_seq;
|
|
|
|
u8 cryptosuite;
|
|
|
|
char keyname_nai[];
|
|
|
|
};
|
|
|
|
|
2008-02-27 17:34:43 -08:00
|
|
|
struct eapol_callbacks {
|
|
|
|
int (*get_eap_user)(void *ctx, const u8 *identity, size_t identity_len,
|
|
|
|
int phase2, struct eap_user *user);
|
|
|
|
const char * (*get_eap_req_id_text)(void *ctx, size_t *len);
|
2014-02-28 14:41:42 +02:00
|
|
|
void (*log_msg)(void *ctx, const char *msg);
|
2014-11-29 20:33:09 +02:00
|
|
|
int (*get_erp_send_reauth_start)(void *ctx);
|
|
|
|
const char * (*get_erp_domain)(void *ctx);
|
2014-11-29 21:28:24 +02: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-27 17:34:43 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct eap_config {
|
|
|
|
void *ssl_ctx;
|
2010-04-07 11:13:14 +03:00
|
|
|
void *msg_ctx;
|
2008-02-27 17:34:43 -08:00
|
|
|
void *eap_sim_db_priv;
|
|
|
|
Boolean backend_auth;
|
|
|
|
int eap_server;
|
2010-09-14 21:51:40 -10:00
|
|
|
u16 pwd_group;
|
2008-02-27 17:34:43 -08:00
|
|
|
u8 *pac_opaque_encr_key;
|
2008-10-19 09:55:59 +03:00
|
|
|
u8 *eap_fast_a_id;
|
|
|
|
size_t eap_fast_a_id_len;
|
|
|
|
char *eap_fast_a_id_info;
|
2008-10-08 16:55:23 +03:00
|
|
|
int eap_fast_prov;
|
2008-10-08 17:25:47 +03:00
|
|
|
int pac_key_lifetime;
|
|
|
|
int pac_key_refresh_time;
|
2008-02-27 17:34:43 -08:00
|
|
|
int eap_sim_aka_result_ind;
|
2008-03-09 10:42:53 +02:00
|
|
|
int tnc;
|
2008-11-23 19:34:26 +02:00
|
|
|
struct wps_context *wps;
|
2008-11-29 12:11:56 +02:00
|
|
|
const struct wpabuf *assoc_wps_ie;
|
2010-07-18 14:30:25 -07:00
|
|
|
const struct wpabuf *assoc_p2p_ie;
|
2009-09-07 22:09:13 +03:00
|
|
|
const u8 *peer_addr;
|
2010-07-18 19:28:53 -07:00
|
|
|
int fragment_size;
|
2011-05-17 19:53:02 +03:00
|
|
|
|
|
|
|
int pbc_in_m1;
|
2013-07-06 18:17:15 +03:00
|
|
|
|
|
|
|
const u8 *server_id;
|
|
|
|
size_t server_id_len;
|
2014-11-29 21:28:24 +02:00
|
|
|
int erp;
|
2015-08-23 21:26:39 +03:00
|
|
|
unsigned int tls_session_lifetime;
|
2017-09-17 00:11:37 +03:00
|
|
|
unsigned int tls_flags;
|
2014-03-02 00:43:59 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_TESTING_OPTIONS
|
|
|
|
u32 tls_test_flags;
|
|
|
|
#endif /* CONFIG_TESTING_OPTIONS */
|
2008-02-27 17:34:43 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct eap_sm * eap_server_sm_init(void *eapol_ctx,
|
2015-04-24 09:19:53 +02:00
|
|
|
const struct eapol_callbacks *eapol_cb,
|
2008-02-27 17:34:43 -08:00
|
|
|
struct eap_config *eap_conf);
|
|
|
|
void eap_server_sm_deinit(struct eap_sm *sm);
|
|
|
|
int eap_server_sm_step(struct eap_sm *sm);
|
|
|
|
void eap_sm_notify_cached(struct eap_sm *sm);
|
|
|
|
void eap_sm_pending_cb(struct eap_sm *sm);
|
|
|
|
int eap_sm_method_pending(struct eap_sm *sm);
|
|
|
|
const u8 * eap_get_identity(struct eap_sm *sm, size_t *len);
|
|
|
|
struct eap_eapol_interface * eap_get_interface(struct eap_sm *sm);
|
2010-11-07 16:25:35 +02:00
|
|
|
void eap_server_clear_identity(struct eap_sm *sm);
|
2015-03-29 22:49:16 +03:00
|
|
|
void eap_server_mschap_rx_callback(struct eap_sm *sm, const char *source,
|
|
|
|
const u8 *username, size_t username_len,
|
|
|
|
const u8 *challenge, const u8 *response);
|
2015-09-05 00:04:21 +03:00
|
|
|
void eap_erp_update_identity(struct eap_sm *sm, const u8 *eap, size_t len);
|
2008-02-27 17:34:43 -08:00
|
|
|
|
|
|
|
#endif /* EAP_H */
|