xref: /freebsd/contrib/wpa/src/rsn_supp/wpa.h (revision 85732ac8bccbc0adcf5a261ea1ffec8ca7b3a92d)
139beb93cSSam Leffler /*
239beb93cSSam Leffler  * wpa_supplicant - WPA definitions
35b9c547cSRui Paulo  * Copyright (c) 2003-2015, 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 WPA_H
1039beb93cSSam Leffler #define WPA_H
1139beb93cSSam Leffler 
12e28a4053SRui Paulo #include "common/defs.h"
13e28a4053SRui Paulo #include "common/eapol_common.h"
14e28a4053SRui Paulo #include "common/wpa_common.h"
155b9c547cSRui Paulo #include "common/ieee802_11_defs.h"
1639beb93cSSam Leffler 
1739beb93cSSam Leffler struct wpa_sm;
1839beb93cSSam Leffler struct eapol_sm;
1939beb93cSSam Leffler struct wpa_config_blob;
205b9c547cSRui Paulo struct hostapd_freq_params;
2139beb93cSSam Leffler 
2239beb93cSSam Leffler struct wpa_sm_ctx {
2339beb93cSSam Leffler 	void *ctx; /* pointer to arbitrary upper level context */
24e28a4053SRui Paulo 	void *msg_ctx; /* upper level context for wpa_msg() calls */
2539beb93cSSam Leffler 
26e28a4053SRui Paulo 	void (*set_state)(void *ctx, enum wpa_states state);
27e28a4053SRui Paulo 	enum wpa_states (*get_state)(void *ctx);
2839beb93cSSam Leffler 	void (*deauthenticate)(void * ctx, int reason_code);
29e28a4053SRui Paulo 	int (*set_key)(void *ctx, enum wpa_alg alg,
3039beb93cSSam Leffler 		       const u8 *addr, int key_idx, int set_tx,
3139beb93cSSam Leffler 		       const u8 *seq, size_t seq_len,
3239beb93cSSam Leffler 		       const u8 *key, size_t key_len);
3339beb93cSSam Leffler 	void * (*get_network_ctx)(void *ctx);
3439beb93cSSam Leffler 	int (*get_bssid)(void *ctx, u8 *bssid);
3539beb93cSSam Leffler 	int (*ether_send)(void *ctx, const u8 *dest, u16 proto, const u8 *buf,
3639beb93cSSam Leffler 			  size_t len);
3739beb93cSSam Leffler 	int (*get_beacon_ie)(void *ctx);
3839beb93cSSam Leffler 	void (*cancel_auth_timeout)(void *ctx);
3939beb93cSSam Leffler 	u8 * (*alloc_eapol)(void *ctx, u8 type, const void *data, u16 data_len,
4039beb93cSSam Leffler 			    size_t *msg_len, void **data_pos);
41*85732ac8SCy Schubert 	int (*add_pmkid)(void *ctx, void *network_ctx, const u8 *bssid,
42*85732ac8SCy Schubert 			 const u8 *pmkid, const u8 *fils_cache_id,
43*85732ac8SCy Schubert 			 const u8 *pmk, size_t pmk_len);
44*85732ac8SCy Schubert 	int (*remove_pmkid)(void *ctx, void *network_ctx, const u8 *bssid,
45*85732ac8SCy Schubert 			    const u8 *pmkid, const u8 *fils_cache_id);
4639beb93cSSam Leffler 	void (*set_config_blob)(void *ctx, struct wpa_config_blob *blob);
4739beb93cSSam Leffler 	const struct wpa_config_blob * (*get_config_blob)(void *ctx,
4839beb93cSSam Leffler 							  const char *name);
4939beb93cSSam Leffler 	int (*mlme_setprotection)(void *ctx, const u8 *addr,
5039beb93cSSam Leffler 				  int protection_type, int key_type);
5139beb93cSSam Leffler 	int (*update_ft_ies)(void *ctx, const u8 *md, const u8 *ies,
5239beb93cSSam Leffler 			     size_t ies_len);
5339beb93cSSam Leffler 	int (*send_ft_action)(void *ctx, u8 action, const u8 *target_ap,
5439beb93cSSam Leffler 			      const u8 *ies, size_t ies_len);
55e28a4053SRui Paulo 	int (*mark_authenticated)(void *ctx, const u8 *target_ap);
56f05cddf9SRui Paulo #ifdef CONFIG_TDLS
57f05cddf9SRui Paulo 	int (*tdls_get_capa)(void *ctx, int *tdls_supported,
585b9c547cSRui Paulo 			     int *tdls_ext_setup, int *tdls_chan_switch);
59f05cddf9SRui Paulo 	int (*send_tdls_mgmt)(void *ctx, const u8 *dst,
60f05cddf9SRui Paulo 			      u8 action_code, u8 dialog_token,
615b9c547cSRui Paulo 			      u16 status_code, u32 peer_capab,
625b9c547cSRui Paulo 			      int initiator, const u8 *buf, size_t len);
63f05cddf9SRui Paulo 	int (*tdls_oper)(void *ctx, int oper, const u8 *peer);
645b9c547cSRui Paulo 	int (*tdls_peer_addset)(void *ctx, const u8 *addr, int add, u16 aid,
65f05cddf9SRui Paulo 				u16 capability, const u8 *supp_rates,
665b9c547cSRui Paulo 				size_t supp_rates_len,
675b9c547cSRui Paulo 				const struct ieee80211_ht_capabilities *ht_capab,
685b9c547cSRui Paulo 				const struct ieee80211_vht_capabilities *vht_capab,
695b9c547cSRui Paulo 				u8 qosinfo, int wmm, const u8 *ext_capab,
705b9c547cSRui Paulo 				size_t ext_capab_len, const u8 *supp_channels,
715b9c547cSRui Paulo 				size_t supp_channels_len,
725b9c547cSRui Paulo 				const u8 *supp_oper_classes,
735b9c547cSRui Paulo 				size_t supp_oper_classes_len);
745b9c547cSRui Paulo 	int (*tdls_enable_channel_switch)(
755b9c547cSRui Paulo 		void *ctx, const u8 *addr, u8 oper_class,
765b9c547cSRui Paulo 		const struct hostapd_freq_params *params);
775b9c547cSRui Paulo 	int (*tdls_disable_channel_switch)(void *ctx, const u8 *addr);
78f05cddf9SRui Paulo #endif /* CONFIG_TDLS */
795b9c547cSRui Paulo 	void (*set_rekey_offload)(void *ctx, const u8 *kek, size_t kek_len,
805b9c547cSRui Paulo 				  const u8 *kck, size_t kck_len,
81f05cddf9SRui Paulo 				  const u8 *replay_ctr);
825b9c547cSRui Paulo 	int (*key_mgmt_set_pmk)(void *ctx, const u8 *pmk, size_t pmk_len);
83*85732ac8SCy Schubert 	void (*fils_hlp_rx)(void *ctx, const u8 *dst, const u8 *src,
84*85732ac8SCy Schubert 			    const u8 *pkt, size_t pkt_len);
8539beb93cSSam Leffler };
8639beb93cSSam Leffler 
8739beb93cSSam Leffler 
8839beb93cSSam Leffler enum wpa_sm_conf_params {
8939beb93cSSam Leffler 	RSNA_PMK_LIFETIME /* dot11RSNAConfigPMKLifetime */,
9039beb93cSSam Leffler 	RSNA_PMK_REAUTH_THRESHOLD /* dot11RSNAConfigPMKReauthThreshold */,
9139beb93cSSam Leffler 	RSNA_SA_TIMEOUT /* dot11RSNAConfigSATimeout */,
9239beb93cSSam Leffler 	WPA_PARAM_PROTO,
9339beb93cSSam Leffler 	WPA_PARAM_PAIRWISE,
9439beb93cSSam Leffler 	WPA_PARAM_GROUP,
9539beb93cSSam Leffler 	WPA_PARAM_KEY_MGMT,
9639beb93cSSam Leffler 	WPA_PARAM_MGMT_GROUP,
97e28a4053SRui Paulo 	WPA_PARAM_RSN_ENABLED,
98e28a4053SRui Paulo 	WPA_PARAM_MFP
9939beb93cSSam Leffler };
10039beb93cSSam Leffler 
10139beb93cSSam Leffler struct rsn_supp_config {
10239beb93cSSam Leffler 	void *network_ctx;
10339beb93cSSam Leffler 	int allowed_pairwise_cipher; /* bitfield of WPA_CIPHER_* */
10439beb93cSSam Leffler 	int proactive_key_caching;
10539beb93cSSam Leffler 	int eap_workaround;
10639beb93cSSam Leffler 	void *eap_conf_ctx;
10739beb93cSSam Leffler 	const u8 *ssid;
10839beb93cSSam Leffler 	size_t ssid_len;
10939beb93cSSam Leffler 	int wpa_ptk_rekey;
1105b9c547cSRui Paulo 	int p2p;
111780fb4a2SCy Schubert 	int wpa_rsc_relaxation;
112*85732ac8SCy Schubert 	const u8 *fils_cache_id;
11339beb93cSSam Leffler };
11439beb93cSSam Leffler 
11539beb93cSSam Leffler #ifndef CONFIG_NO_WPA
11639beb93cSSam Leffler 
11739beb93cSSam Leffler struct wpa_sm * wpa_sm_init(struct wpa_sm_ctx *ctx);
11839beb93cSSam Leffler void wpa_sm_deinit(struct wpa_sm *sm);
11939beb93cSSam Leffler void wpa_sm_notify_assoc(struct wpa_sm *sm, const u8 *bssid);
12039beb93cSSam Leffler void wpa_sm_notify_disassoc(struct wpa_sm *sm);
1215b9c547cSRui Paulo void wpa_sm_set_pmk(struct wpa_sm *sm, const u8 *pmk, size_t pmk_len,
122780fb4a2SCy Schubert 		    const u8 *pmkid, const u8 *bssid);
12339beb93cSSam Leffler void wpa_sm_set_pmk_from_pmksa(struct wpa_sm *sm);
12439beb93cSSam Leffler void wpa_sm_set_fast_reauth(struct wpa_sm *sm, int fast_reauth);
12539beb93cSSam Leffler void wpa_sm_set_scard_ctx(struct wpa_sm *sm, void *scard_ctx);
12639beb93cSSam Leffler void wpa_sm_set_config(struct wpa_sm *sm, struct rsn_supp_config *config);
12739beb93cSSam Leffler void wpa_sm_set_own_addr(struct wpa_sm *sm, const u8 *addr);
12839beb93cSSam Leffler void wpa_sm_set_ifname(struct wpa_sm *sm, const char *ifname,
12939beb93cSSam Leffler 		       const char *bridge_ifname);
13039beb93cSSam Leffler void wpa_sm_set_eapol(struct wpa_sm *sm, struct eapol_sm *eapol);
13139beb93cSSam Leffler int wpa_sm_set_assoc_wpa_ie(struct wpa_sm *sm, const u8 *ie, size_t len);
13239beb93cSSam Leffler int wpa_sm_set_assoc_wpa_ie_default(struct wpa_sm *sm, u8 *wpa_ie,
13339beb93cSSam Leffler 				    size_t *wpa_ie_len);
13439beb93cSSam Leffler int wpa_sm_set_ap_wpa_ie(struct wpa_sm *sm, const u8 *ie, size_t len);
13539beb93cSSam Leffler int wpa_sm_set_ap_rsn_ie(struct wpa_sm *sm, const u8 *ie, size_t len);
13639beb93cSSam Leffler int wpa_sm_get_mib(struct wpa_sm *sm, char *buf, size_t buflen);
13739beb93cSSam Leffler 
13839beb93cSSam Leffler int wpa_sm_set_param(struct wpa_sm *sm, enum wpa_sm_conf_params param,
13939beb93cSSam Leffler 		     unsigned int value);
14039beb93cSSam Leffler 
14139beb93cSSam Leffler int wpa_sm_get_status(struct wpa_sm *sm, char *buf, size_t buflen,
14239beb93cSSam Leffler 		      int verbose);
1435b9c547cSRui Paulo int wpa_sm_pmf_enabled(struct wpa_sm *sm);
14439beb93cSSam Leffler 
14539beb93cSSam Leffler void wpa_sm_key_request(struct wpa_sm *sm, int error, int pairwise);
14639beb93cSSam Leffler 
14739beb93cSSam Leffler int wpa_parse_wpa_ie(const u8 *wpa_ie, size_t wpa_ie_len,
14839beb93cSSam Leffler 		     struct wpa_ie_data *data);
14939beb93cSSam Leffler 
15039beb93cSSam Leffler void wpa_sm_aborted_cached(struct wpa_sm *sm);
15139beb93cSSam Leffler int wpa_sm_rx_eapol(struct wpa_sm *sm, const u8 *src_addr,
15239beb93cSSam Leffler 		    const u8 *buf, size_t len);
15339beb93cSSam Leffler int wpa_sm_parse_own_wpa_ie(struct wpa_sm *sm, struct wpa_ie_data *data);
154e28a4053SRui Paulo int wpa_sm_pmksa_cache_list(struct wpa_sm *sm, char *buf, size_t len);
155*85732ac8SCy Schubert struct rsn_pmksa_cache_entry * wpa_sm_pmksa_cache_head(struct wpa_sm *sm);
156*85732ac8SCy Schubert struct rsn_pmksa_cache_entry *
157*85732ac8SCy Schubert wpa_sm_pmksa_cache_add_entry(struct wpa_sm *sm,
158*85732ac8SCy Schubert 			     struct rsn_pmksa_cache_entry * entry);
159*85732ac8SCy Schubert void wpa_sm_pmksa_cache_add(struct wpa_sm *sm, const u8 *pmk, size_t pmk_len,
160*85732ac8SCy Schubert 			    const u8 *pmkid, const u8 *bssid,
161*85732ac8SCy Schubert 			    const u8 *fils_cache_id);
162*85732ac8SCy Schubert int wpa_sm_pmksa_exists(struct wpa_sm *sm, const u8 *bssid,
163*85732ac8SCy Schubert 			const void *network_ctx);
164e28a4053SRui Paulo void wpa_sm_drop_sa(struct wpa_sm *sm);
165e28a4053SRui Paulo int wpa_sm_has_ptk(struct wpa_sm *sm);
16639beb93cSSam Leffler 
167f05cddf9SRui Paulo void wpa_sm_update_replay_ctr(struct wpa_sm *sm, const u8 *replay_ctr);
168f05cddf9SRui Paulo 
169f05cddf9SRui Paulo void wpa_sm_pmksa_cache_flush(struct wpa_sm *sm, void *network_ctx);
170f05cddf9SRui Paulo 
1715b9c547cSRui Paulo int wpa_sm_get_p2p_ip_addr(struct wpa_sm *sm, u8 *buf);
1725b9c547cSRui Paulo 
1735b9c547cSRui Paulo void wpa_sm_set_rx_replay_ctr(struct wpa_sm *sm, const u8 *rx_replay_counter);
1745b9c547cSRui Paulo void wpa_sm_set_ptk_kck_kek(struct wpa_sm *sm,
1755b9c547cSRui Paulo 			    const u8 *ptk_kck, size_t ptk_kck_len,
1765b9c547cSRui Paulo 			    const u8 *ptk_kek, size_t ptk_kek_len);
177*85732ac8SCy Schubert int wpa_fils_is_completed(struct wpa_sm *sm);
1785b9c547cSRui Paulo 
17939beb93cSSam Leffler #else /* CONFIG_NO_WPA */
18039beb93cSSam Leffler 
18139beb93cSSam Leffler static inline struct wpa_sm * wpa_sm_init(struct wpa_sm_ctx *ctx)
18239beb93cSSam Leffler {
18339beb93cSSam Leffler 	return (struct wpa_sm *) 1;
18439beb93cSSam Leffler }
18539beb93cSSam Leffler 
18639beb93cSSam Leffler static inline void wpa_sm_deinit(struct wpa_sm *sm)
18739beb93cSSam Leffler {
18839beb93cSSam Leffler }
18939beb93cSSam Leffler 
19039beb93cSSam Leffler static inline void wpa_sm_notify_assoc(struct wpa_sm *sm, const u8 *bssid)
19139beb93cSSam Leffler {
19239beb93cSSam Leffler }
19339beb93cSSam Leffler 
19439beb93cSSam Leffler static inline void wpa_sm_notify_disassoc(struct wpa_sm *sm)
19539beb93cSSam Leffler {
19639beb93cSSam Leffler }
19739beb93cSSam Leffler 
19839beb93cSSam Leffler static inline void wpa_sm_set_pmk(struct wpa_sm *sm, const u8 *pmk,
199780fb4a2SCy Schubert 				  size_t pmk_len, const u8 *pmkid,
200780fb4a2SCy Schubert 				  const u8 *bssid)
20139beb93cSSam Leffler {
20239beb93cSSam Leffler }
20339beb93cSSam Leffler 
20439beb93cSSam Leffler static inline void wpa_sm_set_pmk_from_pmksa(struct wpa_sm *sm)
20539beb93cSSam Leffler {
20639beb93cSSam Leffler }
20739beb93cSSam Leffler 
20839beb93cSSam Leffler static inline void wpa_sm_set_fast_reauth(struct wpa_sm *sm, int fast_reauth)
20939beb93cSSam Leffler {
21039beb93cSSam Leffler }
21139beb93cSSam Leffler 
21239beb93cSSam Leffler static inline void wpa_sm_set_scard_ctx(struct wpa_sm *sm, void *scard_ctx)
21339beb93cSSam Leffler {
21439beb93cSSam Leffler }
21539beb93cSSam Leffler 
21639beb93cSSam Leffler static inline void wpa_sm_set_config(struct wpa_sm *sm,
21739beb93cSSam Leffler 				     struct rsn_supp_config *config)
21839beb93cSSam Leffler {
21939beb93cSSam Leffler }
22039beb93cSSam Leffler 
22139beb93cSSam Leffler static inline void wpa_sm_set_own_addr(struct wpa_sm *sm, const u8 *addr)
22239beb93cSSam Leffler {
22339beb93cSSam Leffler }
22439beb93cSSam Leffler 
22539beb93cSSam Leffler static inline void wpa_sm_set_ifname(struct wpa_sm *sm, const char *ifname,
22639beb93cSSam Leffler 				     const char *bridge_ifname)
22739beb93cSSam Leffler {
22839beb93cSSam Leffler }
22939beb93cSSam Leffler 
23039beb93cSSam Leffler static inline void wpa_sm_set_eapol(struct wpa_sm *sm, struct eapol_sm *eapol)
23139beb93cSSam Leffler {
23239beb93cSSam Leffler }
23339beb93cSSam Leffler 
23439beb93cSSam Leffler static inline int wpa_sm_set_assoc_wpa_ie(struct wpa_sm *sm, const u8 *ie,
23539beb93cSSam Leffler 					  size_t len)
23639beb93cSSam Leffler {
23739beb93cSSam Leffler 	return -1;
23839beb93cSSam Leffler }
23939beb93cSSam Leffler 
24039beb93cSSam Leffler static inline int wpa_sm_set_assoc_wpa_ie_default(struct wpa_sm *sm,
24139beb93cSSam Leffler 						  u8 *wpa_ie,
24239beb93cSSam Leffler 						  size_t *wpa_ie_len)
24339beb93cSSam Leffler {
24439beb93cSSam Leffler 	return -1;
24539beb93cSSam Leffler }
24639beb93cSSam Leffler 
24739beb93cSSam Leffler static inline int wpa_sm_set_ap_wpa_ie(struct wpa_sm *sm, const u8 *ie,
24839beb93cSSam Leffler 				       size_t len)
24939beb93cSSam Leffler {
25039beb93cSSam Leffler 	return -1;
25139beb93cSSam Leffler }
25239beb93cSSam Leffler 
25339beb93cSSam Leffler static inline int wpa_sm_set_ap_rsn_ie(struct wpa_sm *sm, const u8 *ie,
25439beb93cSSam Leffler 				       size_t len)
25539beb93cSSam Leffler {
25639beb93cSSam Leffler 	return -1;
25739beb93cSSam Leffler }
25839beb93cSSam Leffler 
25939beb93cSSam Leffler static inline int wpa_sm_get_mib(struct wpa_sm *sm, char *buf, size_t buflen)
26039beb93cSSam Leffler {
26139beb93cSSam Leffler 	return 0;
26239beb93cSSam Leffler }
26339beb93cSSam Leffler 
26439beb93cSSam Leffler static inline int wpa_sm_set_param(struct wpa_sm *sm,
26539beb93cSSam Leffler 				   enum wpa_sm_conf_params param,
26639beb93cSSam Leffler 				   unsigned int value)
26739beb93cSSam Leffler {
26839beb93cSSam Leffler 	return -1;
26939beb93cSSam Leffler }
27039beb93cSSam Leffler 
2715b9c547cSRui Paulo static inline int wpa_sm_get_status(struct wpa_sm *sm, char *buf,
2725b9c547cSRui Paulo 				    size_t buflen, int verbose)
27339beb93cSSam Leffler {
27439beb93cSSam Leffler 	return 0;
27539beb93cSSam Leffler }
27639beb93cSSam Leffler 
2775b9c547cSRui Paulo static inline int wpa_sm_pmf_enabled(struct wpa_sm *sm)
27839beb93cSSam Leffler {
27939beb93cSSam Leffler 	return 0;
28039beb93cSSam Leffler }
28139beb93cSSam Leffler 
28239beb93cSSam Leffler static inline void wpa_sm_key_request(struct wpa_sm *sm, int error,
28339beb93cSSam Leffler 				      int pairwise)
28439beb93cSSam Leffler {
28539beb93cSSam Leffler }
28639beb93cSSam Leffler 
28739beb93cSSam Leffler static inline int wpa_parse_wpa_ie(const u8 *wpa_ie, size_t wpa_ie_len,
28839beb93cSSam Leffler 				   struct wpa_ie_data *data)
28939beb93cSSam Leffler {
29039beb93cSSam Leffler 	return -1;
29139beb93cSSam Leffler }
29239beb93cSSam Leffler 
29339beb93cSSam Leffler static inline void wpa_sm_aborted_cached(struct wpa_sm *sm)
29439beb93cSSam Leffler {
29539beb93cSSam Leffler }
29639beb93cSSam Leffler 
29739beb93cSSam Leffler static inline int wpa_sm_rx_eapol(struct wpa_sm *sm, const u8 *src_addr,
29839beb93cSSam Leffler 				  const u8 *buf, size_t len)
29939beb93cSSam Leffler {
30039beb93cSSam Leffler 	return -1;
30139beb93cSSam Leffler }
30239beb93cSSam Leffler 
30339beb93cSSam Leffler static inline int wpa_sm_parse_own_wpa_ie(struct wpa_sm *sm,
30439beb93cSSam Leffler 					  struct wpa_ie_data *data)
30539beb93cSSam Leffler {
30639beb93cSSam Leffler 	return -1;
30739beb93cSSam Leffler }
30839beb93cSSam Leffler 
309e28a4053SRui Paulo static inline int wpa_sm_pmksa_cache_list(struct wpa_sm *sm, char *buf,
310e28a4053SRui Paulo 					  size_t len)
311e28a4053SRui Paulo {
312e28a4053SRui Paulo 	return -1;
313e28a4053SRui Paulo }
314e28a4053SRui Paulo 
315e28a4053SRui Paulo static inline void wpa_sm_drop_sa(struct wpa_sm *sm)
316e28a4053SRui Paulo {
317e28a4053SRui Paulo }
318e28a4053SRui Paulo 
319e28a4053SRui Paulo static inline int wpa_sm_has_ptk(struct wpa_sm *sm)
320e28a4053SRui Paulo {
321e28a4053SRui Paulo 	return 0;
322e28a4053SRui Paulo }
323e28a4053SRui Paulo 
324f05cddf9SRui Paulo static inline void wpa_sm_update_replay_ctr(struct wpa_sm *sm,
325f05cddf9SRui Paulo 					    const u8 *replay_ctr)
326f05cddf9SRui Paulo {
327f05cddf9SRui Paulo }
328f05cddf9SRui Paulo 
329f05cddf9SRui Paulo static inline void wpa_sm_pmksa_cache_flush(struct wpa_sm *sm,
330f05cddf9SRui Paulo 					    void *network_ctx)
331f05cddf9SRui Paulo {
332f05cddf9SRui Paulo }
333f05cddf9SRui Paulo 
3345b9c547cSRui Paulo static inline void wpa_sm_set_rx_replay_ctr(struct wpa_sm *sm,
3355b9c547cSRui Paulo 					    const u8 *rx_replay_counter)
3365b9c547cSRui Paulo {
3375b9c547cSRui Paulo }
3385b9c547cSRui Paulo 
3395b9c547cSRui Paulo static inline void wpa_sm_set_ptk_kck_kek(struct wpa_sm *sm, const u8 *ptk_kck,
340780fb4a2SCy Schubert 					  size_t ptk_kck_len,
341780fb4a2SCy Schubert 					  const u8 *ptk_kek, size_t ptk_kek_len)
3425b9c547cSRui Paulo {
3435b9c547cSRui Paulo }
3445b9c547cSRui Paulo 
345*85732ac8SCy Schubert static inline int wpa_fils_is_completed(struct wpa_sm *sm)
3465b9c547cSRui Paulo {
3475b9c547cSRui Paulo 	return 0;
3485b9c547cSRui Paulo }
349*85732ac8SCy Schubert 
350*85732ac8SCy Schubert #endif /* CONFIG_NO_WPA */
35139beb93cSSam Leffler 
35239beb93cSSam Leffler #ifdef CONFIG_IEEE80211R
35339beb93cSSam Leffler 
354e28a4053SRui Paulo int wpa_sm_set_ft_params(struct wpa_sm *sm, const u8 *ies, size_t ies_len);
355e28a4053SRui Paulo int wpa_ft_prepare_auth_request(struct wpa_sm *sm, const u8 *mdie);
356*85732ac8SCy Schubert int wpa_ft_add_mdie(struct wpa_sm *sm, u8 *ies, size_t ies_len,
357*85732ac8SCy Schubert 		    const u8 *mdie);
358*85732ac8SCy Schubert const u8 * wpa_sm_get_ft_md(struct wpa_sm *sm);
35939beb93cSSam Leffler int wpa_ft_process_response(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
360e28a4053SRui Paulo 			    int ft_action, const u8 *target_ap,
361e28a4053SRui Paulo 			    const u8 *ric_ies, size_t ric_ies_len);
36239beb93cSSam Leffler int wpa_ft_is_completed(struct wpa_sm *sm);
3635b9c547cSRui Paulo void wpa_reset_ft_completed(struct wpa_sm *sm);
36439beb93cSSam Leffler int wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies,
36539beb93cSSam Leffler 				 size_t ies_len, const u8 *src_addr);
366e28a4053SRui Paulo int wpa_ft_start_over_ds(struct wpa_sm *sm, const u8 *target_ap,
367e28a4053SRui Paulo 			 const u8 *mdie);
36839beb93cSSam Leffler 
36939beb93cSSam Leffler #else /* CONFIG_IEEE80211R */
37039beb93cSSam Leffler 
37139beb93cSSam Leffler static inline int
372e28a4053SRui Paulo wpa_sm_set_ft_params(struct wpa_sm *sm, const u8 *ies, size_t ies_len)
37339beb93cSSam Leffler {
37439beb93cSSam Leffler 	return 0;
37539beb93cSSam Leffler }
37639beb93cSSam Leffler 
377e28a4053SRui Paulo static inline int wpa_ft_prepare_auth_request(struct wpa_sm *sm,
378e28a4053SRui Paulo 					      const u8 *mdie)
37939beb93cSSam Leffler {
38039beb93cSSam Leffler 	return 0;
38139beb93cSSam Leffler }
38239beb93cSSam Leffler 
383*85732ac8SCy Schubert static inline int wpa_ft_add_mdie(struct wpa_sm *sm, u8 *ies, size_t ies_len,
384*85732ac8SCy Schubert 				  const u8 *mdie)
385*85732ac8SCy Schubert {
386*85732ac8SCy Schubert 	return 0;
387*85732ac8SCy Schubert }
388*85732ac8SCy Schubert 
38939beb93cSSam Leffler static inline int
39039beb93cSSam Leffler wpa_ft_process_response(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
39139beb93cSSam Leffler 			int ft_action, const u8 *target_ap)
39239beb93cSSam Leffler {
39339beb93cSSam Leffler 	return 0;
39439beb93cSSam Leffler }
39539beb93cSSam Leffler 
39639beb93cSSam Leffler static inline int wpa_ft_is_completed(struct wpa_sm *sm)
39739beb93cSSam Leffler {
39839beb93cSSam Leffler 	return 0;
39939beb93cSSam Leffler }
40039beb93cSSam Leffler 
4015b9c547cSRui Paulo static inline void wpa_reset_ft_completed(struct wpa_sm *sm)
4025b9c547cSRui Paulo {
4035b9c547cSRui Paulo }
4045b9c547cSRui Paulo 
40539beb93cSSam Leffler static inline int
40639beb93cSSam Leffler wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
40739beb93cSSam Leffler 			     const u8 *src_addr)
40839beb93cSSam Leffler {
40939beb93cSSam Leffler 	return -1;
41039beb93cSSam Leffler }
41139beb93cSSam Leffler 
41239beb93cSSam Leffler #endif /* CONFIG_IEEE80211R */
41339beb93cSSam Leffler 
414f05cddf9SRui Paulo 
415f05cddf9SRui Paulo /* tdls.c */
416f05cddf9SRui Paulo void wpa_tdls_ap_ies(struct wpa_sm *sm, const u8 *ies, size_t len);
417f05cddf9SRui Paulo void wpa_tdls_assoc_resp_ies(struct wpa_sm *sm, const u8 *ies, size_t len);
418f05cddf9SRui Paulo int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr);
4195b9c547cSRui Paulo void wpa_tdls_remove(struct wpa_sm *sm, const u8 *addr);
420f05cddf9SRui Paulo int wpa_tdls_teardown_link(struct wpa_sm *sm, const u8 *addr, u16 reason_code);
421f05cddf9SRui Paulo int wpa_tdls_send_discovery_request(struct wpa_sm *sm, const u8 *addr);
422f05cddf9SRui Paulo int wpa_tdls_init(struct wpa_sm *sm);
4235b9c547cSRui Paulo void wpa_tdls_teardown_peers(struct wpa_sm *sm);
424f05cddf9SRui Paulo void wpa_tdls_deinit(struct wpa_sm *sm);
425f05cddf9SRui Paulo void wpa_tdls_enable(struct wpa_sm *sm, int enabled);
4265b9c547cSRui Paulo void wpa_tdls_disable_unreachable_link(struct wpa_sm *sm, const u8 *addr);
4275b9c547cSRui Paulo const char * wpa_tdls_get_link_status(struct wpa_sm *sm, const u8 *addr);
428f05cddf9SRui Paulo int wpa_tdls_is_external_setup(struct wpa_sm *sm);
4295b9c547cSRui Paulo int wpa_tdls_enable_chan_switch(struct wpa_sm *sm, const u8 *addr,
4305b9c547cSRui Paulo 				u8 oper_class,
4315b9c547cSRui Paulo 				struct hostapd_freq_params *freq_params);
4325b9c547cSRui Paulo int wpa_tdls_disable_chan_switch(struct wpa_sm *sm, const u8 *addr);
433780fb4a2SCy Schubert #ifdef CONFIG_TDLS_TESTING
434780fb4a2SCy Schubert extern unsigned int tdls_testing;
435780fb4a2SCy Schubert #endif /* CONFIG_TDLS_TESTING */
436780fb4a2SCy Schubert 
437f05cddf9SRui Paulo 
438f05cddf9SRui Paulo int wpa_wnmsleep_install_key(struct wpa_sm *sm, u8 subelem_id, u8 *buf);
439780fb4a2SCy Schubert void wpa_sm_set_test_assoc_ie(struct wpa_sm *sm, struct wpabuf *buf);
440*85732ac8SCy Schubert const u8 * wpa_sm_get_anonce(struct wpa_sm *sm);
441*85732ac8SCy Schubert unsigned int wpa_sm_get_key_mgmt(struct wpa_sm *sm);
442*85732ac8SCy Schubert 
443*85732ac8SCy Schubert struct wpabuf * fils_build_auth(struct wpa_sm *sm, int dh_group, const u8 *md);
444*85732ac8SCy Schubert int fils_process_auth(struct wpa_sm *sm, const u8 *bssid, const u8 *data,
445*85732ac8SCy Schubert 		      size_t len);
446*85732ac8SCy Schubert struct wpabuf * fils_build_assoc_req(struct wpa_sm *sm, const u8 **kek,
447*85732ac8SCy Schubert 				     size_t *kek_len, const u8 **snonce,
448*85732ac8SCy Schubert 				     const u8 **anonce,
449*85732ac8SCy Schubert 				     const struct wpabuf **hlp,
450*85732ac8SCy Schubert 				     unsigned int num_hlp);
451*85732ac8SCy Schubert int fils_process_assoc_resp(struct wpa_sm *sm, const u8 *resp, size_t len);
452*85732ac8SCy Schubert 
453*85732ac8SCy Schubert struct wpabuf * owe_build_assoc_req(struct wpa_sm *sm, u16 group);
454*85732ac8SCy Schubert int owe_process_assoc_resp(struct wpa_sm *sm, const u8 *bssid,
455*85732ac8SCy Schubert 			   const u8 *resp_ies, size_t resp_ies_len);
456*85732ac8SCy Schubert 
457*85732ac8SCy Schubert void wpa_sm_set_reset_fils_completed(struct wpa_sm *sm, int set);
458*85732ac8SCy Schubert void wpa_sm_set_fils_cache_id(struct wpa_sm *sm, const u8 *fils_cache_id);
459f05cddf9SRui Paulo 
46039beb93cSSam Leffler #endif /* WPA_H */
461