12 #include "utils/list.h" 25 int ptk_set, tptk_set;
26 unsigned int msg_3_of_4_ok:1;
27 unsigned int tk_to_set:1;
28 u8 snonce[WPA_NONCE_LEN];
29 u8 anonce[WPA_NONCE_LEN];
31 u8 rx_replay_counter[WPA_REPLAY_COUNTER_LEN];
32 int rx_replay_counter_set;
33 u8 request_counter[WPA_REPLAY_COUNTER_LEN];
39 struct dl_list pmksa_candidates;
44 u8 preauth_bssid[ETH_ALEN];
56 int allowed_pairwise_cipher;
57 int proactive_key_caching;
64 int wpa_rsc_relaxation;
66 u8 own_addr[ETH_ALEN];
68 const char *bridge_ifname;
71 unsigned int dot11RSNAConfigPMKLifetime;
72 unsigned int dot11RSNAConfigPMKReauthThreshold;
73 unsigned int dot11RSNAConfigSATimeout;
75 unsigned int dot11RSNA4WayHandshakeFailures;
79 unsigned int pairwise_cipher;
80 unsigned int group_cipher;
81 unsigned int key_mgmt;
82 unsigned int mgmt_group_cipher;
88 size_t assoc_wpa_ie_len;
89 u8 *ap_wpa_ie, *ap_rsn_ie;
90 size_t ap_wpa_ie_len, ap_rsn_ie_len;
98 int tdls_chan_switch_prohibited;
108 int tdls_external_setup;
111 int tdls_chan_switch;
114 #ifdef CONFIG_IEEE80211R 118 u8 pmk_r0_name[WPA_PMK_NAME_LEN];
120 u8 pmk_r1_name[WPA_PMK_NAME_LEN];
121 u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
122 u8 r0kh_id[FT_R0KH_ID_MAX_LEN];
124 u8 r1kh_id[FT_R1KH_ID_LEN];
126 int over_the_ds_in_progress;
127 u8 target_ap[ETH_ALEN];
128 int set_ptk_after_assoc;
131 size_t assoc_resp_ies_len;
135 u8 p2p_ip_addr[3 * 4];
138 #ifdef CONFIG_TESTING_OPTIONS 139 struct wpabuf *test_assoc_ie;
143 u8 fils_nonce[FILS_NONCE_LEN];
144 u8 fils_session[FILS_SESSION_LEN];
145 u8 fils_anonce[FILS_NONCE_LEN];
146 u8 fils_key_auth_ap[FILS_MAX_KEY_AUTH_LEN];
147 u8 fils_key_auth_sta[FILS_MAX_KEY_AUTH_LEN];
148 size_t fils_key_auth_len;
149 unsigned int fils_completed:1;
154 static inline void wpa_sm_set_state(
struct wpa_sm *sm,
enum wpa_states state)
156 WPA_ASSERT(sm->ctx->set_state);
157 sm->ctx->set_state(sm->ctx->ctx, state);
160 static inline enum wpa_states wpa_sm_get_state(
struct wpa_sm *sm)
162 WPA_ASSERT(sm->ctx->get_state);
163 return sm->ctx->get_state(sm->ctx->ctx);
166 static inline void wpa_sm_deauthenticate(
struct wpa_sm *sm,
int reason_code)
168 WPA_ASSERT(sm->ctx->deauthenticate);
169 sm->ctx->deauthenticate(sm->ctx->ctx, reason_code);
172 static inline int wpa_sm_set_key(
struct wpa_sm *sm,
enum wpa_alg alg,
173 const u8 *addr,
int key_idx,
int set_tx,
174 const u8 *seq,
size_t seq_len,
175 const u8 *key,
size_t key_len)
177 WPA_ASSERT(sm->ctx->set_key);
178 return sm->ctx->set_key(sm->ctx->ctx, alg, addr, key_idx, set_tx,
179 seq, seq_len, key, key_len);
182 static inline void * wpa_sm_get_network_ctx(
struct wpa_sm *sm)
184 WPA_ASSERT(sm->ctx->get_network_ctx);
185 return sm->ctx->get_network_ctx(sm->ctx->ctx);
188 static inline int wpa_sm_get_bssid(
struct wpa_sm *sm, u8 *bssid)
190 WPA_ASSERT(sm->ctx->get_bssid);
191 return sm->ctx->get_bssid(sm->ctx->ctx, bssid);
194 static inline int wpa_sm_ether_send(
struct wpa_sm *sm,
const u8 *dest,
195 u16 proto,
const u8 *buf,
size_t len)
197 WPA_ASSERT(sm->ctx->ether_send);
198 return sm->ctx->ether_send(sm->ctx->ctx, dest, proto, buf, len);
201 static inline int wpa_sm_get_beacon_ie(
struct wpa_sm *sm)
203 WPA_ASSERT(sm->ctx->get_beacon_ie);
204 return sm->ctx->get_beacon_ie(sm->ctx->ctx);
207 static inline void wpa_sm_cancel_auth_timeout(
struct wpa_sm *sm)
209 WPA_ASSERT(sm->ctx->cancel_auth_timeout);
210 sm->ctx->cancel_auth_timeout(sm->ctx->ctx);
213 static inline u8 * wpa_sm_alloc_eapol(
struct wpa_sm *sm, u8 type,
214 const void *data, u16 data_len,
215 size_t *msg_len,
void **data_pos)
217 WPA_ASSERT(sm->ctx->alloc_eapol);
218 return sm->ctx->alloc_eapol(sm->ctx->ctx, type, data, data_len,
222 static inline int wpa_sm_add_pmkid(
struct wpa_sm *sm,
void *network_ctx,
223 const u8 *bssid,
const u8 *pmkid)
225 WPA_ASSERT(sm->ctx->add_pmkid);
226 return sm->ctx->add_pmkid(sm->ctx->ctx, network_ctx, bssid, pmkid);
229 static inline int wpa_sm_remove_pmkid(
struct wpa_sm *sm,
void *network_ctx,
230 const u8 *bssid,
const u8 *pmkid)
232 WPA_ASSERT(sm->ctx->remove_pmkid);
233 return sm->ctx->remove_pmkid(sm->ctx->ctx, network_ctx, bssid, pmkid);
236 static inline int wpa_sm_mlme_setprotection(
struct wpa_sm *sm,
const u8 *addr,
237 int protect_type,
int key_type)
239 WPA_ASSERT(sm->ctx->mlme_setprotection);
240 return sm->ctx->mlme_setprotection(sm->ctx->ctx, addr, protect_type,
244 static inline int wpa_sm_update_ft_ies(
struct wpa_sm *sm,
const u8 *md,
245 const u8 *ies,
size_t ies_len)
247 if (sm->ctx->update_ft_ies)
248 return sm->ctx->update_ft_ies(sm->ctx->ctx, md, ies, ies_len);
252 static inline int wpa_sm_send_ft_action(
struct wpa_sm *sm, u8 action,
254 const u8 *ies,
size_t ies_len)
256 if (sm->ctx->send_ft_action)
257 return sm->ctx->send_ft_action(sm->ctx->ctx, action, target_ap,
262 static inline int wpa_sm_mark_authenticated(
struct wpa_sm *sm,
265 if (sm->ctx->mark_authenticated)
266 return sm->ctx->mark_authenticated(sm->ctx->ctx, target_ap);
270 static inline void wpa_sm_set_rekey_offload(
struct wpa_sm *sm)
272 if (!sm->ctx->set_rekey_offload)
274 sm->ctx->set_rekey_offload(sm->ctx->ctx, sm->ptk.kek, sm->ptk.kek_len,
275 sm->ptk.kck, sm->ptk.kck_len,
276 sm->rx_replay_counter);
280 static inline int wpa_sm_tdls_get_capa(
struct wpa_sm *sm,
283 int *tdls_chan_switch)
285 if (sm->ctx->tdls_get_capa)
286 return sm->ctx->tdls_get_capa(sm->ctx->ctx, tdls_supported,
287 tdls_ext_setup, tdls_chan_switch);
291 static inline int wpa_sm_send_tdls_mgmt(
struct wpa_sm *sm,
const u8 *dst,
292 u8 action_code, u8 dialog_token,
293 u16 status_code, u32 peer_capab,
294 int initiator,
const u8 *buf,
297 if (sm->ctx->send_tdls_mgmt)
298 return sm->ctx->send_tdls_mgmt(sm->ctx->ctx, dst, action_code,
299 dialog_token, status_code,
300 peer_capab, initiator, buf,
305 static inline int wpa_sm_tdls_oper(
struct wpa_sm *sm,
int oper,
308 if (sm->ctx->tdls_oper)
309 return sm->ctx->tdls_oper(sm->ctx->ctx, oper, peer);
314 wpa_sm_tdls_peer_addset(
struct wpa_sm *sm,
const u8 *addr,
int add,
315 u16 aid, u16 capability,
const u8 *supp_rates,
316 size_t supp_rates_len,
319 u8 qosinfo,
int wmm,
const u8 *ext_capab,
320 size_t ext_capab_len,
const u8 *supp_channels,
321 size_t supp_channels_len,
const u8 *supp_oper_classes,
322 size_t supp_oper_classes_len)
324 if (sm->ctx->tdls_peer_addset)
325 return sm->ctx->tdls_peer_addset(sm->ctx->ctx, addr, add,
326 aid, capability, supp_rates,
327 supp_rates_len, ht_capab,
328 vht_capab, qosinfo, wmm,
329 ext_capab, ext_capab_len,
333 supp_oper_classes_len);
338 wpa_sm_tdls_enable_channel_switch(
struct wpa_sm *sm,
const u8 *addr,
342 if (sm->ctx->tdls_enable_channel_switch)
343 return sm->ctx->tdls_enable_channel_switch(sm->ctx->ctx, addr,
350 wpa_sm_tdls_disable_channel_switch(
struct wpa_sm *sm,
const u8 *addr)
352 if (sm->ctx->tdls_disable_channel_switch)
353 return sm->ctx->tdls_disable_channel_switch(sm->ctx->ctx, addr);
358 static inline int wpa_sm_key_mgmt_set_pmk(
struct wpa_sm *sm,
359 const u8 *pmk,
size_t pmk_len)
361 if (!sm->ctx->key_mgmt_set_pmk)
363 return sm->ctx->key_mgmt_set_pmk(sm->ctx->ctx, pmk, pmk_len);
366 int wpa_eapol_key_send(
struct wpa_sm *sm,
struct wpa_ptk *ptk,
367 int ver,
const u8 *dest, u16 proto,
368 u8 *msg,
size_t msg_len, u8 *key_mic);
369 int wpa_supplicant_send_2_of_4(
struct wpa_sm *sm,
const unsigned char *dst,
371 int ver,
const u8 *nonce,
372 const u8 *wpa_ie,
size_t wpa_ie_len,
374 int wpa_supplicant_send_4_of_4(
struct wpa_sm *sm,
const unsigned char *dst,
376 u16 ver, u16 key_info,
379 int wpa_derive_ptk_ft(
struct wpa_sm *sm,
const unsigned char *src_addr,
382 void wpa_tdls_assoc(
struct wpa_sm *sm);
383 void wpa_tdls_disassoc(
struct wpa_sm *sm);
Definition: ieee802_11_defs.h:944
Definition: pmksa_cache_auth.c:24
Definition: ieee802_11_defs.h:978
Definition: l2_packet_freebsd.c:36
Definition: wpa_common.h:176
struct wpa_ptk - WPA Pairwise Transient Key IEEE Std 802.11i-2004 - 8.5.1.2 Pairwise key hierarchy ...
Definition: wpa_common.h:201
struct dl_list - Doubly-linked list
Definition: list.h:15
struct rsn_pmksa_cache_entry - PMKSA cache entry
Definition: pmksa_cache_auth.h:17
struct eapol_sm - Internal data for EAPOL state machines
Definition: eapol_supp_sm.c:31
struct hostapd_freq_params - Channel parameters
Definition: driver.h:565
struct wpa_sm - Internal WPA state machine data
Definition: wpa_i.h:21