xref: /freebsd/contrib/wpa/src/eapol_supp/eapol_supp_sm.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
139beb93cSSam Leffler /*
239beb93cSSam Leffler  * EAPOL supplicant state machines
3f05cddf9SRui Paulo  * Copyright (c) 2004-2012, Jouni Malinen <j@w1.fi>
439beb93cSSam Leffler  *
5f05cddf9SRui Paulo  * This software may be distributed under the terms of the BSD license.
6f05cddf9SRui Paulo  * See README for more details.
739beb93cSSam Leffler  */
839beb93cSSam Leffler 
939beb93cSSam Leffler #ifndef EAPOL_SUPP_SM_H
1039beb93cSSam Leffler #define EAPOL_SUPP_SM_H
1139beb93cSSam Leffler 
12e28a4053SRui Paulo #include "common/defs.h"
1339beb93cSSam Leffler 
14206b73d0SCy Schubert struct tls_cert_data;
15206b73d0SCy Schubert 
1639beb93cSSam Leffler typedef enum { Unauthorized, Authorized } PortStatus;
1739beb93cSSam Leffler typedef enum { Auto, ForceUnauthorized, ForceAuthorized } PortControl;
1839beb93cSSam Leffler 
1939beb93cSSam Leffler /**
2039beb93cSSam Leffler  * struct eapol_config - Per network configuration for EAPOL state machines
2139beb93cSSam Leffler  */
2239beb93cSSam Leffler struct eapol_config {
2339beb93cSSam Leffler 	/**
2439beb93cSSam Leffler 	 * accept_802_1x_keys - Accept IEEE 802.1X (non-WPA) EAPOL-Key frames
2539beb93cSSam Leffler 	 *
2639beb93cSSam Leffler 	 * This variable should be set to 1 when using EAPOL state machines
2739beb93cSSam Leffler 	 * with non-WPA security policy to generate dynamic WEP keys. When
2839beb93cSSam Leffler 	 * using WPA, this should be set to 0 so that WPA state machine can
2939beb93cSSam Leffler 	 * process the EAPOL-Key frames.
3039beb93cSSam Leffler 	 */
3139beb93cSSam Leffler 	int accept_802_1x_keys;
3239beb93cSSam Leffler 
3339beb93cSSam Leffler #define EAPOL_REQUIRE_KEY_UNICAST BIT(0)
3439beb93cSSam Leffler #define EAPOL_REQUIRE_KEY_BROADCAST BIT(1)
3539beb93cSSam Leffler 	/**
3639beb93cSSam Leffler 	 * required_keys - Which EAPOL-Key packets are required
3739beb93cSSam Leffler 	 *
3839beb93cSSam Leffler 	 * This variable determines which EAPOL-Key packets are required before
3939beb93cSSam Leffler 	 * marking connection authenticated. This is a bit field of
4039beb93cSSam Leffler 	 * EAPOL_REQUIRE_KEY_UNICAST and EAPOL_REQUIRE_KEY_BROADCAST flags.
4139beb93cSSam Leffler 	 */
4239beb93cSSam Leffler 	int required_keys;
4339beb93cSSam Leffler 
4439beb93cSSam Leffler 	/**
4539beb93cSSam Leffler 	 * fast_reauth - Whether fast EAP reauthentication is enabled
4639beb93cSSam Leffler 	 */
4739beb93cSSam Leffler 	int fast_reauth;
4839beb93cSSam Leffler 
4939beb93cSSam Leffler 	/**
5039beb93cSSam Leffler 	 * workaround - Whether EAP workarounds are enabled
5139beb93cSSam Leffler 	 */
5239beb93cSSam Leffler 	unsigned int workaround;
5339beb93cSSam Leffler 
5439beb93cSSam Leffler 	/**
5539beb93cSSam Leffler 	 * eap_disabled - Whether EAP is disabled
5639beb93cSSam Leffler 	 */
5739beb93cSSam Leffler 	int eap_disabled;
585b9c547cSRui Paulo 
595b9c547cSRui Paulo 	/**
605b9c547cSRui Paulo 	 * external_sim - Use external processing for SIM/USIM operations
615b9c547cSRui Paulo 	 */
625b9c547cSRui Paulo 	int external_sim;
635b9c547cSRui Paulo 
645b9c547cSRui Paulo #define EAPOL_LOCAL_WPS_IN_USE BIT(0)
655b9c547cSRui Paulo #define EAPOL_PEER_IS_WPS20_AP BIT(1)
665b9c547cSRui Paulo 	/**
675b9c547cSRui Paulo 	 * wps - Whether this connection is used for WPS
685b9c547cSRui Paulo 	 */
695b9c547cSRui Paulo 	int wps;
7039beb93cSSam Leffler };
7139beb93cSSam Leffler 
7239beb93cSSam Leffler struct eapol_sm;
7339beb93cSSam Leffler struct wpa_config_blob;
7439beb93cSSam Leffler 
755b9c547cSRui Paulo enum eapol_supp_result {
765b9c547cSRui Paulo 	EAPOL_SUPP_RESULT_FAILURE,
775b9c547cSRui Paulo 	EAPOL_SUPP_RESULT_SUCCESS,
785b9c547cSRui Paulo 	EAPOL_SUPP_RESULT_EXPECTED_FAILURE
795b9c547cSRui Paulo };
805b9c547cSRui Paulo 
8139beb93cSSam Leffler /**
8239beb93cSSam Leffler  * struct eapol_ctx - Global (for all networks) EAPOL state machine context
8339beb93cSSam Leffler  */
8439beb93cSSam Leffler struct eapol_ctx {
8539beb93cSSam Leffler 	/**
8639beb93cSSam Leffler 	 * ctx - Pointer to arbitrary upper level context
8739beb93cSSam Leffler 	 */
8839beb93cSSam Leffler 	void *ctx;
8939beb93cSSam Leffler 
9039beb93cSSam Leffler 	/**
9139beb93cSSam Leffler 	 * preauth - IEEE 802.11i/RSN pre-authentication
9239beb93cSSam Leffler 	 *
9339beb93cSSam Leffler 	 * This EAPOL state machine is used for IEEE 802.11i/RSN
9439beb93cSSam Leffler 	 * pre-authentication
9539beb93cSSam Leffler 	 */
9639beb93cSSam Leffler 	int preauth;
9739beb93cSSam Leffler 
9839beb93cSSam Leffler 	/**
9939beb93cSSam Leffler 	 * cb - Function to be called when EAPOL negotiation has been completed
10039beb93cSSam Leffler 	 * @eapol: Pointer to EAPOL state machine data
1015b9c547cSRui Paulo 	 * @result: Whether the authentication was completed successfully
10239beb93cSSam Leffler 	 * @ctx: Pointer to context data (cb_ctx)
10339beb93cSSam Leffler 	 *
10439beb93cSSam Leffler 	 * This optional callback function will be called when the EAPOL
10539beb93cSSam Leffler 	 * authentication has been completed. This allows the owner of the
10639beb93cSSam Leffler 	 * EAPOL state machine to process the key and terminate the EAPOL state
10739beb93cSSam Leffler 	 * machine. Currently, this is used only in RSN pre-authentication.
10839beb93cSSam Leffler 	 */
1095b9c547cSRui Paulo 	void (*cb)(struct eapol_sm *eapol, enum eapol_supp_result result,
1105b9c547cSRui Paulo 		   void *ctx);
11139beb93cSSam Leffler 
11239beb93cSSam Leffler 	/**
11339beb93cSSam Leffler 	 * cb_ctx - Callback context for cb()
11439beb93cSSam Leffler 	 */
11539beb93cSSam Leffler 	void *cb_ctx;
11639beb93cSSam Leffler 
11739beb93cSSam Leffler 	/**
11839beb93cSSam Leffler 	 * msg_ctx - Callback context for wpa_msg() calls
11939beb93cSSam Leffler 	 */
12039beb93cSSam Leffler 	void *msg_ctx;
12139beb93cSSam Leffler 
12239beb93cSSam Leffler 	/**
12339beb93cSSam Leffler 	 * scard_ctx - Callback context for PC/SC scard_*() function calls
12439beb93cSSam Leffler 	 *
12539beb93cSSam Leffler 	 * This context can be updated with eapol_sm_register_scard_ctx().
12639beb93cSSam Leffler 	 */
12739beb93cSSam Leffler 	void *scard_ctx;
12839beb93cSSam Leffler 
12939beb93cSSam Leffler 	/**
13039beb93cSSam Leffler 	 * eapol_send_ctx - Callback context for eapol_send() calls
13139beb93cSSam Leffler 	 */
13239beb93cSSam Leffler 	void *eapol_send_ctx;
13339beb93cSSam Leffler 
13439beb93cSSam Leffler 	/**
13539beb93cSSam Leffler 	 * eapol_done_cb - Function to be called at successful completion
13639beb93cSSam Leffler 	 * @ctx: Callback context (ctx)
13739beb93cSSam Leffler 	 *
13839beb93cSSam Leffler 	 * This function is called at the successful completion of EAPOL
13939beb93cSSam Leffler 	 * authentication. If dynamic WEP keys are used, this is called only
14039beb93cSSam Leffler 	 * after all the expected keys have been received.
14139beb93cSSam Leffler 	 */
14239beb93cSSam Leffler 	void (*eapol_done_cb)(void *ctx);
14339beb93cSSam Leffler 
14439beb93cSSam Leffler 	/**
14539beb93cSSam Leffler 	 * eapol_send - Send EAPOL packets
14639beb93cSSam Leffler 	 * @ctx: Callback context (eapol_send_ctx)
14739beb93cSSam Leffler 	 * @type: EAPOL type (IEEE802_1X_TYPE_*)
14839beb93cSSam Leffler 	 * @buf: Pointer to EAPOL payload
14939beb93cSSam Leffler 	 * @len: Length of the EAPOL payload
15039beb93cSSam Leffler 	 * Returns: 0 on success, -1 on failure
15139beb93cSSam Leffler 	 */
15239beb93cSSam Leffler 	int (*eapol_send)(void *ctx, int type, const u8 *buf, size_t len);
15339beb93cSSam Leffler 
15439beb93cSSam Leffler 	/**
15539beb93cSSam Leffler 	 * set_wep_key - Configure WEP keys
15639beb93cSSam Leffler 	 * @ctx: Callback context (ctx)
15739beb93cSSam Leffler 	 * @unicast: Non-zero = unicast, 0 = multicast/broadcast key
15839beb93cSSam Leffler 	 * @keyidx: Key index (0..3)
15939beb93cSSam Leffler 	 * @key: WEP key
16039beb93cSSam Leffler 	 * @keylen: Length of the WEP key
16139beb93cSSam Leffler 	 * Returns: 0 on success, -1 on failure
16239beb93cSSam Leffler 	 */
16339beb93cSSam Leffler 	int (*set_wep_key)(void *ctx, int unicast, int keyidx,
16439beb93cSSam Leffler 			   const u8 *key, size_t keylen);
16539beb93cSSam Leffler 
16639beb93cSSam Leffler 	/**
16739beb93cSSam Leffler 	 * set_config_blob - Set or add a named configuration blob
16839beb93cSSam Leffler 	 * @ctx: Callback context (ctx)
16939beb93cSSam Leffler 	 * @blob: New value for the blob
17039beb93cSSam Leffler 	 *
17139beb93cSSam Leffler 	 * Adds a new configuration blob or replaces the current value of an
17239beb93cSSam Leffler 	 * existing blob.
17339beb93cSSam Leffler 	 */
17439beb93cSSam Leffler 	void (*set_config_blob)(void *ctx, struct wpa_config_blob *blob);
17539beb93cSSam Leffler 
17639beb93cSSam Leffler 	/**
17739beb93cSSam Leffler 	 * get_config_blob - Get a named configuration blob
17839beb93cSSam Leffler 	 * @ctx: Callback context (ctx)
17939beb93cSSam Leffler 	 * @name: Name of the blob
18039beb93cSSam Leffler 	 * Returns: Pointer to blob data or %NULL if not found
18139beb93cSSam Leffler 	 */
18239beb93cSSam Leffler 	const struct wpa_config_blob * (*get_config_blob)(void *ctx,
18339beb93cSSam Leffler 							  const char *name);
18439beb93cSSam Leffler 
18539beb93cSSam Leffler 	/**
18639beb93cSSam Leffler 	 * aborted_cached - Notify that cached PMK attempt was aborted
18739beb93cSSam Leffler 	 * @ctx: Callback context (ctx)
18839beb93cSSam Leffler 	 */
18939beb93cSSam Leffler 	void (*aborted_cached)(void *ctx);
19039beb93cSSam Leffler 
191*a90b9d01SCy Schubert #ifndef CONFIG_OPENSC_ENGINE_PATH
19239beb93cSSam Leffler 	/**
19339beb93cSSam Leffler 	 * opensc_engine_path - Path to the OpenSSL engine for opensc
19439beb93cSSam Leffler 	 *
19539beb93cSSam Leffler 	 * This is an OpenSSL specific configuration option for loading OpenSC
19639beb93cSSam Leffler 	 * engine (engine_opensc.so); if %NULL, this engine is not loaded.
19739beb93cSSam Leffler 	 */
19839beb93cSSam Leffler 	const char *opensc_engine_path;
199*a90b9d01SCy Schubert #endif /* CONFIG_OPENSC_ENGINE_PATH */
20039beb93cSSam Leffler 
201*a90b9d01SCy Schubert #ifndef CONFIG_PKCS11_ENGINE_PATH
20239beb93cSSam Leffler 	/**
20339beb93cSSam Leffler 	 * pkcs11_engine_path - Path to the OpenSSL engine for PKCS#11
20439beb93cSSam Leffler 	 *
20539beb93cSSam Leffler 	 * This is an OpenSSL specific configuration option for loading PKCS#11
20639beb93cSSam Leffler 	 * engine (engine_pkcs11.so); if %NULL, this engine is not loaded.
20739beb93cSSam Leffler 	 */
20839beb93cSSam Leffler 	const char *pkcs11_engine_path;
209*a90b9d01SCy Schubert #endif /* CONFIG_PKCS11_ENGINE_PATH */
21039beb93cSSam Leffler 
211*a90b9d01SCy Schubert #ifndef CONFIG_PKCS11_MODULE_PATH
21239beb93cSSam Leffler 	/**
21339beb93cSSam Leffler 	 * pkcs11_module_path - Path to the OpenSSL OpenSC/PKCS#11 module
21439beb93cSSam Leffler 	 *
21539beb93cSSam Leffler 	 * This is an OpenSSL specific configuration option for configuring
21639beb93cSSam Leffler 	 * path to OpenSC/PKCS#11 engine (opensc-pkcs11.so); if %NULL, this
21739beb93cSSam Leffler 	 * module is not loaded.
21839beb93cSSam Leffler 	 */
21939beb93cSSam Leffler 	const char *pkcs11_module_path;
220*a90b9d01SCy Schubert #endif /* CONFIG_PKCS11_MODULE_PATH */
22139beb93cSSam Leffler 
22239beb93cSSam Leffler 	/**
2235b9c547cSRui Paulo 	 * openssl_ciphers - OpenSSL cipher string
2245b9c547cSRui Paulo 	 *
2255b9c547cSRui Paulo 	 * This is an OpenSSL specific configuration option for configuring the
2265b9c547cSRui Paulo 	 * default ciphers. If not set, "DEFAULT:!EXP:!LOW" is used as the
2275b9c547cSRui Paulo 	 * default.
2285b9c547cSRui Paulo 	 */
2295b9c547cSRui Paulo 	const char *openssl_ciphers;
2305b9c547cSRui Paulo 
2315b9c547cSRui Paulo 	/**
23239beb93cSSam Leffler 	 * wps - WPS context data
23339beb93cSSam Leffler 	 *
23439beb93cSSam Leffler 	 * This is only used by EAP-WSC and can be left %NULL if not available.
23539beb93cSSam Leffler 	 */
23639beb93cSSam Leffler 	struct wps_context *wps;
23739beb93cSSam Leffler 
23839beb93cSSam Leffler 	/**
23939beb93cSSam Leffler 	 * eap_param_needed - Notify that EAP parameter is needed
24039beb93cSSam Leffler 	 * @ctx: Callback context (ctx)
241f05cddf9SRui Paulo 	 * @field: Field indicator (e.g., WPA_CTRL_REQ_EAP_IDENTITY)
24239beb93cSSam Leffler 	 * @txt: User readable text describing the required parameter
24339beb93cSSam Leffler 	 */
244f05cddf9SRui Paulo 	void (*eap_param_needed)(void *ctx, enum wpa_ctrl_req_type field,
24539beb93cSSam Leffler 				 const char *txt);
246e28a4053SRui Paulo 
247e28a4053SRui Paulo 	/**
248e28a4053SRui Paulo 	 * port_cb - Set port authorized/unauthorized callback (optional)
249e28a4053SRui Paulo 	 * @ctx: Callback context (ctx)
250e28a4053SRui Paulo 	 * @authorized: Whether the supplicant port is now in authorized state
251e28a4053SRui Paulo 	 */
252e28a4053SRui Paulo 	void (*port_cb)(void *ctx, int authorized);
253f05cddf9SRui Paulo 
254f05cddf9SRui Paulo 	/**
255f05cddf9SRui Paulo 	 * cert_cb - Notification of a peer certificate
256f05cddf9SRui Paulo 	 * @ctx: Callback context (ctx)
257206b73d0SCy Schubert 	 * @cert: Certificate information
258f05cddf9SRui Paulo 	 * @cert_hash: SHA-256 hash of the certificate
259f05cddf9SRui Paulo 	 */
260206b73d0SCy Schubert 	void (*cert_cb)(void *ctx, struct tls_cert_data *cert,
261206b73d0SCy Schubert 			const char *cert_hash);
262f05cddf9SRui Paulo 
263f05cddf9SRui Paulo 	/**
264f05cddf9SRui Paulo 	 * cert_in_cb - Include server certificates in callback
265f05cddf9SRui Paulo 	 */
266f05cddf9SRui Paulo 	int cert_in_cb;
267f05cddf9SRui Paulo 
268f05cddf9SRui Paulo 	/**
269f05cddf9SRui Paulo 	 * status_cb - Notification of a change in EAP status
270f05cddf9SRui Paulo 	 * @ctx: Callback context (ctx)
271f05cddf9SRui Paulo 	 * @status: Step in the process of EAP authentication
272f05cddf9SRui Paulo 	 * @parameter: Step-specific parameter, e.g., EAP method name
273f05cddf9SRui Paulo 	 */
274f05cddf9SRui Paulo 	void (*status_cb)(void *ctx, const char *status,
275f05cddf9SRui Paulo 			  const char *parameter);
276f05cddf9SRui Paulo 
27785732ac8SCy Schubert 	/**
27885732ac8SCy Schubert 	 * eap_error_cb - Notification of EAP method error
27985732ac8SCy Schubert 	 * @ctx: Callback context (ctx)
28085732ac8SCy Schubert 	 * @error_code: EAP method error code
28185732ac8SCy Schubert 	 */
28285732ac8SCy Schubert 	void (*eap_error_cb)(void *ctx, int error_code);
28385732ac8SCy Schubert 
2845b9c547cSRui Paulo #ifdef CONFIG_EAP_PROXY
2855b9c547cSRui Paulo 	/**
2865b9c547cSRui Paulo 	 * eap_proxy_cb - Callback signifying any updates from eap_proxy
2875b9c547cSRui Paulo 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
2885b9c547cSRui Paulo 	 */
2895b9c547cSRui Paulo 	void (*eap_proxy_cb)(void *ctx);
29085732ac8SCy Schubert 
29185732ac8SCy Schubert 	/**
29285732ac8SCy Schubert 	 * eap_proxy_notify_sim_status - Notification of SIM status change
29385732ac8SCy Schubert 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
29485732ac8SCy Schubert 	 * @status: One of enum value from sim_state
29585732ac8SCy Schubert 	 */
29685732ac8SCy Schubert 	void (*eap_proxy_notify_sim_status)(void *ctx,
29785732ac8SCy Schubert 					    enum eap_proxy_sim_state sim_state);
2985b9c547cSRui Paulo #endif /* CONFIG_EAP_PROXY */
2995b9c547cSRui Paulo 
300f05cddf9SRui Paulo 	/**
301f05cddf9SRui Paulo 	 * set_anon_id - Set or add anonymous identity
302f05cddf9SRui Paulo 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
303f05cddf9SRui Paulo 	 * @id: Anonymous identity (e.g., EAP-SIM pseudonym)
304f05cddf9SRui Paulo 	 * @len: Length of anonymous identity in octets
305f05cddf9SRui Paulo 	 */
306f05cddf9SRui Paulo 	void (*set_anon_id)(void *ctx, const u8 *id, size_t len);
307c1d255d3SCy Schubert 
308c1d255d3SCy Schubert 	/**
309c1d255d3SCy Schubert 	 * confirm_auth_cb - Callback confirming if we can install a new PTK
310c1d255d3SCy Schubert 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
311c1d255d3SCy Schubert 	 * Returns: 0 when authentication can continue, -1 when reconnecting
312c1d255d3SCy Schubert 	 *
313c1d255d3SCy Schubert 	 * Automatically triggers a reconnect when not.
314c1d255d3SCy Schubert 	 */
315c1d255d3SCy Schubert 	int (*confirm_auth_cb)(void *ctx);
316*a90b9d01SCy Schubert 
317*a90b9d01SCy Schubert 	/**
318*a90b9d01SCy Schubert 	 * encryption_required - Check whether encryption is required
319*a90b9d01SCy Schubert 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
320*a90b9d01SCy Schubert 	 * Returns: Whether the current session requires encryption
321*a90b9d01SCy Schubert 	 */
322*a90b9d01SCy Schubert 	bool (*encryption_required)(void *ctx);
32339beb93cSSam Leffler };
32439beb93cSSam Leffler 
32539beb93cSSam Leffler 
32639beb93cSSam Leffler struct eap_peer_config;
327f05cddf9SRui Paulo struct ext_password_data;
32839beb93cSSam Leffler 
32939beb93cSSam Leffler #ifdef IEEE8021X_EAPOL
33039beb93cSSam Leffler struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx);
33139beb93cSSam Leffler void eapol_sm_deinit(struct eapol_sm *sm);
33239beb93cSSam Leffler void eapol_sm_step(struct eapol_sm *sm);
33339beb93cSSam Leffler int eapol_sm_get_status(struct eapol_sm *sm, char *buf, size_t buflen,
33439beb93cSSam Leffler 			int verbose);
33539beb93cSSam Leffler int eapol_sm_get_mib(struct eapol_sm *sm, char *buf, size_t buflen);
33639beb93cSSam Leffler void eapol_sm_configure(struct eapol_sm *sm, int heldPeriod, int authPeriod,
33739beb93cSSam Leffler 			int startPeriod, int maxStart);
33839beb93cSSam Leffler int eapol_sm_rx_eapol(struct eapol_sm *sm, const u8 *src, const u8 *buf,
339*a90b9d01SCy Schubert 		      size_t len, enum frame_encryption encrypted);
34039beb93cSSam Leffler void eapol_sm_notify_tx_eapol_key(struct eapol_sm *sm);
341c1d255d3SCy Schubert void eapol_sm_notify_portEnabled(struct eapol_sm *sm, bool enabled);
342c1d255d3SCy Schubert void eapol_sm_notify_portValid(struct eapol_sm *sm, bool valid);
343c1d255d3SCy Schubert void eapol_sm_notify_eap_success(struct eapol_sm *sm, bool success);
344c1d255d3SCy Schubert void eapol_sm_notify_eap_fail(struct eapol_sm *sm, bool fail);
34539beb93cSSam Leffler void eapol_sm_notify_config(struct eapol_sm *sm,
34639beb93cSSam Leffler 			    struct eap_peer_config *config,
34739beb93cSSam Leffler 			    const struct eapol_config *conf);
34839beb93cSSam Leffler int eapol_sm_get_key(struct eapol_sm *sm, u8 *key, size_t len);
3495b9c547cSRui Paulo const u8 * eapol_sm_get_session_id(struct eapol_sm *sm, size_t *len);
350c1d255d3SCy Schubert void eapol_sm_notify_logoff(struct eapol_sm *sm, bool logoff);
35139beb93cSSam Leffler void eapol_sm_notify_cached(struct eapol_sm *sm);
3525b9c547cSRui Paulo void eapol_sm_notify_pmkid_attempt(struct eapol_sm *sm);
35339beb93cSSam Leffler void eapol_sm_register_scard_ctx(struct eapol_sm *sm, void *ctx);
35439beb93cSSam Leffler void eapol_sm_notify_portControl(struct eapol_sm *sm, PortControl portControl);
35539beb93cSSam Leffler void eapol_sm_notify_ctrl_attached(struct eapol_sm *sm);
35639beb93cSSam Leffler void eapol_sm_notify_ctrl_response(struct eapol_sm *sm);
35739beb93cSSam Leffler void eapol_sm_request_reauth(struct eapol_sm *sm);
35839beb93cSSam Leffler void eapol_sm_notify_lower_layer_success(struct eapol_sm *sm, int in_eapol_sm);
35939beb93cSSam Leffler void eapol_sm_invalidate_cached_session(struct eapol_sm *sm);
360f05cddf9SRui Paulo const char * eapol_sm_get_method_name(struct eapol_sm *sm);
361f05cddf9SRui Paulo void eapol_sm_set_ext_pw_ctx(struct eapol_sm *sm,
362f05cddf9SRui Paulo 			     struct ext_password_data *ext);
363f05cddf9SRui Paulo int eapol_sm_failed(struct eapol_sm *sm);
3645b9c547cSRui Paulo void eapol_sm_erp_flush(struct eapol_sm *sm);
36585732ac8SCy Schubert struct wpabuf * eapol_sm_build_erp_reauth_start(struct eapol_sm *sm);
36685732ac8SCy Schubert void eapol_sm_process_erp_finish(struct eapol_sm *sm, const u8 *buf,
36785732ac8SCy Schubert 				 size_t len);
36885732ac8SCy Schubert int eapol_sm_get_eap_proxy_imsi(void *ctx, int sim_num, char *imsi,
36985732ac8SCy Schubert 				size_t *len);
37085732ac8SCy Schubert int eapol_sm_update_erp_next_seq_num(struct eapol_sm *sm, u16 next_seq_num);
37185732ac8SCy Schubert int eapol_sm_get_erp_info(struct eapol_sm *sm, struct eap_peer_config *config,
37285732ac8SCy Schubert 			  const u8 **username, size_t *username_len,
37385732ac8SCy Schubert 			  const u8 **realm, size_t *realm_len,
37485732ac8SCy Schubert 			  u16 *erp_next_seq_num, const u8 **rrk,
37585732ac8SCy Schubert 			  size_t *rrk_len);
37685732ac8SCy Schubert 
37739beb93cSSam Leffler #else /* IEEE8021X_EAPOL */
eapol_sm_init(struct eapol_ctx * ctx)37839beb93cSSam Leffler static inline struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx)
37939beb93cSSam Leffler {
38039beb93cSSam Leffler 	free(ctx);
38139beb93cSSam Leffler 	return (struct eapol_sm *) 1;
38239beb93cSSam Leffler }
eapol_sm_deinit(struct eapol_sm * sm)38339beb93cSSam Leffler static inline void eapol_sm_deinit(struct eapol_sm *sm)
38439beb93cSSam Leffler {
38539beb93cSSam Leffler }
eapol_sm_step(struct eapol_sm * sm)38639beb93cSSam Leffler static inline void eapol_sm_step(struct eapol_sm *sm)
38739beb93cSSam Leffler {
38839beb93cSSam Leffler }
eapol_sm_get_status(struct eapol_sm * sm,char * buf,size_t buflen,int verbose)38939beb93cSSam Leffler static inline int eapol_sm_get_status(struct eapol_sm *sm, char *buf,
39039beb93cSSam Leffler 				      size_t buflen, int verbose)
39139beb93cSSam Leffler {
39239beb93cSSam Leffler 	return 0;
39339beb93cSSam Leffler }
eapol_sm_get_mib(struct eapol_sm * sm,char * buf,size_t buflen)39439beb93cSSam Leffler static inline int eapol_sm_get_mib(struct eapol_sm *sm, char *buf,
39539beb93cSSam Leffler 				   size_t buflen)
39639beb93cSSam Leffler {
39739beb93cSSam Leffler 	return 0;
39839beb93cSSam Leffler }
eapol_sm_configure(struct eapol_sm * sm,int heldPeriod,int authPeriod,int startPeriod,int maxStart)39939beb93cSSam Leffler static inline void eapol_sm_configure(struct eapol_sm *sm, int heldPeriod,
40039beb93cSSam Leffler 				      int authPeriod, int startPeriod,
40139beb93cSSam Leffler 				      int maxStart)
40239beb93cSSam Leffler {
40339beb93cSSam Leffler }
eapol_sm_rx_eapol(struct eapol_sm * sm,const u8 * src,const u8 * buf,size_t len,enum frame_encryption encrypted)40439beb93cSSam Leffler static inline int eapol_sm_rx_eapol(struct eapol_sm *sm, const u8 *src,
405*a90b9d01SCy Schubert 				    const u8 *buf, size_t len,
406*a90b9d01SCy Schubert 				    enum frame_encryption encrypted)
40739beb93cSSam Leffler {
40839beb93cSSam Leffler 	return 0;
40939beb93cSSam Leffler }
eapol_sm_notify_tx_eapol_key(struct eapol_sm * sm)41039beb93cSSam Leffler static inline void eapol_sm_notify_tx_eapol_key(struct eapol_sm *sm)
41139beb93cSSam Leffler {
41239beb93cSSam Leffler }
eapol_sm_notify_portEnabled(struct eapol_sm * sm,bool enabled)41339beb93cSSam Leffler static inline void eapol_sm_notify_portEnabled(struct eapol_sm *sm,
414c1d255d3SCy Schubert 					       bool enabled)
41539beb93cSSam Leffler {
41639beb93cSSam Leffler }
eapol_sm_notify_portValid(struct eapol_sm * sm,bool valid)41739beb93cSSam Leffler static inline void eapol_sm_notify_portValid(struct eapol_sm *sm,
418c1d255d3SCy Schubert 					     bool valid)
41939beb93cSSam Leffler {
42039beb93cSSam Leffler }
eapol_sm_notify_eap_success(struct eapol_sm * sm,bool success)42139beb93cSSam Leffler static inline void eapol_sm_notify_eap_success(struct eapol_sm *sm,
422c1d255d3SCy Schubert 					       bool success)
42339beb93cSSam Leffler {
42439beb93cSSam Leffler }
eapol_sm_notify_eap_fail(struct eapol_sm * sm,bool fail)425c1d255d3SCy Schubert static inline void eapol_sm_notify_eap_fail(struct eapol_sm *sm, bool fail)
42639beb93cSSam Leffler {
42739beb93cSSam Leffler }
eapol_sm_notify_config(struct eapol_sm * sm,struct eap_peer_config * config,struct eapol_config * conf)42839beb93cSSam Leffler static inline void eapol_sm_notify_config(struct eapol_sm *sm,
42939beb93cSSam Leffler 					  struct eap_peer_config *config,
43039beb93cSSam Leffler 					  struct eapol_config *conf)
43139beb93cSSam Leffler {
43239beb93cSSam Leffler }
eapol_sm_get_key(struct eapol_sm * sm,u8 * key,size_t len)43339beb93cSSam Leffler static inline int eapol_sm_get_key(struct eapol_sm *sm, u8 *key, size_t len)
43439beb93cSSam Leffler {
43539beb93cSSam Leffler 	return -1;
43639beb93cSSam Leffler }
4375b9c547cSRui Paulo static inline const u8 *
eapol_sm_get_session_id(struct eapol_sm * sm,size_t * len)4385b9c547cSRui Paulo eapol_sm_get_session_id(struct eapol_sm *sm, size_t *len)
4395b9c547cSRui Paulo {
4405b9c547cSRui Paulo 	return NULL;
4415b9c547cSRui Paulo }
eapol_sm_notify_logoff(struct eapol_sm * sm,bool logoff)442c1d255d3SCy Schubert static inline void eapol_sm_notify_logoff(struct eapol_sm *sm, bool logoff)
44339beb93cSSam Leffler {
44439beb93cSSam Leffler }
eapol_sm_notify_cached(struct eapol_sm * sm)44539beb93cSSam Leffler static inline void eapol_sm_notify_cached(struct eapol_sm *sm)
44639beb93cSSam Leffler {
44739beb93cSSam Leffler }
eapol_sm_notify_pmkid_attempt(struct eapol_sm * sm)4485b9c547cSRui Paulo static inline void eapol_sm_notify_pmkid_attempt(struct eapol_sm *sm)
4495b9c547cSRui Paulo {
4505b9c547cSRui Paulo }
45139beb93cSSam Leffler #define eapol_sm_register_scard_ctx(sm, ctx) do { } while (0)
eapol_sm_notify_portControl(struct eapol_sm * sm,PortControl portControl)45239beb93cSSam Leffler static inline void eapol_sm_notify_portControl(struct eapol_sm *sm,
45339beb93cSSam Leffler 					       PortControl portControl)
45439beb93cSSam Leffler {
45539beb93cSSam Leffler }
eapol_sm_notify_ctrl_attached(struct eapol_sm * sm)45639beb93cSSam Leffler static inline void eapol_sm_notify_ctrl_attached(struct eapol_sm *sm)
45739beb93cSSam Leffler {
45839beb93cSSam Leffler }
eapol_sm_notify_ctrl_response(struct eapol_sm * sm)45939beb93cSSam Leffler static inline void eapol_sm_notify_ctrl_response(struct eapol_sm *sm)
46039beb93cSSam Leffler {
46139beb93cSSam Leffler }
eapol_sm_request_reauth(struct eapol_sm * sm)46239beb93cSSam Leffler static inline void eapol_sm_request_reauth(struct eapol_sm *sm)
46339beb93cSSam Leffler {
46439beb93cSSam Leffler }
eapol_sm_notify_lower_layer_success(struct eapol_sm * sm,int in_eapol_sm)46539beb93cSSam Leffler static inline void eapol_sm_notify_lower_layer_success(struct eapol_sm *sm,
46639beb93cSSam Leffler 						       int in_eapol_sm)
46739beb93cSSam Leffler {
46839beb93cSSam Leffler }
eapol_sm_invalidate_cached_session(struct eapol_sm * sm)46939beb93cSSam Leffler static inline void eapol_sm_invalidate_cached_session(struct eapol_sm *sm)
47039beb93cSSam Leffler {
47139beb93cSSam Leffler }
eapol_sm_get_method_name(struct eapol_sm * sm)472f05cddf9SRui Paulo static inline const char * eapol_sm_get_method_name(struct eapol_sm *sm)
473f05cddf9SRui Paulo {
474f05cddf9SRui Paulo 	return NULL;
475f05cddf9SRui Paulo }
eapol_sm_set_ext_pw_ctx(struct eapol_sm * sm,struct ext_password_data * ext)476f05cddf9SRui Paulo static inline void eapol_sm_set_ext_pw_ctx(struct eapol_sm *sm,
477f05cddf9SRui Paulo 					   struct ext_password_data *ext)
478f05cddf9SRui Paulo {
479f05cddf9SRui Paulo }
eapol_sm_failed(struct eapol_sm * sm)480f05cddf9SRui Paulo static inline int eapol_sm_failed(struct eapol_sm *sm)
481f05cddf9SRui Paulo {
482f05cddf9SRui Paulo 	return 0;
483f05cddf9SRui Paulo }
eapol_sm_erp_flush(struct eapol_sm * sm)4845b9c547cSRui Paulo static inline void eapol_sm_erp_flush(struct eapol_sm *sm)
4855b9c547cSRui Paulo {
4865b9c547cSRui Paulo }
48785732ac8SCy Schubert static inline struct wpabuf *
eapol_sm_build_erp_reauth_start(struct eapol_sm * sm)48885732ac8SCy Schubert eapol_sm_build_erp_reauth_start(struct eapol_sm *sm)
48985732ac8SCy Schubert {
49085732ac8SCy Schubert 	return NULL;
49185732ac8SCy Schubert }
eapol_sm_process_erp_finish(struct eapol_sm * sm,const u8 * buf,size_t len)49285732ac8SCy Schubert static inline void eapol_sm_process_erp_finish(struct eapol_sm *sm,
49385732ac8SCy Schubert 					       const u8 *buf, size_t len)
49485732ac8SCy Schubert {
49585732ac8SCy Schubert }
eapol_sm_update_erp_next_seq_num(struct eapol_sm * sm,u16 next_seq_num)49685732ac8SCy Schubert static inline int eapol_sm_update_erp_next_seq_num(struct eapol_sm *sm,
49785732ac8SCy Schubert 						   u16 next_seq_num)
49885732ac8SCy Schubert {
49985732ac8SCy Schubert 	return -1;
50085732ac8SCy Schubert }
50185732ac8SCy Schubert static inline int
eapol_sm_get_erp_info(struct eapol_sm * sm,struct eap_peer_config * config,const u8 ** username,size_t * username_len,const u8 ** realm,size_t * realm_len,u16 * erp_next_seq_num,const u8 ** rrk,size_t * rrk_len)50285732ac8SCy Schubert eapol_sm_get_erp_info(struct eapol_sm *sm, struct eap_peer_config *config,
50385732ac8SCy Schubert 		      const u8 **username, size_t *username_len,
50485732ac8SCy Schubert 		      const u8 **realm, size_t *realm_len,
50585732ac8SCy Schubert 		      u16 *erp_next_seq_num, const u8 **rrk, size_t *rrk_len)
50685732ac8SCy Schubert {
50785732ac8SCy Schubert 	return -1;
50885732ac8SCy Schubert }
50939beb93cSSam Leffler #endif /* IEEE8021X_EAPOL */
51039beb93cSSam Leffler 
51139beb93cSSam Leffler #endif /* EAPOL_SUPP_SM_H */
512