• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Internal WPA/RSN supplicant state machine definitions
3  * Copyright (c) 2004-2018, 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 WPA_I_H
10 #define WPA_I_H
11 
12 #include "utils/list.h"
13 
14 struct wpa_tdls_peer;
15 struct wpa_eapol_key;
16 
17 struct pasn_ft_r1kh {
18 	u8 bssid[ETH_ALEN];
19 	u8 r1kh_id[FT_R1KH_ID_LEN];
20 };
21 
22 /**
23  * struct wpa_sm - Internal WPA state machine data
24  */
25 struct wpa_sm {
26 	u8 pmk[PMK_LEN_MAX];
27 	size_t pmk_len;
28 	struct wpa_ptk ptk, tptk;
29 	int ptk_set, tptk_set;
30 	bool tk_set; /* Whether any TK is configured to the driver */
31 	unsigned int msg_3_of_4_ok:1;
32 	u8 snonce[WPA_NONCE_LEN];
33 	u8 anonce[WPA_NONCE_LEN]; /* ANonce from the last 1/4 msg */
34 	int renew_snonce;
35 	u8 rx_replay_counter[WPA_REPLAY_COUNTER_LEN];
36 	int rx_replay_counter_set;
37 	u8 request_counter[WPA_REPLAY_COUNTER_LEN];
38 	struct wpa_gtk gtk;
39 	struct wpa_gtk gtk_wnm_sleep;
40 	struct wpa_igtk igtk;
41 	struct wpa_igtk igtk_wnm_sleep;
42 	struct wpa_bigtk bigtk;
43 	struct wpa_bigtk bigtk_wnm_sleep;
44 
45 	struct eapol_sm *eapol; /* EAPOL state machine from upper level code */
46 
47 	struct rsn_pmksa_cache *pmksa; /* PMKSA cache */
48 	struct rsn_pmksa_cache_entry *cur_pmksa; /* current PMKSA entry */
49 	struct dl_list pmksa_candidates;
50 
51 	struct l2_packet_data *l2_preauth;
52 	struct l2_packet_data *l2_preauth_br;
53 	struct l2_packet_data *l2_tdls;
54 	u8 preauth_bssid[ETH_ALEN]; /* current RSN pre-auth peer or
55 				     * 00:00:00:00:00:00 if no pre-auth is
56 				     * in progress */
57 	struct eapol_sm *preauth_eapol;
58 
59 	struct wpa_sm_ctx *ctx;
60 
61 	void *scard_ctx; /* context for smartcard callbacks */
62 	int fast_reauth; /* whether EAP fast re-authentication is enabled */
63 
64 	void *network_ctx;
65 	int allowed_pairwise_cipher; /* bitfield of WPA_CIPHER_* */
66 	int proactive_key_caching;
67 	int eap_workaround;
68 	void *eap_conf_ctx;
69 	u8 ssid[32];
70 	size_t ssid_len;
71 	int wpa_ptk_rekey;
72 	int wpa_deny_ptk0_rekey:1;
73 	int p2p;
74 	int wpa_rsc_relaxation;
75 	int owe_ptk_workaround;
76 	int beacon_prot;
77 	int ext_key_id; /* whether Extended Key ID is enabled */
78 	int use_ext_key_id; /* whether Extended Key ID has been detected
79 			     * to be used */
80 	int keyidx_active; /* Key ID for the active TK */
81 
82 	/*
83 	 * If set Key Derivation Key should be derived as part of PMK to
84 	 * PTK derivation regardless of advertised capabilities.
85 	 */
86 	bool force_kdk_derivation;
87 
88 	u8 own_addr[ETH_ALEN];
89 	const char *ifname;
90 	const char *bridge_ifname;
91 	u8 bssid[ETH_ALEN];
92 
93 	unsigned int dot11RSNAConfigPMKLifetime;
94 	unsigned int dot11RSNAConfigPMKReauthThreshold;
95 	unsigned int dot11RSNAConfigSATimeout;
96 
97 	unsigned int dot11RSNA4WayHandshakeFailures;
98 
99 	/* Selected configuration (based on Beacon/ProbeResp WPA IE) */
100 	unsigned int proto;
101 	unsigned int pairwise_cipher;
102 	unsigned int group_cipher;
103 	unsigned int key_mgmt;
104 	unsigned int mgmt_group_cipher;
105 
106 	int rsn_enabled; /* Whether RSN is enabled in configuration */
107 	int mfp; /* 0 = disabled, 1 = optional, 2 = mandatory */
108 	int ocv; /* Operating Channel Validation */
109 	enum sae_pwe sae_pwe; /* SAE PWE generation options */
110 
111 	unsigned int sae_pk:1; /* whether SAE-PK is used */
112 	unsigned int secure_ltf:1;
113 	unsigned int secure_rtt:1;
114 	unsigned int prot_range_neg:1;
115 
116 	u8 *assoc_wpa_ie; /* Own WPA/RSN IE from (Re)AssocReq */
117 	size_t assoc_wpa_ie_len;
118 	u8 *assoc_rsnxe; /* Own RSNXE from (Re)AssocReq */
119 	size_t assoc_rsnxe_len;
120 	u8 *ap_wpa_ie, *ap_rsn_ie, *ap_rsnxe;
121 	size_t ap_wpa_ie_len, ap_rsn_ie_len, ap_rsnxe_len;
122 
123 #ifdef CONFIG_TDLS
124 	struct wpa_tdls_peer *tdls;
125 	int tdls_prohibited;
126 	int tdls_chan_switch_prohibited;
127 	int tdls_disabled;
128 
129 	/* The driver supports TDLS */
130 	int tdls_supported;
131 
132 	/*
133 	 * The driver requires explicit discovery/setup/teardown frames sent
134 	 * to it via tdls_mgmt.
135 	 */
136 	int tdls_external_setup;
137 
138 	/* The driver supports TDLS channel switching */
139 	int tdls_chan_switch;
140 #endif /* CONFIG_TDLS */
141 
142 #ifdef CONFIG_IEEE80211R
143 	u8 xxkey[PMK_LEN_MAX]; /* PSK or the second 256 bits of MSK, or the
144 				* first 384 bits of MSK */
145 	size_t xxkey_len;
146 	u8 pmk_r0[PMK_LEN_MAX];
147 	size_t pmk_r0_len;
148 	u8 pmk_r0_name[WPA_PMK_NAME_LEN];
149 	u8 pmk_r1[PMK_LEN_MAX];
150 	size_t pmk_r1_len;
151 	u8 pmk_r1_name[WPA_PMK_NAME_LEN];
152 	u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
153 	u8 key_mobility_domain[MOBILITY_DOMAIN_ID_LEN];
154 	u8 r0kh_id[FT_R0KH_ID_MAX_LEN];
155 	size_t r0kh_id_len;
156 	u8 r1kh_id[FT_R1KH_ID_LEN];
157 	unsigned int ft_completed:1;
158 	unsigned int ft_reassoc_completed:1;
159 	unsigned int ft_protocol:1;
160 	int over_the_ds_in_progress;
161 	u8 target_ap[ETH_ALEN]; /* over-the-DS target AP */
162 	int set_ptk_after_assoc;
163 	u8 mdie_ft_capab; /* FT Capability and Policy from target AP MDIE */
164 	u8 *assoc_resp_ies; /* MDIE and FTIE from (Re)Association Response */
165 	size_t assoc_resp_ies_len;
166 #ifdef CONFIG_PASN
167 	/*
168 	 * Currently, the WPA state machine stores the PMK-R1, PMK-R1-Name and
169 	 * R1KH-ID only for the current association. As PMK-R1 is required to
170 	 * perform PASN authentication with FT, store the R1KH-ID for previous
171 	 * associations, which would later be used to derive the PMK-R1 as part
172 	 * of the PASN authentication flow.
173 	 */
174 	struct pasn_ft_r1kh *pasn_r1kh;
175 	unsigned int n_pasn_r1kh;
176 #endif /* CONFIG_PASN */
177 #endif /* CONFIG_IEEE80211R */
178 
179 #ifdef CONFIG_P2P
180 	u8 p2p_ip_addr[3 * 4];
181 #endif /* CONFIG_P2P */
182 
183 #ifdef CONFIG_TESTING_OPTIONS
184 	struct wpabuf *test_assoc_ie;
185 	int ft_rsnxe_used;
186 	unsigned int oci_freq_override_eapol;
187 	unsigned int oci_freq_override_eapol_g2;
188 	unsigned int oci_freq_override_ft_assoc;
189 	unsigned int oci_freq_override_fils_assoc;
190 	unsigned int disable_eapol_g2_tx;
191 #endif /* CONFIG_TESTING_OPTIONS */
192 
193 #ifdef CONFIG_FILS
194 	u8 fils_nonce[FILS_NONCE_LEN];
195 	u8 fils_session[FILS_SESSION_LEN];
196 	u8 fils_anonce[FILS_NONCE_LEN];
197 	u8 fils_key_auth_ap[FILS_MAX_KEY_AUTH_LEN];
198 	u8 fils_key_auth_sta[FILS_MAX_KEY_AUTH_LEN];
199 	size_t fils_key_auth_len;
200 	unsigned int fils_completed:1;
201 	unsigned int fils_erp_pmkid_set:1;
202 	unsigned int fils_cache_id_set:1;
203 	u8 fils_erp_pmkid[PMKID_LEN];
204 	u8 fils_cache_id[FILS_CACHE_ID_LEN];
205 	struct crypto_ecdh *fils_ecdh;
206 	int fils_dh_group;
207 	size_t fils_dh_elem_len;
208 	struct wpabuf *fils_ft_ies;
209 	u8 fils_ft[FILS_FT_MAX_LEN];
210 	size_t fils_ft_len;
211 #endif /* CONFIG_FILS */
212 
213 #ifdef CONFIG_OWE
214 	struct crypto_ecdh *owe_ecdh;
215 	u16 owe_group;
216 #endif /* CONFIG_OWE */
217 
218 #ifdef CONFIG_DPP2
219 	struct wpabuf *dpp_z;
220 	int dpp_pfs;
221 #endif /* CONFIG_DPP2 */
222 	struct wpa_sm_mlo mlo;
223 
224 	bool wmm_enabled;
225 	bool driver_bss_selection;
226 };
227 
228 
wpa_sm_set_state(struct wpa_sm * sm,enum wpa_states state)229 static inline void wpa_sm_set_state(struct wpa_sm *sm, enum wpa_states state)
230 {
231 	WPA_ASSERT(sm->ctx->set_state);
232 	sm->ctx->set_state(sm->ctx->ctx, state);
233 }
234 
wpa_sm_get_state(struct wpa_sm * sm)235 static inline enum wpa_states wpa_sm_get_state(struct wpa_sm *sm)
236 {
237 	WPA_ASSERT(sm->ctx->get_state);
238 	return sm->ctx->get_state(sm->ctx->ctx);
239 }
240 
wpa_sm_deauthenticate(struct wpa_sm * sm,u16 reason_code)241 static inline void wpa_sm_deauthenticate(struct wpa_sm *sm, u16 reason_code)
242 {
243 	WPA_ASSERT(sm->ctx->deauthenticate);
244 	sm->ctx->deauthenticate(sm->ctx->ctx, reason_code);
245 }
246 
wpa_sm_set_key(struct wpa_sm * sm,int link_id,enum wpa_alg alg,const u8 * addr,int key_idx,int set_tx,const u8 * seq,size_t seq_len,const u8 * key,size_t key_len,enum key_flag key_flag)247 static inline int wpa_sm_set_key(struct wpa_sm *sm, int link_id,
248 				 enum wpa_alg alg, const u8 *addr, int key_idx,
249 				 int set_tx, const u8 *seq, size_t seq_len,
250 				 const u8 *key, size_t key_len,
251 				 enum key_flag key_flag)
252 {
253 	WPA_ASSERT(sm->ctx->set_key);
254 	return sm->ctx->set_key(sm->ctx->ctx, link_id, alg, addr, key_idx,
255 				set_tx, seq, seq_len, key, key_len, key_flag);
256 }
257 
wpa_sm_reconnect(struct wpa_sm * sm)258 static inline void wpa_sm_reconnect(struct wpa_sm *sm)
259 {
260 	WPA_ASSERT(sm->ctx->reconnect);
261 	sm->ctx->reconnect(sm->ctx->ctx);
262 }
263 
wpa_sm_get_network_ctx(struct wpa_sm * sm)264 static inline void * wpa_sm_get_network_ctx(struct wpa_sm *sm)
265 {
266 	WPA_ASSERT(sm->ctx->get_network_ctx);
267 	return sm->ctx->get_network_ctx(sm->ctx->ctx);
268 }
269 
wpa_sm_get_bssid(struct wpa_sm * sm,u8 * bssid)270 static inline int wpa_sm_get_bssid(struct wpa_sm *sm, u8 *bssid)
271 {
272 	WPA_ASSERT(sm->ctx->get_bssid);
273 	return sm->ctx->get_bssid(sm->ctx->ctx, bssid);
274 }
275 
wpa_sm_ether_send(struct wpa_sm * sm,const u8 * dest,u16 proto,const u8 * buf,size_t len)276 static inline int wpa_sm_ether_send(struct wpa_sm *sm, const u8 *dest,
277 				    u16 proto, const u8 *buf, size_t len)
278 {
279 	WPA_ASSERT(sm->ctx->ether_send);
280 	return sm->ctx->ether_send(sm->ctx->ctx, dest, proto, buf, len);
281 }
282 
wpa_sm_get_beacon_ie(struct wpa_sm * sm)283 static inline int wpa_sm_get_beacon_ie(struct wpa_sm *sm)
284 {
285 	WPA_ASSERT(sm->ctx->get_beacon_ie);
286 	return sm->ctx->get_beacon_ie(sm->ctx->ctx);
287 }
288 
wpa_sm_cancel_auth_timeout(struct wpa_sm * sm)289 static inline void wpa_sm_cancel_auth_timeout(struct wpa_sm *sm)
290 {
291 	WPA_ASSERT(sm->ctx->cancel_auth_timeout);
292 	sm->ctx->cancel_auth_timeout(sm->ctx->ctx);
293 }
294 
wpa_sm_alloc_eapol(struct wpa_sm * sm,u8 type,const void * data,u16 data_len,size_t * msg_len,void ** data_pos)295 static inline u8 * wpa_sm_alloc_eapol(struct wpa_sm *sm, u8 type,
296 				      const void *data, u16 data_len,
297 				      size_t *msg_len, void **data_pos)
298 {
299 	WPA_ASSERT(sm->ctx->alloc_eapol);
300 	return sm->ctx->alloc_eapol(sm->ctx->ctx, type, data, data_len,
301 				    msg_len, data_pos);
302 }
303 
wpa_sm_add_pmkid(struct wpa_sm * sm,void * network_ctx,const u8 * bssid,const u8 * pmkid,const u8 * cache_id,const u8 * pmk,size_t pmk_len,u32 pmk_lifetime,u8 pmk_reauth_threshold,int akmp)304 static inline int wpa_sm_add_pmkid(struct wpa_sm *sm, void *network_ctx,
305 				   const u8 *bssid, const u8 *pmkid,
306 				   const u8 *cache_id, const u8 *pmk,
307 				   size_t pmk_len, u32 pmk_lifetime,
308 				   u8 pmk_reauth_threshold, int akmp)
309 {
310 	WPA_ASSERT(sm->ctx->add_pmkid);
311 	return sm->ctx->add_pmkid(sm->ctx->ctx, network_ctx, bssid, pmkid,
312 				  cache_id, pmk, pmk_len, pmk_lifetime,
313 				  pmk_reauth_threshold, akmp);
314 }
315 
wpa_sm_remove_pmkid(struct wpa_sm * sm,void * network_ctx,const u8 * bssid,const u8 * pmkid,const u8 * cache_id)316 static inline int wpa_sm_remove_pmkid(struct wpa_sm *sm, void *network_ctx,
317 				      const u8 *bssid, const u8 *pmkid,
318 				      const u8 *cache_id)
319 {
320 	WPA_ASSERT(sm->ctx->remove_pmkid);
321 	return sm->ctx->remove_pmkid(sm->ctx->ctx, network_ctx, bssid, pmkid,
322 				     cache_id);
323 }
324 
wpa_sm_mlme_setprotection(struct wpa_sm * sm,const u8 * addr,int protect_type,int key_type)325 static inline int wpa_sm_mlme_setprotection(struct wpa_sm *sm, const u8 *addr,
326 					    int protect_type, int key_type)
327 {
328 	WPA_ASSERT(sm->ctx->mlme_setprotection);
329 	return sm->ctx->mlme_setprotection(sm->ctx->ctx, addr, protect_type,
330 					   key_type);
331 }
332 
wpa_sm_update_ft_ies(struct wpa_sm * sm,const u8 * md,const u8 * ies,size_t ies_len)333 static inline int wpa_sm_update_ft_ies(struct wpa_sm *sm, const u8 *md,
334 				       const u8 *ies, size_t ies_len)
335 {
336 	if (sm->ctx->update_ft_ies)
337 		return sm->ctx->update_ft_ies(sm->ctx->ctx, md, ies, ies_len);
338 	return -1;
339 }
340 
wpa_sm_send_ft_action(struct wpa_sm * sm,u8 action,const u8 * target_ap,const u8 * ies,size_t ies_len)341 static inline int wpa_sm_send_ft_action(struct wpa_sm *sm, u8 action,
342 					const u8 *target_ap,
343 					const u8 *ies, size_t ies_len)
344 {
345 	if (sm->ctx->send_ft_action)
346 		return sm->ctx->send_ft_action(sm->ctx->ctx, action, target_ap,
347 					       ies, ies_len);
348 	return -1;
349 }
350 
wpa_sm_mark_authenticated(struct wpa_sm * sm,const u8 * target_ap)351 static inline int wpa_sm_mark_authenticated(struct wpa_sm *sm,
352 					    const u8 *target_ap)
353 {
354 	if (sm->ctx->mark_authenticated)
355 		return sm->ctx->mark_authenticated(sm->ctx->ctx, target_ap);
356 	return -1;
357 }
358 
wpa_sm_set_rekey_offload(struct wpa_sm * sm)359 static inline void wpa_sm_set_rekey_offload(struct wpa_sm *sm)
360 {
361 	if (!sm->ctx->set_rekey_offload)
362 		return;
363 	sm->ctx->set_rekey_offload(sm->ctx->ctx, sm->ptk.kek, sm->ptk.kek_len,
364 				   sm->ptk.kck, sm->ptk.kck_len,
365 				   sm->rx_replay_counter);
366 }
367 
368 #ifdef CONFIG_TDLS
wpa_sm_tdls_get_capa(struct wpa_sm * sm,int * tdls_supported,int * tdls_ext_setup,int * tdls_chan_switch)369 static inline int wpa_sm_tdls_get_capa(struct wpa_sm *sm,
370 				       int *tdls_supported,
371 				       int *tdls_ext_setup,
372 				       int *tdls_chan_switch)
373 {
374 	if (sm->ctx->tdls_get_capa)
375 		return sm->ctx->tdls_get_capa(sm->ctx->ctx, tdls_supported,
376 					      tdls_ext_setup, tdls_chan_switch);
377 	return -1;
378 }
379 
wpa_sm_send_tdls_mgmt(struct wpa_sm * sm,const u8 * dst,u8 action_code,u8 dialog_token,u16 status_code,u32 peer_capab,int initiator,const u8 * buf,size_t len,int link_id)380 static inline int wpa_sm_send_tdls_mgmt(struct wpa_sm *sm, const u8 *dst,
381 					u8 action_code, u8 dialog_token,
382 					u16 status_code, u32 peer_capab,
383 					int initiator, const u8 *buf,
384 					size_t len, int link_id)
385 {
386 	if (sm->ctx->send_tdls_mgmt)
387 		return sm->ctx->send_tdls_mgmt(sm->ctx->ctx, dst, action_code,
388 					       dialog_token, status_code,
389 					       peer_capab, initiator, buf,
390 					       len, link_id);
391 	return -1;
392 }
393 
wpa_sm_tdls_oper(struct wpa_sm * sm,int oper,const u8 * peer)394 static inline int wpa_sm_tdls_oper(struct wpa_sm *sm, int oper,
395 				   const u8 *peer)
396 {
397 	if (sm->ctx->tdls_oper)
398 		return sm->ctx->tdls_oper(sm->ctx->ctx, oper, peer);
399 	return -1;
400 }
401 
402 static inline int
wpa_sm_tdls_peer_addset(struct wpa_sm * sm,const u8 * addr,int add,u16 aid,u16 capability,const u8 * supp_rates,size_t supp_rates_len,const struct ieee80211_ht_capabilities * ht_capab,const struct ieee80211_vht_capabilities * vht_capab,const struct ieee80211_he_capabilities * he_capab,size_t he_capab_len,const struct ieee80211_he_6ghz_band_cap * he_6ghz_capab,u8 qosinfo,int wmm,const u8 * ext_capab,size_t ext_capab_len,const u8 * supp_channels,size_t supp_channels_len,const u8 * supp_oper_classes,size_t supp_oper_classes_len,const struct ieee80211_eht_capabilities * eht_capab,size_t eht_capab_len,int mld_link_id)403 wpa_sm_tdls_peer_addset(struct wpa_sm *sm, const u8 *addr, int add,
404 			u16 aid, u16 capability, const u8 *supp_rates,
405 			size_t supp_rates_len,
406 			const struct ieee80211_ht_capabilities *ht_capab,
407 			const struct ieee80211_vht_capabilities *vht_capab,
408 			const struct ieee80211_he_capabilities *he_capab,
409 			size_t he_capab_len,
410 			const struct ieee80211_he_6ghz_band_cap *he_6ghz_capab,
411 			u8 qosinfo, int wmm, const u8 *ext_capab,
412 			size_t ext_capab_len, const u8 *supp_channels,
413 			size_t supp_channels_len, const u8 *supp_oper_classes,
414 			size_t supp_oper_classes_len,
415 			const struct ieee80211_eht_capabilities *eht_capab,
416 			size_t eht_capab_len, int mld_link_id)
417 {
418 	if (sm->ctx->tdls_peer_addset)
419 		return sm->ctx->tdls_peer_addset(sm->ctx->ctx, addr, add,
420 						 aid, capability, supp_rates,
421 						 supp_rates_len, ht_capab,
422 						 vht_capab,
423 						 he_capab, he_capab_len,
424 						 he_6ghz_capab, qosinfo, wmm,
425 						 ext_capab, ext_capab_len,
426 						 supp_channels,
427 						 supp_channels_len,
428 						 supp_oper_classes,
429 						 supp_oper_classes_len,
430 						 eht_capab, eht_capab_len,
431 						 mld_link_id);
432 	return -1;
433 }
434 
435 static inline int
wpa_sm_tdls_enable_channel_switch(struct wpa_sm * sm,const u8 * addr,u8 oper_class,const struct hostapd_freq_params * freq_params)436 wpa_sm_tdls_enable_channel_switch(struct wpa_sm *sm, const u8 *addr,
437 				  u8 oper_class,
438 				  const struct hostapd_freq_params *freq_params)
439 {
440 	if (sm->ctx->tdls_enable_channel_switch)
441 		return sm->ctx->tdls_enable_channel_switch(sm->ctx->ctx, addr,
442 							   oper_class,
443 							   freq_params);
444 	return -1;
445 }
446 
447 static inline int
wpa_sm_tdls_disable_channel_switch(struct wpa_sm * sm,const u8 * addr)448 wpa_sm_tdls_disable_channel_switch(struct wpa_sm *sm, const u8 *addr)
449 {
450 	if (sm->ctx->tdls_disable_channel_switch)
451 		return sm->ctx->tdls_disable_channel_switch(sm->ctx->ctx, addr);
452 	return -1;
453 }
454 #endif /* CONFIG_TDLS */
455 
wpa_sm_key_mgmt_set_pmk(struct wpa_sm * sm,const u8 * pmk,size_t pmk_len)456 static inline int wpa_sm_key_mgmt_set_pmk(struct wpa_sm *sm,
457 					  const u8 *pmk, size_t pmk_len)
458 {
459 	if (!sm->ctx->key_mgmt_set_pmk)
460 		return -1;
461 	return sm->ctx->key_mgmt_set_pmk(sm->ctx->ctx, pmk, pmk_len);
462 }
463 
wpa_sm_fils_hlp_rx(struct wpa_sm * sm,const u8 * dst,const u8 * src,const u8 * pkt,size_t pkt_len)464 static inline void wpa_sm_fils_hlp_rx(struct wpa_sm *sm,
465 				      const u8 *dst, const u8 *src,
466 				      const u8 *pkt, size_t pkt_len)
467 {
468 	if (sm->ctx->fils_hlp_rx)
469 		sm->ctx->fils_hlp_rx(sm->ctx->ctx, dst, src, pkt, pkt_len);
470 }
471 
wpa_sm_channel_info(struct wpa_sm * sm,struct wpa_channel_info * ci)472 static inline int wpa_sm_channel_info(struct wpa_sm *sm,
473 				      struct wpa_channel_info *ci)
474 {
475 	if (!sm->ctx->channel_info)
476 		return -1;
477 	return sm->ctx->channel_info(sm->ctx->ctx, ci);
478 }
479 
wpa_sm_transition_disable(struct wpa_sm * sm,u8 bitmap)480 static inline void wpa_sm_transition_disable(struct wpa_sm *sm, u8 bitmap)
481 {
482 	if (sm->ctx->transition_disable)
483 		sm->ctx->transition_disable(sm->ctx->ctx, bitmap);
484 }
485 
wpa_sm_store_ptk(struct wpa_sm * sm,const u8 * addr,int cipher,u32 life_time,struct wpa_ptk * ptk)486 static inline void wpa_sm_store_ptk(struct wpa_sm *sm,
487 				    const u8 *addr, int cipher,
488 				    u32 life_time, struct wpa_ptk *ptk)
489 {
490 	if (sm->ctx->store_ptk)
491 		sm->ctx->store_ptk(sm->ctx->ctx, addr, cipher, life_time,
492 				   ptk);
493 }
494 
495 #ifdef CONFIG_PASN
wpa_sm_set_ltf_keyseed(struct wpa_sm * sm,const u8 * own_addr,const u8 * peer_addr,size_t ltf_keyseed_len,const u8 * ltf_keyseed)496 static inline int wpa_sm_set_ltf_keyseed(struct wpa_sm *sm, const u8 *own_addr,
497 					 const u8 *peer_addr,
498 					 size_t ltf_keyseed_len,
499 					 const u8 *ltf_keyseed)
500 {
501 	WPA_ASSERT(sm->ctx->set_ltf_keyseed);
502 	return sm->ctx->set_ltf_keyseed(sm->ctx->ctx, own_addr, peer_addr,
503 					ltf_keyseed_len, ltf_keyseed);
504 }
505 #endif /* CONFIG_PASN */
506 
507 static inline void
wpa_sm_notify_pmksa_cache_entry(struct wpa_sm * sm,struct rsn_pmksa_cache_entry * entry)508 wpa_sm_notify_pmksa_cache_entry(struct wpa_sm *sm,
509 				struct rsn_pmksa_cache_entry *entry)
510 {
511 	if (sm->ctx->notify_pmksa_cache_entry)
512 		sm->ctx->notify_pmksa_cache_entry(sm->ctx->ctx, entry);
513 }
514 
515 int wpa_eapol_key_send(struct wpa_sm *sm, struct wpa_ptk *ptk,
516 		       int ver, const u8 *dest, u16 proto,
517 		       u8 *msg, size_t msg_len, u8 *key_mic);
518 int wpa_supplicant_send_2_of_4(struct wpa_sm *sm, const unsigned char *dst,
519 			       const struct wpa_eapol_key *key,
520 			       int ver, const u8 *nonce,
521 			       const u8 *wpa_ie, size_t wpa_ie_len,
522 			       struct wpa_ptk *ptk);
523 int wpa_supplicant_send_4_of_4(struct wpa_sm *sm, const unsigned char *dst,
524 			       const struct wpa_eapol_key *key,
525 			       u16 ver, u16 key_info,
526 			       struct wpa_ptk *ptk);
527 
528 int wpa_derive_ptk_ft(struct wpa_sm *sm, const unsigned char *src_addr,
529 		      const struct wpa_eapol_key *key, struct wpa_ptk *ptk);
530 
531 void wpa_tdls_assoc(struct wpa_sm *sm);
532 void wpa_tdls_disassoc(struct wpa_sm *sm);
533 
534 #endif /* WPA_I_H */
535