eap.h revision 1f69aa52ea2e0a73ac502565df8c666ee49cab6a
1/* 2 * hostapd / EAP Full Authenticator state machine (RFC 4137) 3 * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi> 4 * 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. 8 * 9 * Alternatively, this software may be distributed under the terms of BSD 10 * license. 11 * 12 * See README and COPYING for more details. 13 */ 14 15#ifndef EAP_H 16#define EAP_H 17 18#include "common/defs.h" 19#include "eap_common/eap_defs.h" 20#include "eap_server/eap_methods.h" 21#include "wpabuf.h" 22 23struct eap_sm; 24 25#define EAP_TTLS_AUTH_PAP 1 26#define EAP_TTLS_AUTH_CHAP 2 27#define EAP_TTLS_AUTH_MSCHAP 4 28#define EAP_TTLS_AUTH_MSCHAPV2 8 29 30struct eap_user { 31 struct { 32 int vendor; 33 u32 method; 34 } methods[EAP_MAX_METHODS]; 35 u8 *password; 36 size_t password_len; 37 int password_hash; /* whether password is hashed with 38 * nt_password_hash() */ 39 int phase2; 40 int force_version; 41 int ttls_auth; /* bitfield of 42 * EAP_TTLS_AUTH_{PAP,CHAP,MSCHAP,MSCHAPV2} */ 43}; 44 45struct eap_eapol_interface { 46 /* Lower layer to full authenticator variables */ 47 Boolean eapResp; /* shared with EAPOL Backend Authentication */ 48 struct wpabuf *eapRespData; 49 Boolean portEnabled; 50 int retransWhile; 51 Boolean eapRestart; /* shared with EAPOL Authenticator PAE */ 52 int eapSRTT; 53 int eapRTTVAR; 54 55 /* Full authenticator to lower layer variables */ 56 Boolean eapReq; /* shared with EAPOL Backend Authentication */ 57 Boolean eapNoReq; /* shared with EAPOL Backend Authentication */ 58 Boolean eapSuccess; 59 Boolean eapFail; 60 Boolean eapTimeout; 61 struct wpabuf *eapReqData; 62 u8 *eapKeyData; 63 size_t eapKeyDataLen; 64 Boolean eapKeyAvailable; /* called keyAvailable in IEEE 802.1X-2004 */ 65 66 /* AAA interface to full authenticator variables */ 67 Boolean aaaEapReq; 68 Boolean aaaEapNoReq; 69 Boolean aaaSuccess; 70 Boolean aaaFail; 71 struct wpabuf *aaaEapReqData; 72 u8 *aaaEapKeyData; 73 size_t aaaEapKeyDataLen; 74 Boolean aaaEapKeyAvailable; 75 int aaaMethodTimeout; 76 77 /* Full authenticator to AAA interface variables */ 78 Boolean aaaEapResp; 79 struct wpabuf *aaaEapRespData; 80 /* aaaIdentity -> eap_get_identity() */ 81 Boolean aaaTimeout; 82}; 83 84struct eapol_callbacks { 85 int (*get_eap_user)(void *ctx, const u8 *identity, size_t identity_len, 86 int phase2, struct eap_user *user); 87 const char * (*get_eap_req_id_text)(void *ctx, size_t *len); 88}; 89 90struct eap_config { 91 void *ssl_ctx; 92 void *msg_ctx; 93 void *eap_sim_db_priv; 94 Boolean backend_auth; 95 int eap_server; 96 u16 pwd_group; 97 u8 *pac_opaque_encr_key; 98 u8 *eap_fast_a_id; 99 size_t eap_fast_a_id_len; 100 char *eap_fast_a_id_info; 101 int eap_fast_prov; 102 int pac_key_lifetime; 103 int pac_key_refresh_time; 104 int eap_sim_aka_result_ind; 105 int tnc; 106 struct wps_context *wps; 107 const struct wpabuf *assoc_wps_ie; 108 const struct wpabuf *assoc_p2p_ie; 109 const u8 *peer_addr; 110 int fragment_size; 111 112 int pbc_in_m1; 113}; 114 115 116struct eap_sm * eap_server_sm_init(void *eapol_ctx, 117 struct eapol_callbacks *eapol_cb, 118 struct eap_config *eap_conf); 119void eap_server_sm_deinit(struct eap_sm *sm); 120int eap_server_sm_step(struct eap_sm *sm); 121void eap_sm_notify_cached(struct eap_sm *sm); 122void eap_sm_pending_cb(struct eap_sm *sm); 123int eap_sm_method_pending(struct eap_sm *sm); 124const u8 * eap_get_identity(struct eap_sm *sm, size_t *len); 125struct eap_eapol_interface * eap_get_interface(struct eap_sm *sm); 126void eap_server_clear_identity(struct eap_sm *sm); 127 128#endif /* EAP_H */ 129