hostapd
eap.h
1 /*
2  * EAP peer state machine functions (RFC 4137)
3  * Copyright (c) 2004-2012, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #ifndef EAP_H
10 #define EAP_H
11 
12 #include "common/defs.h"
13 #include "eap_common/eap_defs.h"
14 #include "eap_peer/eap_methods.h"
15 
16 struct eap_sm;
17 struct wpa_config_blob;
18 struct wpabuf;
19 
21  int vendor;
22  u32 method;
23 };
24 
25 #ifdef IEEE8021X_EAPOL
26 
35 enum eapol_bool_var {
41  EAPOL_eapSuccess,
42 
48  EAPOL_eapRestart,
49 
55  EAPOL_eapFail,
56 
62  EAPOL_eapResp,
63 
69  EAPOL_eapNoResp,
70 
76  EAPOL_eapReq,
77 
83  EAPOL_portEnabled,
84 
90  EAPOL_altAccept,
91 
97  EAPOL_altReject,
98 
104  EAPOL_eapTriggerStart
105 };
106 
115 enum eapol_int_var {
125  EAPOL_idleWhile
126 };
127 
137 struct eapol_callbacks {
142  struct eap_peer_config * (*get_config)(void *ctx);
143 
149  Boolean (*get_bool)(void *ctx, enum eapol_bool_var variable);
150 
157  void (*set_bool)(void *ctx, enum eapol_bool_var variable,
158  Boolean value);
159 
166  unsigned int (*get_int)(void *ctx, enum eapol_int_var variable);
167 
174  void (*set_int)(void *ctx, enum eapol_int_var variable,
175  unsigned int value);
176 
184  struct wpabuf * (*get_eapReqData)(void *ctx);
185 
194  void (*set_config_blob)(void *ctx, struct wpa_config_blob *blob);
195 
202  const struct wpa_config_blob * (*get_config_blob)(void *ctx,
203  const char *name);
204 
215  void (*notify_pending)(void *ctx);
216 
223  void (*eap_param_needed)(void *ctx, enum wpa_ctrl_req_type field,
224  const char *txt);
225 
236  void (*notify_cert)(void *ctx, int depth, const char *subject,
237  const char *altsubject[], int num_altsubject,
238  const char *cert_hash, const struct wpabuf *cert);
239 
246  void (*notify_status)(void *ctx, const char *status,
247  const char *parameter);
248 
249 #ifdef CONFIG_EAP_PROXY
250 
254  void (*eap_proxy_cb)(void *ctx);
255 
261  void (*eap_proxy_notify_sim_status)(void *ctx,
262  enum eap_proxy_sim_state sim_state);
263 #endif /* CONFIG_EAP_PROXY */
264 
271  void (*set_anon_id)(void *ctx, const u8 *id, size_t len);
272 };
273 
277 struct eap_config {
283  const char *opensc_engine_path;
289  const char *pkcs11_engine_path;
295  const char *pkcs11_module_path;
303  const char *openssl_ciphers;
309  struct wps_context *wps;
310 
314  int cert_in_cb;
315 };
316 
317 struct eap_sm * eap_peer_sm_init(void *eapol_ctx,
318  const struct eapol_callbacks *eapol_cb,
319  void *msg_ctx, struct eap_config *conf);
320 void eap_peer_sm_deinit(struct eap_sm *sm);
321 int eap_peer_sm_step(struct eap_sm *sm);
322 void eap_sm_abort(struct eap_sm *sm);
323 int eap_sm_get_status(struct eap_sm *sm, char *buf, size_t buflen,
324  int verbose);
325 const char * eap_sm_get_method_name(struct eap_sm *sm);
326 struct wpabuf * eap_sm_buildIdentity(struct eap_sm *sm, int id, int encrypted);
327 void eap_sm_request_identity(struct eap_sm *sm);
328 void eap_sm_request_password(struct eap_sm *sm);
329 void eap_sm_request_new_password(struct eap_sm *sm);
330 void eap_sm_request_pin(struct eap_sm *sm);
331 void eap_sm_request_otp(struct eap_sm *sm, const char *msg, size_t msg_len);
332 void eap_sm_request_passphrase(struct eap_sm *sm);
333 void eap_sm_request_sim(struct eap_sm *sm, const char *req);
334 void eap_sm_notify_ctrl_attached(struct eap_sm *sm);
335 u32 eap_get_phase2_type(const char *name, int *vendor);
336 struct eap_method_type * eap_get_phase2_types(struct eap_peer_config *config,
337  size_t *count);
338 void eap_set_fast_reauth(struct eap_sm *sm, int enabled);
339 void eap_set_workaround(struct eap_sm *sm, unsigned int workaround);
340 void eap_set_force_disabled(struct eap_sm *sm, int disabled);
341 void eap_set_external_sim(struct eap_sm *sm, int external_sim);
342 int eap_key_available(struct eap_sm *sm);
343 void eap_notify_success(struct eap_sm *sm);
344 void eap_notify_lower_layer_success(struct eap_sm *sm);
345 const u8 * eap_get_eapSessionId(struct eap_sm *sm, size_t *len);
346 const u8 * eap_get_eapKeyData(struct eap_sm *sm, size_t *len);
347 struct wpabuf * eap_get_eapRespData(struct eap_sm *sm);
348 void eap_register_scard_ctx(struct eap_sm *sm, void *ctx);
349 void eap_invalidate_cached_session(struct eap_sm *sm);
350 
351 int eap_is_wps_pbc_enrollee(struct eap_peer_config *conf);
352 int eap_is_wps_pin_enrollee(struct eap_peer_config *conf);
353 
354 struct ext_password_data;
355 void eap_sm_set_ext_pw_ctx(struct eap_sm *sm, struct ext_password_data *ext);
356 void eap_set_anon_id(struct eap_sm *sm, const u8 *id, size_t len);
357 int eap_peer_was_failure_expected(struct eap_sm *sm);
358 void eap_peer_erp_free_keys(struct eap_sm *sm);
359 struct wpabuf * eap_peer_build_erp_reauth_start(struct eap_sm *sm, u8 eap_id);
360 void eap_peer_finish(struct eap_sm *sm, const struct eap_hdr *hdr, size_t len);
361 
362 #endif /* IEEE8021X_EAPOL */
363 
364 #endif /* EAP_H */
Definition: config.py:1
Definition: wpabuf.h:20
Definition: eap.h:20
struct wpa_config_blob - Named configuration blob
Definition: eap_config.h:766
Definition: ext_password.c:26
Definition: eap.h:95
Definition: eap_defs.h:18
struct eapol_ctx - Global (for all networks) EAPOL state machine context
Definition: eapol_supp_sm.h:82
Definition: eap.h:107
struct eap_sm - EAP state machine data
Definition: eap_i.h:294
struct eap_peer_config - EAP peer configuration/credentials
Definition: eap_config.h:15
char * name
name - Blob name
Definition: eap_config.h:770
struct wps_context - Long term WPS context data
Definition: wps.h:594