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 "utils/list.h"
10 #include "eap_peer/eap.h"
11 #include "eap_common/eap_common.h"
12 
13 /* RFC 4137 - EAP Peer state machine */
14 
15 typedef enum {
16  DECISION_FAIL, DECISION_COND_SUCC, DECISION_UNCOND_SUCC
17 } EapDecision;
18 
19 typedef enum {
20  METHOD_NONE, METHOD_INIT, METHOD_CONT, METHOD_MAY_CONT, METHOD_DONE
21 } EapMethodState;
22 
37  Boolean ignore;
38 
43  EapMethodState methodState;
44 
49  EapDecision decision;
50 
56 };
57 
58 
65 struct eap_method {
70  int vendor;
71 
76  EapType method;
77 
82  const char *name;
83 
94  void * (*init)(struct eap_sm *sm);
95 
103  void (*deinit)(struct eap_sm *sm, void *priv);
104 
120  struct wpabuf * (*process)(struct eap_sm *sm, void *priv,
121  struct eap_method_ret *ret,
122  const struct wpabuf *reqData);
123 
130  Boolean (*isKeyAvailable)(struct eap_sm *sm, void *priv);
131 
143  u8 * (*getKey)(struct eap_sm *sm, void *priv, size_t *len);
144 
159  int (*get_status)(struct eap_sm *sm, void *priv, char *buf,
160  size_t buflen, int verbose);
161 
172  Boolean (*has_reauth_data)(struct eap_sm *sm, void *priv);
173 
185  void (*deinit_for_reauth)(struct eap_sm *sm, void *priv);
186 
197  void * (*init_for_reauth)(struct eap_sm *sm, void *priv);
198 
210  const u8 * (*get_identity)(struct eap_sm *sm, void *priv, size_t *len);
211 
225  void (*free)(struct eap_method *method);
226 
227 #define EAP_PEER_METHOD_INTERFACE_VERSION 1
228 
237  int version;
238 
246  struct eap_method *next;
247 
248 #ifdef CONFIG_DYNAMIC_EAP_METHODS
249 
257  void *dl_handle;
258 #endif /* CONFIG_DYNAMIC_EAP_METHODS */
259 
271  u8 * (*get_emsk)(struct eap_sm *sm, void *priv, size_t *len);
272 
284  u8 * (*getSessionId)(struct eap_sm *sm, void *priv, size_t *len);
285 };
286 
287 
288 struct eap_erp_key {
289  struct dl_list list;
290  size_t rRK_len;
291  size_t rIK_len;
292  u8 rRK[ERP_MAX_KEY_LEN];
293  u8 rIK[ERP_MAX_KEY_LEN];
294  u32 next_seq;
295  char keyname_nai[];
296 };
297 
302 struct eap_sm {
303  enum {
304  EAP_INITIALIZE, EAP_DISABLED, EAP_IDLE, EAP_RECEIVED,
305  EAP_GET_METHOD, EAP_METHOD, EAP_SEND_RESPONSE, EAP_DISCARD,
306  EAP_IDENTITY, EAP_NOTIFICATION, EAP_RETRANSMIT, EAP_SUCCESS,
307  EAP_FAILURE
308  } EAP_state;
309  /* Long-term local variables */
310  EapType selectedMethod;
311  EapMethodState methodState;
312  int lastId;
313  struct wpabuf *lastRespData;
314  EapDecision decision;
315  /* Short-term local variables */
316  Boolean rxReq;
317  Boolean rxSuccess;
318  Boolean rxFailure;
319  int reqId;
320  EapType reqMethod;
321  int reqVendor;
322  u32 reqVendorMethod;
323  Boolean ignore;
324  /* Constants */
325  int ClientTimeout;
326 
327  /* Miscellaneous variables */
328  Boolean allowNotifications; /* peer state machine <-> methods */
329  struct wpabuf *eapRespData; /* peer to lower layer */
330  Boolean eapKeyAvailable; /* peer to lower layer */
331  u8 *eapKeyData; /* peer to lower layer */
332  size_t eapKeyDataLen; /* peer to lower layer */
333  u8 *eapSessionId; /* peer to lower layer */
334  size_t eapSessionIdLen; /* peer to lower layer */
335  const struct eap_method *m; /* selected EAP method */
336  /* not defined in RFC 4137 */
337  Boolean changed;
338  void *eapol_ctx;
339  const struct eapol_callbacks *eapol_cb;
340  void *eap_method_priv;
341  int init_phase2;
342  int fast_reauth;
343  Boolean reauthInit; /* send EAP-Identity/Re-auth */
344  u32 erp_seq;
345 
346  Boolean rxResp /* LEAP only */;
347  Boolean leap_done;
348  Boolean peap_done;
349  u8 req_sha1[20]; /* SHA1() of the current EAP packet */
350  u8 last_sha1[20]; /* SHA1() of the previously received EAP packet; used
351  * in duplicate request detection. */
352 
353  void *msg_ctx;
354  void *scard_ctx;
355  void *ssl_ctx;
356  void *ssl_ctx2;
357 
358  unsigned int workaround;
359 
360  /* Optional challenges generated in Phase 1 (EAP-FAST) */
361  u8 *peer_challenge, *auth_challenge;
362 
363  int num_rounds;
364  int force_disabled;
365 
366  struct wps_context *wps;
367 
368  int prev_failure;
369  struct eap_peer_config *last_config;
370 
371  struct ext_password_data *ext_pw;
372  struct wpabuf *ext_pw_buf;
373 
374  int external_sim;
375 
376  unsigned int expected_failure:1;
377 
378  struct dl_list erp_keys; /* struct eap_erp_key */
379 };
380 
381 const u8 * eap_get_config_identity(struct eap_sm *sm, size_t *len);
382 const u8 * eap_get_config_password(struct eap_sm *sm, size_t *len);
383 const u8 * eap_get_config_password2(struct eap_sm *sm, size_t *len, int *hash);
384 const u8 * eap_get_config_new_password(struct eap_sm *sm, size_t *len);
385 const u8 * eap_get_config_otp(struct eap_sm *sm, size_t *len);
386 void eap_clear_config_otp(struct eap_sm *sm);
387 const char * eap_get_config_phase1(struct eap_sm *sm);
388 const char * eap_get_config_phase2(struct eap_sm *sm);
389 int eap_get_config_fragment_size(struct eap_sm *sm);
390 struct eap_peer_config * eap_get_config(struct eap_sm *sm);
391 void eap_set_config_blob(struct eap_sm *sm, struct wpa_config_blob *blob);
392 const struct wpa_config_blob *
393 eap_get_config_blob(struct eap_sm *sm, const char *name);
394 void eap_notify_pending(struct eap_sm *sm);
395 int eap_allowed_method(struct eap_sm *sm, int vendor, u32 method);
396 
397 #endif /* EAP_I_H */
const char * eap_get_config_phase2(struct eap_sm *sm)
Get phase2 data from the network configuration.
Definition: eap.c:2654
void eap_notify_pending(struct eap_sm *sm)
Notify that EAP method is ready to re-process a request.
Definition: eap.c:2879
EAP return values from struct eap_method::process()
Definition: eap_i.h:32
void(* deinit)(struct eap_sm *sm, void *priv)
Deinitialize an EAP method.
Definition: eap_i.h:103
const u8 * eap_get_config_identity(struct eap_sm *sm, size_t *len)
Get identity from the network configuration.
Definition: eap.c:2497
int vendor
EAP Vendor-ID (EAP_VENDOR_*) (0 = IETF)
Definition: eap_i.h:70
EapMethodState methodState
Method-specific state (IN/OUT)
Definition: eap_i.h:43
const u8 * eap_get_config_new_password(struct eap_sm *sm, size_t *len)
Get new password from network configuration.
Definition: eap.c:2589
Boolean(* isKeyAvailable)(struct eap_sm *sm, void *priv)
Find out whether EAP method has keying material.
Definition: eap_i.h:130
Boolean(* has_reauth_data)(struct eap_sm *sm, void *priv)
Whether method is ready for fast reauthentication.
Definition: eap_i.h:172
Definition: wpabuf.h:16
int eap_allowed_method(struct eap_sm *sm, int vendor, u32 method)
Check whether EAP method is allowed.
Definition: eap.c:124
struct eap_method * next
Pointer to the next EAP method.
Definition: eap_i.h:246
EapDecision decision
Authentication decision (OUT)
Definition: eap_i.h:49
Dynamic data buffer.
const u8 * eap_get_config_otp(struct eap_sm *sm, size_t *len)
Get one-time password from the network configuration.
Definition: eap.c:2605
Doubly-linked list.
EapType method
EAP type number (EAP_TYPE_*)
Definition: eap_i.h:76
Doubly-linked list.
Definition: list.h:12
Named configuration blob.
Definition: eap_config.h:812
void eap_set_config_blob(struct eap_sm *sm, struct wpa_config_blob *blob)
Set or add a named configuration blob.
Definition: eap.c:2820
Definition: ext_password.c:26
void(* free)(struct eap_method *method)
Free EAP method data.
Definition: eap_i.h:225
Callback functions from EAP to lower layer.
Definition: eap.h:147
struct eap_peer_config * eap_get_config(struct eap_sm *sm)
Get current network configuration.
Definition: eap.c:2485
void(* deinit_for_reauth)(struct eap_sm *sm, void *priv)
Release data that is not needed for fast re-auth.
Definition: eap_i.h:185
const char * name
Name of the method (e.g., "TLS")
Definition: eap_i.h:82
Definition: eap_i.h:288
Global (for all networks) EAPOL state machine context.
Definition: eapol_supp_sm.h:87
const char * eap_get_config_phase1(struct eap_sm *sm)
Get phase1 data from the network configuration.
Definition: eap.c:2640
EAP common peer/server definitions.
const struct wpa_config_blob * eap_get_config_blob(struct eap_sm *sm, const char *name)
Get a named configuration blob.
Definition: eap.c:2834
EAP peer state machine functions (RFC 4137)
int version
Version of the EAP peer method interface.
Definition: eap_i.h:237
Boolean allowNotifications
Whether method allows notifications (OUT)
Definition: eap_i.h:55
EAP state machine data.
Definition: eap_i.h:302
Boolean ignore
Whether method decided to drop the current packed (OUT)
Definition: eap_i.h:37
const u8 * eap_get_config_password2(struct eap_sm *sm, size_t *len, int *hash)
Get password from the network configuration.
Definition: eap.c:2561
EAP peer configuration/credentials.
Definition: eap_config.h:12
char * name
Blob name.
Definition: eap_config.h:817
int(* get_status)(struct eap_sm *sm, void *priv, char *buf, size_t buflen, int verbose)
Get EAP method status.
Definition: eap_i.h:159
void eap_clear_config_otp(struct eap_sm *sm)
Clear used one-time password.
Definition: eap.c:2623
Long term WPS context data.
Definition: wps.h:623
const u8 * eap_get_config_password(struct eap_sm *sm, size_t *len)
Get password from the network configuration.
Definition: eap.c:2534
EAP method interface This structure defines the EAP method interface. Each method will need to regist...
Definition: eap_i.h:65