xref: /dflybsd-src/contrib/wpa_supplicant/src/eap_peer/eap.h (revision 3a84a4273475ed07d0ab1c2dfeffdfedef35d9cd)
16d49e1aeSJan Lentfer /*
26d49e1aeSJan Lentfer  * EAP peer state machine functions (RFC 4137)
33ff40c12SJohn Marino  * Copyright (c) 2004-2012, Jouni Malinen <j@w1.fi>
46d49e1aeSJan Lentfer  *
53ff40c12SJohn Marino  * This software may be distributed under the terms of the BSD license.
63ff40c12SJohn Marino  * See README for more details.
76d49e1aeSJan Lentfer  */
86d49e1aeSJan Lentfer 
96d49e1aeSJan Lentfer #ifndef EAP_H
106d49e1aeSJan Lentfer #define EAP_H
116d49e1aeSJan Lentfer 
123ff40c12SJohn Marino #include "common/defs.h"
136d49e1aeSJan Lentfer #include "eap_common/eap_defs.h"
146d49e1aeSJan Lentfer #include "eap_peer/eap_methods.h"
156d49e1aeSJan Lentfer 
166d49e1aeSJan Lentfer struct eap_sm;
176d49e1aeSJan Lentfer struct wpa_config_blob;
186d49e1aeSJan Lentfer struct wpabuf;
19*a1157835SDaniel Fojt struct tls_cert_data;
206d49e1aeSJan Lentfer 
216d49e1aeSJan Lentfer struct eap_method_type {
226d49e1aeSJan Lentfer 	int vendor;
236d49e1aeSJan Lentfer 	u32 method;
246d49e1aeSJan Lentfer };
256d49e1aeSJan Lentfer 
266d49e1aeSJan Lentfer #ifdef IEEE8021X_EAPOL
276d49e1aeSJan Lentfer 
286d49e1aeSJan Lentfer /**
296d49e1aeSJan Lentfer  * enum eapol_bool_var - EAPOL boolean state variables for EAP state machine
306d49e1aeSJan Lentfer  *
316d49e1aeSJan Lentfer  * These variables are used in the interface between EAP peer state machine and
326d49e1aeSJan Lentfer  * lower layer. These are defined in RFC 4137, Sect. 4.1. Lower layer code is
336d49e1aeSJan Lentfer  * expected to maintain these variables and register a callback functions for
346d49e1aeSJan Lentfer  * EAP state machine to get and set the variables.
356d49e1aeSJan Lentfer  */
366d49e1aeSJan Lentfer enum eapol_bool_var {
376d49e1aeSJan Lentfer 	/**
386d49e1aeSJan Lentfer 	 * EAPOL_eapSuccess - EAP SUCCESS state reached
396d49e1aeSJan Lentfer 	 *
406d49e1aeSJan Lentfer 	 * EAP state machine reads and writes this value.
416d49e1aeSJan Lentfer 	 */
426d49e1aeSJan Lentfer 	EAPOL_eapSuccess,
436d49e1aeSJan Lentfer 
446d49e1aeSJan Lentfer 	/**
456d49e1aeSJan Lentfer 	 * EAPOL_eapRestart - Lower layer request to restart authentication
466d49e1aeSJan Lentfer 	 *
476d49e1aeSJan Lentfer 	 * Set to TRUE in lower layer, FALSE in EAP state machine.
486d49e1aeSJan Lentfer 	 */
496d49e1aeSJan Lentfer 	EAPOL_eapRestart,
506d49e1aeSJan Lentfer 
516d49e1aeSJan Lentfer 	/**
526d49e1aeSJan Lentfer 	 * EAPOL_eapFail - EAP FAILURE state reached
536d49e1aeSJan Lentfer 	 *
546d49e1aeSJan Lentfer 	 * EAP state machine writes this value.
556d49e1aeSJan Lentfer 	 */
566d49e1aeSJan Lentfer 	EAPOL_eapFail,
576d49e1aeSJan Lentfer 
586d49e1aeSJan Lentfer 	/**
596d49e1aeSJan Lentfer 	 * EAPOL_eapResp - Response to send
606d49e1aeSJan Lentfer 	 *
616d49e1aeSJan Lentfer 	 * Set to TRUE in EAP state machine, FALSE in lower layer.
626d49e1aeSJan Lentfer 	 */
636d49e1aeSJan Lentfer 	EAPOL_eapResp,
646d49e1aeSJan Lentfer 
656d49e1aeSJan Lentfer 	/**
666d49e1aeSJan Lentfer 	 * EAPOL_eapNoResp - Request has been process; no response to send
676d49e1aeSJan Lentfer 	 *
686d49e1aeSJan Lentfer 	 * Set to TRUE in EAP state machine, FALSE in lower layer.
696d49e1aeSJan Lentfer 	 */
706d49e1aeSJan Lentfer 	EAPOL_eapNoResp,
716d49e1aeSJan Lentfer 
726d49e1aeSJan Lentfer 	/**
736d49e1aeSJan Lentfer 	 * EAPOL_eapReq - EAP request available from lower layer
746d49e1aeSJan Lentfer 	 *
756d49e1aeSJan Lentfer 	 * Set to TRUE in lower layer, FALSE in EAP state machine.
766d49e1aeSJan Lentfer 	 */
776d49e1aeSJan Lentfer 	EAPOL_eapReq,
786d49e1aeSJan Lentfer 
796d49e1aeSJan Lentfer 	/**
806d49e1aeSJan Lentfer 	 * EAPOL_portEnabled - Lower layer is ready for communication
816d49e1aeSJan Lentfer 	 *
826d49e1aeSJan Lentfer 	 * EAP state machines reads this value.
836d49e1aeSJan Lentfer 	 */
846d49e1aeSJan Lentfer 	EAPOL_portEnabled,
856d49e1aeSJan Lentfer 
866d49e1aeSJan Lentfer 	/**
876d49e1aeSJan Lentfer 	 * EAPOL_altAccept - Alternate indication of success (RFC3748)
886d49e1aeSJan Lentfer 	 *
896d49e1aeSJan Lentfer 	 * EAP state machines reads this value.
906d49e1aeSJan Lentfer 	 */
916d49e1aeSJan Lentfer 	EAPOL_altAccept,
926d49e1aeSJan Lentfer 
936d49e1aeSJan Lentfer 	/**
946d49e1aeSJan Lentfer 	 * EAPOL_altReject - Alternate indication of failure (RFC3748)
956d49e1aeSJan Lentfer 	 *
966d49e1aeSJan Lentfer 	 * EAP state machines reads this value.
976d49e1aeSJan Lentfer 	 */
98*a1157835SDaniel Fojt 	EAPOL_altReject,
99*a1157835SDaniel Fojt 
100*a1157835SDaniel Fojt 	/**
101*a1157835SDaniel Fojt 	 * EAPOL_eapTriggerStart - EAP-based trigger to send EAPOL-Start
102*a1157835SDaniel Fojt 	 *
103*a1157835SDaniel Fojt 	 * EAP state machine writes this value.
104*a1157835SDaniel Fojt 	 */
105*a1157835SDaniel Fojt 	EAPOL_eapTriggerStart
1066d49e1aeSJan Lentfer };
1076d49e1aeSJan Lentfer 
1086d49e1aeSJan Lentfer /**
1096d49e1aeSJan Lentfer  * enum eapol_int_var - EAPOL integer state variables for EAP state machine
1106d49e1aeSJan Lentfer  *
1116d49e1aeSJan Lentfer  * These variables are used in the interface between EAP peer state machine and
1126d49e1aeSJan Lentfer  * lower layer. These are defined in RFC 4137, Sect. 4.1. Lower layer code is
1136d49e1aeSJan Lentfer  * expected to maintain these variables and register a callback functions for
1146d49e1aeSJan Lentfer  * EAP state machine to get and set the variables.
1156d49e1aeSJan Lentfer  */
1166d49e1aeSJan Lentfer enum eapol_int_var {
1176d49e1aeSJan Lentfer 	/**
1186d49e1aeSJan Lentfer 	 * EAPOL_idleWhile - Outside time for EAP peer timeout
1196d49e1aeSJan Lentfer 	 *
1206d49e1aeSJan Lentfer 	 * This integer variable is used to provide an outside timer that the
1216d49e1aeSJan Lentfer 	 * external (to EAP state machine) code must decrement by one every
1226d49e1aeSJan Lentfer 	 * second until the value reaches zero. This is used in the same way as
1236d49e1aeSJan Lentfer 	 * EAPOL state machine timers. EAP state machine reads and writes this
1246d49e1aeSJan Lentfer 	 * value.
1256d49e1aeSJan Lentfer 	 */
1266d49e1aeSJan Lentfer 	EAPOL_idleWhile
1276d49e1aeSJan Lentfer };
1286d49e1aeSJan Lentfer 
1296d49e1aeSJan Lentfer /**
1306d49e1aeSJan Lentfer  * struct eapol_callbacks - Callback functions from EAP to lower layer
1316d49e1aeSJan Lentfer  *
1326d49e1aeSJan Lentfer  * This structure defines the callback functions that EAP state machine
1336d49e1aeSJan Lentfer  * requires from the lower layer (usually EAPOL state machine) for updating
1346d49e1aeSJan Lentfer  * state variables and requesting information. eapol_ctx from
1356d49e1aeSJan Lentfer  * eap_peer_sm_init() call will be used as the ctx parameter for these
1366d49e1aeSJan Lentfer  * callback functions.
1376d49e1aeSJan Lentfer  */
1386d49e1aeSJan Lentfer struct eapol_callbacks {
1396d49e1aeSJan Lentfer 	/**
1406d49e1aeSJan Lentfer 	 * get_config - Get pointer to the current network configuration
1416d49e1aeSJan Lentfer 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
1426d49e1aeSJan Lentfer 	 */
1436d49e1aeSJan Lentfer 	struct eap_peer_config * (*get_config)(void *ctx);
1446d49e1aeSJan Lentfer 
1456d49e1aeSJan Lentfer 	/**
1466d49e1aeSJan Lentfer 	 * get_bool - Get a boolean EAPOL state variable
1476d49e1aeSJan Lentfer 	 * @variable: EAPOL boolean variable to get
1486d49e1aeSJan Lentfer 	 * Returns: Value of the EAPOL variable
1496d49e1aeSJan Lentfer 	 */
1506d49e1aeSJan Lentfer 	Boolean (*get_bool)(void *ctx, enum eapol_bool_var variable);
1516d49e1aeSJan Lentfer 
1526d49e1aeSJan Lentfer 	/**
1536d49e1aeSJan Lentfer 	 * set_bool - Set a boolean EAPOL state variable
1546d49e1aeSJan Lentfer 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
1556d49e1aeSJan Lentfer 	 * @variable: EAPOL boolean variable to set
1566d49e1aeSJan Lentfer 	 * @value: Value for the EAPOL variable
1576d49e1aeSJan Lentfer 	 */
1586d49e1aeSJan Lentfer 	void (*set_bool)(void *ctx, enum eapol_bool_var variable,
1596d49e1aeSJan Lentfer 			 Boolean value);
1606d49e1aeSJan Lentfer 
1616d49e1aeSJan Lentfer 	/**
1626d49e1aeSJan Lentfer 	 * get_int - Get an integer EAPOL state variable
1636d49e1aeSJan Lentfer 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
1646d49e1aeSJan Lentfer 	 * @variable: EAPOL integer variable to get
1656d49e1aeSJan Lentfer 	 * Returns: Value of the EAPOL variable
1666d49e1aeSJan Lentfer 	 */
1676d49e1aeSJan Lentfer 	unsigned int (*get_int)(void *ctx, enum eapol_int_var variable);
1686d49e1aeSJan Lentfer 
1696d49e1aeSJan Lentfer 	/**
1706d49e1aeSJan Lentfer 	 * set_int - Set an integer EAPOL state variable
1716d49e1aeSJan Lentfer 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
1726d49e1aeSJan Lentfer 	 * @variable: EAPOL integer variable to set
1736d49e1aeSJan Lentfer 	 * @value: Value for the EAPOL variable
1746d49e1aeSJan Lentfer 	 */
1756d49e1aeSJan Lentfer 	void (*set_int)(void *ctx, enum eapol_int_var variable,
1766d49e1aeSJan Lentfer 			unsigned int value);
1776d49e1aeSJan Lentfer 
1786d49e1aeSJan Lentfer 	/**
1796d49e1aeSJan Lentfer 	 * get_eapReqData - Get EAP-Request data
1806d49e1aeSJan Lentfer 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
1816d49e1aeSJan Lentfer 	 * @len: Pointer to variable that will be set to eapReqDataLen
1826d49e1aeSJan Lentfer 	 * Returns: Reference to eapReqData (EAP state machine will not free
1836d49e1aeSJan Lentfer 	 * this) or %NULL if eapReqData not available.
1846d49e1aeSJan Lentfer 	 */
1856d49e1aeSJan Lentfer 	struct wpabuf * (*get_eapReqData)(void *ctx);
1866d49e1aeSJan Lentfer 
1876d49e1aeSJan Lentfer 	/**
1886d49e1aeSJan Lentfer 	 * set_config_blob - Set named configuration blob
1896d49e1aeSJan Lentfer 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
1906d49e1aeSJan Lentfer 	 * @blob: New value for the blob
1916d49e1aeSJan Lentfer 	 *
1926d49e1aeSJan Lentfer 	 * Adds a new configuration blob or replaces the current value of an
1936d49e1aeSJan Lentfer 	 * existing blob.
1946d49e1aeSJan Lentfer 	 */
1956d49e1aeSJan Lentfer 	void (*set_config_blob)(void *ctx, struct wpa_config_blob *blob);
1966d49e1aeSJan Lentfer 
1976d49e1aeSJan Lentfer 	/**
1986d49e1aeSJan Lentfer 	 * get_config_blob - Get a named configuration blob
1996d49e1aeSJan Lentfer 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
2006d49e1aeSJan Lentfer 	 * @name: Name of the blob
2016d49e1aeSJan Lentfer 	 * Returns: Pointer to blob data or %NULL if not found
2026d49e1aeSJan Lentfer 	 */
2036d49e1aeSJan Lentfer 	const struct wpa_config_blob * (*get_config_blob)(void *ctx,
2046d49e1aeSJan Lentfer 							  const char *name);
2056d49e1aeSJan Lentfer 
2066d49e1aeSJan Lentfer 	/**
2076d49e1aeSJan Lentfer 	 * notify_pending - Notify that a pending request can be retried
2086d49e1aeSJan Lentfer 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
2096d49e1aeSJan Lentfer 	 *
2106d49e1aeSJan Lentfer 	 * An EAP method can perform a pending operation (e.g., to get a
2116d49e1aeSJan Lentfer 	 * response from an external process). Once the response is available,
2126d49e1aeSJan Lentfer 	 * this callback function can be used to request EAPOL state machine to
2136d49e1aeSJan Lentfer 	 * retry delivering the previously received (and still unanswered) EAP
2146d49e1aeSJan Lentfer 	 * request to EAP state machine.
2156d49e1aeSJan Lentfer 	 */
2166d49e1aeSJan Lentfer 	void (*notify_pending)(void *ctx);
2176d49e1aeSJan Lentfer 
2186d49e1aeSJan Lentfer 	/**
2196d49e1aeSJan Lentfer 	 * eap_param_needed - Notify that EAP parameter is needed
2206d49e1aeSJan Lentfer 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
2213ff40c12SJohn Marino 	 * @field: Field indicator (e.g., WPA_CTRL_REQ_EAP_IDENTITY)
2226d49e1aeSJan Lentfer 	 * @txt: User readable text describing the required parameter
2236d49e1aeSJan Lentfer 	 */
2243ff40c12SJohn Marino 	void (*eap_param_needed)(void *ctx, enum wpa_ctrl_req_type field,
2256d49e1aeSJan Lentfer 				 const char *txt);
2263ff40c12SJohn Marino 
2273ff40c12SJohn Marino 	/**
2283ff40c12SJohn Marino 	 * notify_cert - Notification of a peer certificate
2293ff40c12SJohn Marino 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
230*a1157835SDaniel Fojt 	 * @cert: Certificate information
2313ff40c12SJohn Marino 	 * @cert_hash: SHA-256 hash of the certificate
2323ff40c12SJohn Marino 	 */
233*a1157835SDaniel Fojt 	void (*notify_cert)(void *ctx, struct tls_cert_data *cert,
234*a1157835SDaniel Fojt 			    const char *cert_hash);
2353ff40c12SJohn Marino 
2363ff40c12SJohn Marino 	/**
2373ff40c12SJohn Marino 	 * notify_status - Notification of the current EAP state
2383ff40c12SJohn Marino 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
2393ff40c12SJohn Marino 	 * @status: Step in the process of EAP authentication
2403ff40c12SJohn Marino 	 * @parameter: Step-specific parameter, e.g., EAP method name
2413ff40c12SJohn Marino 	 */
2423ff40c12SJohn Marino 	void (*notify_status)(void *ctx, const char *status,
2433ff40c12SJohn Marino 			      const char *parameter);
2443ff40c12SJohn Marino 
2453ff40c12SJohn Marino 	/**
246*a1157835SDaniel Fojt 	 * notify_eap_error - Report EAP method error code
247*a1157835SDaniel Fojt 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
248*a1157835SDaniel Fojt 	 * @error_code: Error code from the used EAP method
249*a1157835SDaniel Fojt 	 */
250*a1157835SDaniel Fojt 	void (*notify_eap_error)(void *ctx, int error_code);
251*a1157835SDaniel Fojt 
252*a1157835SDaniel Fojt #ifdef CONFIG_EAP_PROXY
253*a1157835SDaniel Fojt 	/**
254*a1157835SDaniel Fojt 	 * eap_proxy_cb - Callback signifying any updates from eap_proxy
255*a1157835SDaniel Fojt 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
256*a1157835SDaniel Fojt 	 */
257*a1157835SDaniel Fojt 	void (*eap_proxy_cb)(void *ctx);
258*a1157835SDaniel Fojt 
259*a1157835SDaniel Fojt 	/**
260*a1157835SDaniel Fojt 	 * eap_proxy_notify_sim_status - Notification of SIM status change
261*a1157835SDaniel Fojt 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
262*a1157835SDaniel Fojt 	 * @sim_state: One of enum value from sim_state
263*a1157835SDaniel Fojt 	 */
264*a1157835SDaniel Fojt 	void (*eap_proxy_notify_sim_status)(void *ctx,
265*a1157835SDaniel Fojt 					    enum eap_proxy_sim_state sim_state);
266*a1157835SDaniel Fojt 
267*a1157835SDaniel Fojt 	/**
268*a1157835SDaniel Fojt 	 * get_imsi - Get the IMSI value from eap_proxy
269*a1157835SDaniel Fojt 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
270*a1157835SDaniel Fojt 	 * @sim_num: SIM/USIM number to get the IMSI value for
271*a1157835SDaniel Fojt 	 * @imsi: Buffer for IMSI value
272*a1157835SDaniel Fojt 	 * @len: Buffer for returning IMSI length in octets
273*a1157835SDaniel Fojt 	 * Returns: MNC length (2 or 3) or -1 on error
274*a1157835SDaniel Fojt 	 */
275*a1157835SDaniel Fojt 	int (*get_imsi)(void *ctx, int sim_num, char *imsi, size_t *len);
276*a1157835SDaniel Fojt #endif /* CONFIG_EAP_PROXY */
277*a1157835SDaniel Fojt 
278*a1157835SDaniel Fojt 	/**
2793ff40c12SJohn Marino 	 * set_anon_id - Set or add anonymous identity
2803ff40c12SJohn Marino 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
2813ff40c12SJohn Marino 	 * @id: Anonymous identity (e.g., EAP-SIM pseudonym) or %NULL to clear
2823ff40c12SJohn Marino 	 * @len: Length of anonymous identity in octets
2833ff40c12SJohn Marino 	 */
2843ff40c12SJohn Marino 	void (*set_anon_id)(void *ctx, const u8 *id, size_t len);
2856d49e1aeSJan Lentfer };
2866d49e1aeSJan Lentfer 
2876d49e1aeSJan Lentfer /**
2886d49e1aeSJan Lentfer  * struct eap_config - Configuration for EAP state machine
2896d49e1aeSJan Lentfer  */
2906d49e1aeSJan Lentfer struct eap_config {
2916d49e1aeSJan Lentfer 	/**
2926d49e1aeSJan Lentfer 	 * opensc_engine_path - OpenSC engine for OpenSSL engine support
2936d49e1aeSJan Lentfer 	 *
2946d49e1aeSJan Lentfer 	 * Usually, path to engine_opensc.so.
2956d49e1aeSJan Lentfer 	 */
2966d49e1aeSJan Lentfer 	const char *opensc_engine_path;
2976d49e1aeSJan Lentfer 	/**
2986d49e1aeSJan Lentfer 	 * pkcs11_engine_path - PKCS#11 engine for OpenSSL engine support
2996d49e1aeSJan Lentfer 	 *
3006d49e1aeSJan Lentfer 	 * Usually, path to engine_pkcs11.so.
3016d49e1aeSJan Lentfer 	 */
3026d49e1aeSJan Lentfer 	const char *pkcs11_engine_path;
3036d49e1aeSJan Lentfer 	/**
3046d49e1aeSJan Lentfer 	 * pkcs11_module_path - OpenSC PKCS#11 module for OpenSSL engine
3056d49e1aeSJan Lentfer 	 *
3066d49e1aeSJan Lentfer 	 * Usually, path to opensc-pkcs11.so.
3076d49e1aeSJan Lentfer 	 */
3086d49e1aeSJan Lentfer 	const char *pkcs11_module_path;
3096d49e1aeSJan Lentfer 	/**
310*a1157835SDaniel Fojt 	 * openssl_ciphers - OpenSSL cipher string
311*a1157835SDaniel Fojt 	 *
312*a1157835SDaniel Fojt 	 * This is an OpenSSL specific configuration option for configuring the
313*a1157835SDaniel Fojt 	 * default ciphers. If not set, "DEFAULT:!EXP:!LOW" is used as the
314*a1157835SDaniel Fojt 	 * default.
315*a1157835SDaniel Fojt 	 */
316*a1157835SDaniel Fojt 	const char *openssl_ciphers;
317*a1157835SDaniel Fojt 	/**
3186d49e1aeSJan Lentfer 	 * wps - WPS context data
3196d49e1aeSJan Lentfer 	 *
3206d49e1aeSJan Lentfer 	 * This is only used by EAP-WSC and can be left %NULL if not available.
3216d49e1aeSJan Lentfer 	 */
3226d49e1aeSJan Lentfer 	struct wps_context *wps;
3233ff40c12SJohn Marino 
3243ff40c12SJohn Marino 	/**
3253ff40c12SJohn Marino 	 * cert_in_cb - Include server certificates in callback
3263ff40c12SJohn Marino 	 */
3273ff40c12SJohn Marino 	int cert_in_cb;
3286d49e1aeSJan Lentfer };
3296d49e1aeSJan Lentfer 
3306d49e1aeSJan Lentfer struct eap_sm * eap_peer_sm_init(void *eapol_ctx,
331*a1157835SDaniel Fojt 				 const struct eapol_callbacks *eapol_cb,
3326d49e1aeSJan Lentfer 				 void *msg_ctx, struct eap_config *conf);
3336d49e1aeSJan Lentfer void eap_peer_sm_deinit(struct eap_sm *sm);
3346d49e1aeSJan Lentfer int eap_peer_sm_step(struct eap_sm *sm);
3356d49e1aeSJan Lentfer void eap_sm_abort(struct eap_sm *sm);
3366d49e1aeSJan Lentfer int eap_sm_get_status(struct eap_sm *sm, char *buf, size_t buflen,
3376d49e1aeSJan Lentfer 		      int verbose);
3383ff40c12SJohn Marino const char * eap_sm_get_method_name(struct eap_sm *sm);
3396d49e1aeSJan Lentfer struct wpabuf * eap_sm_buildIdentity(struct eap_sm *sm, int id, int encrypted);
3406d49e1aeSJan Lentfer void eap_sm_request_identity(struct eap_sm *sm);
3416d49e1aeSJan Lentfer void eap_sm_request_password(struct eap_sm *sm);
3426d49e1aeSJan Lentfer void eap_sm_request_new_password(struct eap_sm *sm);
3436d49e1aeSJan Lentfer void eap_sm_request_pin(struct eap_sm *sm);
3446d49e1aeSJan Lentfer void eap_sm_request_otp(struct eap_sm *sm, const char *msg, size_t msg_len);
3456d49e1aeSJan Lentfer void eap_sm_request_passphrase(struct eap_sm *sm);
3463ff40c12SJohn Marino void eap_sm_request_sim(struct eap_sm *sm, const char *req);
3476d49e1aeSJan Lentfer void eap_sm_notify_ctrl_attached(struct eap_sm *sm);
3486d49e1aeSJan Lentfer u32 eap_get_phase2_type(const char *name, int *vendor);
3496d49e1aeSJan Lentfer struct eap_method_type * eap_get_phase2_types(struct eap_peer_config *config,
3506d49e1aeSJan Lentfer 					      size_t *count);
3516d49e1aeSJan Lentfer void eap_set_fast_reauth(struct eap_sm *sm, int enabled);
3526d49e1aeSJan Lentfer void eap_set_workaround(struct eap_sm *sm, unsigned int workaround);
3536d49e1aeSJan Lentfer void eap_set_force_disabled(struct eap_sm *sm, int disabled);
3543ff40c12SJohn Marino void eap_set_external_sim(struct eap_sm *sm, int external_sim);
3556d49e1aeSJan Lentfer int eap_key_available(struct eap_sm *sm);
3566d49e1aeSJan Lentfer void eap_notify_success(struct eap_sm *sm);
3576d49e1aeSJan Lentfer void eap_notify_lower_layer_success(struct eap_sm *sm);
3583ff40c12SJohn Marino const u8 * eap_get_eapSessionId(struct eap_sm *sm, size_t *len);
3596d49e1aeSJan Lentfer const u8 * eap_get_eapKeyData(struct eap_sm *sm, size_t *len);
3606d49e1aeSJan Lentfer struct wpabuf * eap_get_eapRespData(struct eap_sm *sm);
3616d49e1aeSJan Lentfer void eap_register_scard_ctx(struct eap_sm *sm, void *ctx);
3626d49e1aeSJan Lentfer void eap_invalidate_cached_session(struct eap_sm *sm);
3636d49e1aeSJan Lentfer 
3646d49e1aeSJan Lentfer int eap_is_wps_pbc_enrollee(struct eap_peer_config *conf);
3656d49e1aeSJan Lentfer int eap_is_wps_pin_enrollee(struct eap_peer_config *conf);
3666d49e1aeSJan Lentfer 
3673ff40c12SJohn Marino struct ext_password_data;
3683ff40c12SJohn Marino void eap_sm_set_ext_pw_ctx(struct eap_sm *sm, struct ext_password_data *ext);
3693ff40c12SJohn Marino void eap_set_anon_id(struct eap_sm *sm, const u8 *id, size_t len);
3703ff40c12SJohn Marino int eap_peer_was_failure_expected(struct eap_sm *sm);
371*a1157835SDaniel Fojt void eap_peer_erp_free_keys(struct eap_sm *sm);
372*a1157835SDaniel Fojt struct wpabuf * eap_peer_build_erp_reauth_start(struct eap_sm *sm, u8 eap_id);
373*a1157835SDaniel Fojt void eap_peer_finish(struct eap_sm *sm, const struct eap_hdr *hdr, size_t len);
374*a1157835SDaniel Fojt int eap_peer_get_erp_info(struct eap_sm *sm, struct eap_peer_config *config,
375*a1157835SDaniel Fojt 			  const u8 **username, size_t *username_len,
376*a1157835SDaniel Fojt 			  const u8 **realm, size_t *realm_len, u16 *erp_seq_num,
377*a1157835SDaniel Fojt 			  const u8 **rrk, size_t *rrk_len);
378*a1157835SDaniel Fojt int eap_peer_update_erp_next_seq_num(struct eap_sm *sm, u16 seq_num);
379*a1157835SDaniel Fojt void eap_peer_erp_init(struct eap_sm *sm, u8 *ext_session_id,
380*a1157835SDaniel Fojt 		       size_t ext_session_id_len, u8 *ext_emsk,
381*a1157835SDaniel Fojt 		       size_t ext_emsk_len);
3823ff40c12SJohn Marino 
3836d49e1aeSJan Lentfer #endif /* IEEE8021X_EAPOL */
3846d49e1aeSJan Lentfer 
3856d49e1aeSJan Lentfer #endif /* EAP_H */
386