wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
eap_i.h
Go to the documentation of this file.
1 
5 #ifndef EAP_I_H
6 #define EAP_I_H
7 
8 #include "wpabuf.h"
9 #include "eap_server/eap.h"
10 #include "eap_common/eap_common.h"
11 
12 /* RFC 4137 - EAP Standalone Authenticator */
13 
20 struct eap_method {
21  int vendor;
22  EapType method;
23  const char *name;
24 
25  void * (*init)(struct eap_sm *sm);
26  void * (*initPickUp)(struct eap_sm *sm);
27  void (*reset)(struct eap_sm *sm, void *priv);
28 
29  struct wpabuf * (*buildReq)(struct eap_sm *sm, void *priv, u8 id);
30  int (*getTimeout)(struct eap_sm *sm, void *priv);
31  Boolean (*check)(struct eap_sm *sm, void *priv,
32  struct wpabuf *respData);
33  void (*process)(struct eap_sm *sm, void *priv,
34  struct wpabuf *respData);
35  Boolean (*isDone)(struct eap_sm *sm, void *priv);
36  u8 * (*getKey)(struct eap_sm *sm, void *priv, size_t *len);
37  /* isSuccess is not specified in draft-ietf-eap-statemachine-05.txt,
38  * but it is useful in implementing Policy.getDecision() */
39  Boolean (*isSuccess)(struct eap_sm *sm, void *priv);
40 
54  void (*free)(struct eap_method *method);
55 
56 #define EAP_SERVER_METHOD_INTERFACE_VERSION 1
57 
66  int version;
67 
75  struct eap_method *next;
76 
88  u8 * (*get_emsk)(struct eap_sm *sm, void *priv, size_t *len);
89 
101  u8 * (*getSessionId)(struct eap_sm *sm, void *priv, size_t *len);
102 };
103 
108 struct eap_sm {
109  enum {
110  EAP_DISABLED, EAP_INITIALIZE, EAP_IDLE, EAP_RECEIVED,
111  EAP_INTEGRITY_CHECK, EAP_METHOD_RESPONSE, EAP_METHOD_REQUEST,
112  EAP_PROPOSE_METHOD, EAP_SELECT_ACTION, EAP_SEND_REQUEST,
113  EAP_DISCARD, EAP_NAK, EAP_RETRANSMIT, EAP_SUCCESS, EAP_FAILURE,
114  EAP_TIMEOUT_FAILURE, EAP_PICK_UP_METHOD,
115  EAP_INITIALIZE_PASSTHROUGH, EAP_IDLE2, EAP_RETRANSMIT2,
116  EAP_RECEIVED2, EAP_DISCARD2, EAP_SEND_REQUEST2,
117  EAP_AAA_REQUEST, EAP_AAA_RESPONSE, EAP_AAA_IDLE,
118  EAP_TIMEOUT_FAILURE2, EAP_FAILURE2, EAP_SUCCESS2,
119  EAP_INITIATE_REAUTH_START, EAP_INITIATE_RECEIVED
120  } EAP_state;
121 
122  /* Constants */
123  int MaxRetrans;
124 
125  struct eap_eapol_interface eap_if;
126 
127  /* Full authenticator state machine local variables */
128 
129  /* Long-term (maintained between packets) */
130  EapType currentMethod;
131  int currentId;
132  enum {
133  METHOD_PROPOSED, METHOD_CONTINUE, METHOD_END
134  } methodState;
135  int retransCount;
136  struct wpabuf *lastReqData;
137  int methodTimeout;
138 
139  /* Short-term (not maintained between packets) */
140  Boolean rxResp;
141  Boolean rxInitiate;
142  int respId;
143  EapType respMethod;
144  int respVendor;
145  u32 respVendorMethod;
146  Boolean ignore;
147  enum {
148  DECISION_SUCCESS, DECISION_FAILURE, DECISION_CONTINUE,
149  DECISION_PASSTHROUGH, DECISION_INITIATE_REAUTH_START
150  } decision;
151 
152  /* Miscellaneous variables */
153  const struct eap_method *m; /* selected EAP method */
154  /* not defined in RFC 4137 */
155  Boolean changed;
156  void *eapol_ctx, *msg_ctx;
157  const struct eapol_callbacks *eapol_cb;
158  void *eap_method_priv;
159  u8 *identity;
160  size_t identity_len;
161  /* Whether Phase 2 method should validate identity match */
162  int require_identity_match;
163  int lastId; /* Identifier used in the last EAP-Packet */
164  struct eap_user *user;
165  int user_eap_method_index;
166  int init_phase2;
167  void *ssl_ctx;
168  struct eap_sim_db_data *eap_sim_db_priv;
169  Boolean backend_auth;
170  Boolean update_user;
171  int eap_server;
172 
173  int num_rounds;
174  enum {
175  METHOD_PENDING_NONE, METHOD_PENDING_WAIT, METHOD_PENDING_CONT
176  } method_pending;
177 
178  u8 *auth_challenge;
179  u8 *peer_challenge;
180 
181  u8 *pac_opaque_encr_key;
182  u8 *eap_fast_a_id;
183  size_t eap_fast_a_id_len;
184  char *eap_fast_a_id_info;
185  enum {
186  NO_PROV, ANON_PROV, AUTH_PROV, BOTH_PROV
187  } eap_fast_prov;
188  int pac_key_lifetime;
189  int pac_key_refresh_time;
190  int eap_sim_aka_result_ind;
191  int tnc;
192  u16 pwd_group;
193  struct wps_context *wps;
194  struct wpabuf *assoc_wps_ie;
195  struct wpabuf *assoc_p2p_ie;
196 
197  Boolean start_reauth;
198 
199  u8 peer_addr[ETH_ALEN];
200 
201  /* Fragmentation size for EAP method init() handler */
202  int fragment_size;
203 
204  int pbc_in_m1;
205 
206  const u8 *server_id;
207  size_t server_id_len;
208 
209  Boolean initiate_reauth_start_sent;
210  Boolean try_initiate_reauth;
211  int erp;
212  unsigned int tls_session_lifetime;
213 
214 #ifdef CONFIG_TESTING_OPTIONS
215  u32 tls_test_flags;
216 #endif /* CONFIG_TESTING_OPTIONS */
217 };
218 
219 int eap_user_get(struct eap_sm *sm, const u8 *identity, size_t identity_len,
220  int phase2);
221 void eap_log_msg(struct eap_sm *sm, const char *fmt, ...)
222 PRINTF_FORMAT(2, 3);
223 void eap_sm_process_nak(struct eap_sm *sm, const u8 *nak_list, size_t len);
224 
225 #endif /* EAP_I_H */
struct wpabuf *(* process)(struct eap_sm *sm, void *priv, struct eap_method_ret *ret, const struct wpabuf *reqData)
Process an EAP request.
Definition: eap_i.h:120
int vendor
EAP Vendor-ID (EAP_VENDOR_*) (0 = IETF)
Definition: eap_i.h:70
Definition: wpabuf.h:16
struct eap_method * next
Pointer to the next EAP method.
Definition: eap_i.h:246
Definition: eap.h:21
Definition: eap.h:39
Dynamic data buffer.
Definition: eap_sim_db.c:56
EapType method
EAP type number (EAP_TYPE_*)
Definition: eap_i.h:76
void(* free)(struct eap_method *method)
Free EAP method data.
Definition: eap_i.h:225
void void eap_sm_process_nak(struct eap_sm *sm, const u8 *nak_list, size_t len)
Process EAP-Response/Nak.
Definition: eap_server.c:1580
Callback functions from EAP to lower layer.
Definition: eap.h:147
const char * name
Name of the method (e.g., "TLS")
Definition: eap_i.h:82
hostapd / EAP Full Authenticator state machine (RFC 4137)
Global (for all networks) EAPOL state machine context.
Definition: eapol_supp_sm.h:87
int eap_user_get(struct eap_sm *sm, const u8 *identity, size_t identity_len, int phase2)
Fetch user information from the database.
Definition: eap_server.c:158
EAP common peer/server definitions.
int version
Version of the EAP peer method interface.
Definition: eap_i.h:237
EAP state machine data.
Definition: eap_i.h:302
Long term WPS context data.
Definition: wps.h:623
EAP method interface This structure defines the EAP method interface. Each method will need to regist...
Definition: eap_i.h:65