1 /*
2 * wpa_supplicant - WPA definitions
3 * Copyright (c) 2003-2015, 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_H
10 #define WPA_H
11
12 #include "common/defs.h"
13 #include "common/eapol_common.h"
14 #include "common/wpa_common.h"
15 #include "common/ieee802_11_defs.h"
16
17 struct wpa_sm;
18 struct eapol_sm;
19 struct wpa_config_blob;
20 struct hostapd_freq_params;
21 struct wpa_channel_info;
22
23 struct wpa_sm_ctx {
24 void *ctx; /* pointer to arbitrary upper level context */
25 void *msg_ctx; /* upper level context for wpa_msg() calls */
26
27 void (*set_state)(void *ctx, enum wpa_states state);
28 enum wpa_states (*get_state)(void *ctx);
29 void (*deauthenticate)(void * ctx, u16 reason_code);
30 void (*reconnect)(void *ctx);
31 #ifdef CONFIG_MLD_PATCH
32 int (*set_key)(void *ctx, int link_id, enum wpa_alg alg,
33 #else
34 int (*set_key)(void *ctx, enum wpa_alg alg,
35 #endif
36 const u8 *addr, int key_idx, int set_tx,
37 const u8 *seq, size_t seq_len,
38 const u8 *key, size_t key_len, enum key_flag key_flag);
39 void * (*get_network_ctx)(void *ctx);
40 int (*get_bssid)(void *ctx, u8 *bssid);
41 int (*ether_send)(void *ctx, const u8 *dest, u16 proto, const u8 *buf,
42 size_t len);
43 int (*get_beacon_ie)(void *ctx);
44 void (*cancel_auth_timeout)(void *ctx);
45 u8 * (*alloc_eapol)(void *ctx, u8 type, const void *data, u16 data_len,
46 size_t *msg_len, void **data_pos);
47 int (*add_pmkid)(void *ctx, void *network_ctx, const u8 *bssid,
48 const u8 *pmkid, const u8 *fils_cache_id,
49 const u8 *pmk, size_t pmk_len, u32 pmk_lifetime,
50 u8 pmk_reauth_threshold, int akmp);
51 int (*remove_pmkid)(void *ctx, void *network_ctx, const u8 *bssid,
52 const u8 *pmkid, const u8 *fils_cache_id);
53 void (*set_config_blob)(void *ctx, struct wpa_config_blob *blob);
54 const struct wpa_config_blob * (*get_config_blob)(void *ctx,
55 const char *name);
56 int (*mlme_setprotection)(void *ctx, const u8 *addr,
57 int protection_type, int key_type);
58 int (*update_ft_ies)(void *ctx, const u8 *md, const u8 *ies,
59 size_t ies_len);
60 int (*send_ft_action)(void *ctx, u8 action, const u8 *target_ap,
61 const u8 *ies, size_t ies_len);
62 int (*mark_authenticated)(void *ctx, const u8 *target_ap);
63 #ifdef CONFIG_TDLS
64 int (*tdls_get_capa)(void *ctx, int *tdls_supported,
65 int *tdls_ext_setup, int *tdls_chan_switch);
66 int (*send_tdls_mgmt)(void *ctx, const u8 *dst,
67 u8 action_code, u8 dialog_token,
68 u16 status_code, u32 peer_capab,
69 int initiator, const u8 *buf, size_t len);
70 int (*tdls_oper)(void *ctx, int oper, const u8 *peer);
71 int (*tdls_peer_addset)(void *ctx, const u8 *addr, int add, u16 aid,
72 u16 capability, const u8 *supp_rates,
73 size_t supp_rates_len,
74 const struct ieee80211_ht_capabilities *ht_capab,
75 const struct ieee80211_vht_capabilities *vht_capab,
76 const struct ieee80211_he_capabilities *he_capab,
77 size_t he_capab_len,
78 const struct ieee80211_he_6ghz_band_cap *he_6ghz_capab,
79 u8 qosinfo, int wmm, const u8 *ext_capab,
80 size_t ext_capab_len, const u8 *supp_channels,
81 size_t supp_channels_len,
82 const u8 *supp_oper_classes,
83 size_t supp_oper_classes_len);
84 int (*tdls_enable_channel_switch)(
85 void *ctx, const u8 *addr, u8 oper_class,
86 const struct hostapd_freq_params *params);
87 int (*tdls_disable_channel_switch)(void *ctx, const u8 *addr);
88 #endif /* CONFIG_TDLS */
89 void (*set_rekey_offload)(void *ctx, const u8 *kek, size_t kek_len,
90 const u8 *kck, size_t kck_len,
91 const u8 *replay_ctr);
92 int (*key_mgmt_set_pmk)(void *ctx, const u8 *pmk, size_t pmk_len);
93 void (*fils_hlp_rx)(void *ctx, const u8 *dst, const u8 *src,
94 const u8 *pkt, size_t pkt_len);
95 int (*channel_info)(void *ctx, struct wpa_channel_info *ci);
96 void (*transition_disable)(void *ctx, u8 bitmap);
97 void (*store_ptk)(void *ctx, u8 *addr, int cipher,
98 u32 life_time, const struct wpa_ptk *ptk);
99 };
100
101
102 enum wpa_sm_conf_params {
103 RSNA_PMK_LIFETIME /* dot11RSNAConfigPMKLifetime */,
104 RSNA_PMK_REAUTH_THRESHOLD /* dot11RSNAConfigPMKReauthThreshold */,
105 RSNA_SA_TIMEOUT /* dot11RSNAConfigSATimeout */,
106 WPA_PARAM_PROTO,
107 WPA_PARAM_PAIRWISE,
108 WPA_PARAM_GROUP,
109 WPA_PARAM_KEY_MGMT,
110 WPA_PARAM_MGMT_GROUP,
111 WPA_PARAM_RSN_ENABLED,
112 WPA_PARAM_MFP,
113 WPA_PARAM_OCV,
114 WPA_PARAM_SAE_PWE,
115 WPA_PARAM_SAE_PK,
116 WPA_PARAM_DENY_PTK0_REKEY,
117 WPA_PARAM_EXT_KEY_ID,
118 WPA_PARAM_USE_EXT_KEY_ID,
119 WPA_PARAM_FT_RSNXE_USED,
120 WPA_PARAM_DPP_PFS,
121 WPA_PARAM_OCI_FREQ_EAPOL,
122 WPA_PARAM_OCI_FREQ_EAPOL_G2,
123 WPA_PARAM_OCI_FREQ_FT_ASSOC,
124 WPA_PARAM_OCI_FREQ_FILS_ASSOC,
125 };
126
127 struct rsn_supp_config {
128 void *network_ctx;
129 int allowed_pairwise_cipher; /* bitfield of WPA_CIPHER_* */
130 int proactive_key_caching;
131 int eap_workaround;
132 void *eap_conf_ctx;
133 const u8 *ssid;
134 size_t ssid_len;
135 int wpa_ptk_rekey;
136 int wpa_deny_ptk0_rekey;
137 int p2p;
138 int wpa_rsc_relaxation;
139 int owe_ptk_workaround;
140 const u8 *fils_cache_id;
141 int beacon_prot;
142 bool force_kdk_derivation;
143 };
144 #ifdef CONFIG_MLD_PATCH
145 struct wpa_sm_link {
146 u8 addr[ETH_ALEN];
147 u8 bssid[ETH_ALEN];
148 u8 *ap_rsne, *ap_rsnxe;
149 size_t ap_rsne_len, ap_rsnxe_len;
150 struct wpa_gtk gtk;
151 struct wpa_gtk gtk_wnm_sleep;
152 struct wpa_igtk igtk;
153 struct wpa_igtk igtk_wnm_sleep;
154 struct wpa_bigtk bigtk;
155 struct wpa_bigtk bigtk_wnm_sleep;
156 };
157
158 struct wpa_sm_mlo {
159 u8 ap_mld_addr[ETH_ALEN];
160 u8 assoc_link_id;
161 u16 valid_links; /* bitmap of accepted links */
162 u16 req_links; /* bitmap of requested links */
163 struct wpa_sm_link links[MAX_NUM_MLD_LINKS];
164 };
165 #endif
166 #ifndef CONFIG_NO_WPA
167
168 struct wpa_sm * wpa_sm_init(struct wpa_sm_ctx *ctx);
169 void wpa_sm_deinit(struct wpa_sm *sm);
170 void wpa_sm_notify_assoc(struct wpa_sm *sm, const u8 *bssid);
171 void wpa_sm_notify_disassoc(struct wpa_sm *sm);
172 void wpa_sm_set_pmk(struct wpa_sm *sm, const u8 *pmk, size_t pmk_len,
173 const u8 *pmkid, const u8 *bssid);
174 void wpa_sm_set_pmk_from_pmksa(struct wpa_sm *sm);
175 void wpa_sm_set_fast_reauth(struct wpa_sm *sm, int fast_reauth);
176 void wpa_sm_set_scard_ctx(struct wpa_sm *sm, void *scard_ctx);
177 void wpa_sm_set_config(struct wpa_sm *sm, struct rsn_supp_config *config);
178 void wpa_sm_set_own_addr(struct wpa_sm *sm, const u8 *addr);
179 void wpa_sm_set_ifname(struct wpa_sm *sm, const char *ifname,
180 const char *bridge_ifname);
181 void wpa_sm_set_eapol(struct wpa_sm *sm, struct eapol_sm *eapol);
182 int wpa_sm_set_assoc_wpa_ie(struct wpa_sm *sm, const u8 *ie, size_t len);
183 int wpa_sm_set_assoc_wpa_ie_default(struct wpa_sm *sm, u8 *wpa_ie,
184 size_t *wpa_ie_len);
185 int wpa_sm_set_assoc_rsnxe_default(struct wpa_sm *sm, u8 *rsnxe,
186 size_t *rsnxe_len);
187 int wpa_sm_set_assoc_rsnxe(struct wpa_sm *sm, const u8 *ie, size_t len);
188 int wpa_sm_set_ap_wpa_ie(struct wpa_sm *sm, const u8 *ie, size_t len);
189 int wpa_sm_set_ap_rsn_ie(struct wpa_sm *sm, const u8 *ie, size_t len);
190 #ifdef CONFIG_MAGICLINK_PC
191 int wpa_sm_set_p2p_legacyGO_state(struct wpa_sm *sm, int state);
192 #endif
193 int wpa_sm_set_ap_rsnxe(struct wpa_sm *sm, const u8 *ie, size_t len);
194 int wpa_sm_get_mib(struct wpa_sm *sm, char *buf, size_t buflen);
195
196 int wpa_sm_set_param(struct wpa_sm *sm, enum wpa_sm_conf_params param,
197 unsigned int value);
198
199 int wpa_sm_get_status(struct wpa_sm *sm, char *buf, size_t buflen,
200 int verbose);
201 int wpa_sm_pmf_enabled(struct wpa_sm *sm);
202 int wpa_sm_ext_key_id(struct wpa_sm *sm);
203 int wpa_sm_ext_key_id_active(struct wpa_sm *sm);
204 int wpa_sm_ocv_enabled(struct wpa_sm *sm);
205
206 void wpa_sm_key_request(struct wpa_sm *sm, int error, int pairwise);
207
208 int wpa_parse_wpa_ie(const u8 *wpa_ie, size_t wpa_ie_len,
209 struct wpa_ie_data *data);
210
211 void wpa_sm_aborted_cached(struct wpa_sm *sm);
212 void wpa_sm_aborted_external_cached(struct wpa_sm *sm);
213 int wpa_sm_rx_eapol(struct wpa_sm *sm, const u8 *src_addr,
214 const u8 *buf, size_t len);
215 int wpa_sm_parse_own_wpa_ie(struct wpa_sm *sm, struct wpa_ie_data *data);
216 int wpa_sm_pmksa_cache_list(struct wpa_sm *sm, char *buf, size_t len);
217 struct rsn_pmksa_cache_entry * wpa_sm_pmksa_cache_head(struct wpa_sm *sm);
218 struct rsn_pmksa_cache_entry *
219 wpa_sm_pmksa_cache_add_entry(struct wpa_sm *sm,
220 struct rsn_pmksa_cache_entry * entry);
221 void wpa_sm_pmksa_cache_add(struct wpa_sm *sm, const u8 *pmk, size_t pmk_len,
222 const u8 *pmkid, const u8 *bssid,
223 const u8 *fils_cache_id);
224 int wpa_sm_pmksa_exists(struct wpa_sm *sm, const u8 *bssid,
225 const void *network_ctx);
226 void wpa_sm_drop_sa(struct wpa_sm *sm);
227 struct rsn_pmksa_cache_entry * wpa_sm_pmksa_cache_get(struct wpa_sm *sm,
228 const u8 *aa,
229 const u8 *pmkid,
230 const void *network_ctx,
231 int akmp);
232 int wpa_sm_has_ptk(struct wpa_sm *sm);
233 int wpa_sm_has_ptk_installed(struct wpa_sm *sm);
234
235 void wpa_sm_update_replay_ctr(struct wpa_sm *sm, const u8 *replay_ctr);
236
237 void wpa_sm_pmksa_cache_flush(struct wpa_sm *sm, void *network_ctx);
238 void wpa_sm_external_pmksa_cache_flush(struct wpa_sm *sm, void *network_ctx);
239
240 int wpa_sm_get_p2p_ip_addr(struct wpa_sm *sm, u8 *buf);
241
242 void wpa_sm_set_rx_replay_ctr(struct wpa_sm *sm, const u8 *rx_replay_counter);
243 void wpa_sm_set_ptk_kck_kek(struct wpa_sm *sm,
244 const u8 *ptk_kck, size_t ptk_kck_len,
245 const u8 *ptk_kek, size_t ptk_kek_len);
246 int wpa_fils_is_completed(struct wpa_sm *sm);
247 void wpa_sm_pmksa_cache_reconfig(struct wpa_sm *sm);
248 #ifdef CONFIG_MLD_PATCH
249 int wpa_sm_set_mlo_params(struct wpa_sm *sm, const struct wpa_sm_mlo *mlo);
250 #endif
251 #else /* CONFIG_NO_WPA */
252
wpa_sm_init(struct wpa_sm_ctx *ctx)253 static inline struct wpa_sm * wpa_sm_init(struct wpa_sm_ctx *ctx)
254 {
255 return (struct wpa_sm *) 1;
256 }
257
wpa_sm_deinit(struct wpa_sm *sm)258 static inline void wpa_sm_deinit(struct wpa_sm *sm)
259 {
260 }
261
wpa_sm_notify_assoc(struct wpa_sm *sm, const u8 *bssid)262 static inline void wpa_sm_notify_assoc(struct wpa_sm *sm, const u8 *bssid)
263 {
264 }
265
wpa_sm_notify_disassoc(struct wpa_sm *sm)266 static inline void wpa_sm_notify_disassoc(struct wpa_sm *sm)
267 {
268 }
269
wpa_sm_set_pmk(struct wpa_sm *sm, const u8 *pmk, size_t pmk_len, const u8 *pmkid, const u8 *bssid)270 static inline void wpa_sm_set_pmk(struct wpa_sm *sm, const u8 *pmk,
271 size_t pmk_len, const u8 *pmkid,
272 const u8 *bssid)
273 {
274 }
275
wpa_sm_set_pmk_from_pmksa(struct wpa_sm *sm)276 static inline void wpa_sm_set_pmk_from_pmksa(struct wpa_sm *sm)
277 {
278 }
279
wpa_sm_set_fast_reauth(struct wpa_sm *sm, int fast_reauth)280 static inline void wpa_sm_set_fast_reauth(struct wpa_sm *sm, int fast_reauth)
281 {
282 }
283
wpa_sm_set_scard_ctx(struct wpa_sm *sm, void *scard_ctx)284 static inline void wpa_sm_set_scard_ctx(struct wpa_sm *sm, void *scard_ctx)
285 {
286 }
287
wpa_sm_set_config(struct wpa_sm *sm, struct rsn_supp_config *config)288 static inline void wpa_sm_set_config(struct wpa_sm *sm,
289 struct rsn_supp_config *config)
290 {
291 }
292
wpa_sm_set_own_addr(struct wpa_sm *sm, const u8 *addr)293 static inline void wpa_sm_set_own_addr(struct wpa_sm *sm, const u8 *addr)
294 {
295 }
296
wpa_sm_set_ifname(struct wpa_sm *sm, const char *ifname, const char *bridge_ifname)297 static inline void wpa_sm_set_ifname(struct wpa_sm *sm, const char *ifname,
298 const char *bridge_ifname)
299 {
300 }
301
wpa_sm_set_eapol(struct wpa_sm *sm, struct eapol_sm *eapol)302 static inline void wpa_sm_set_eapol(struct wpa_sm *sm, struct eapol_sm *eapol)
303 {
304 }
305
wpa_sm_set_assoc_wpa_ie(struct wpa_sm *sm, const u8 *ie, size_t len)306 static inline int wpa_sm_set_assoc_wpa_ie(struct wpa_sm *sm, const u8 *ie,
307 size_t len)
308 {
309 return -1;
310 }
311
wpa_sm_set_assoc_wpa_ie_default(struct wpa_sm *sm, u8 *wpa_ie, size_t *wpa_ie_len)312 static inline int wpa_sm_set_assoc_wpa_ie_default(struct wpa_sm *sm,
313 u8 *wpa_ie,
314 size_t *wpa_ie_len)
315 {
316 return -1;
317 }
318
wpa_sm_set_ap_wpa_ie(struct wpa_sm *sm, const u8 *ie, size_t len)319 static inline int wpa_sm_set_ap_wpa_ie(struct wpa_sm *sm, const u8 *ie,
320 size_t len)
321 {
322 return -1;
323 }
324
wpa_sm_set_ap_rsn_ie(struct wpa_sm *sm, const u8 *ie, size_t len)325 static inline int wpa_sm_set_ap_rsn_ie(struct wpa_sm *sm, const u8 *ie,
326 size_t len)
327 {
328 return -1;
329 }
330
331 #ifdef CONFIG_MAGICLINK_PC
wpa_sm_set_p2p_legacyGO_state(struct wpa_sm *sm, int state)332 static inline int wpa_sm_set_p2p_legacyGO_state(struct wpa_sm *sm, int state)
333 {
334 return -1;
335 }
336 #endif
337
wpa_sm_set_ap_rsnxe(struct wpa_sm *sm, const u8 *ie, size_t len)338 static inline int wpa_sm_set_ap_rsnxe(struct wpa_sm *sm, const u8 *ie,
339 size_t len)
340 {
341 return -1;
342 }
343
wpa_sm_get_mib(struct wpa_sm *sm, char *buf, size_t buflen)344 static inline int wpa_sm_get_mib(struct wpa_sm *sm, char *buf, size_t buflen)
345 {
346 return 0;
347 }
348
wpa_sm_set_param(struct wpa_sm *sm, enum wpa_sm_conf_params param, unsigned int value)349 static inline int wpa_sm_set_param(struct wpa_sm *sm,
350 enum wpa_sm_conf_params param,
351 unsigned int value)
352 {
353 return -1;
354 }
355
wpa_sm_get_status(struct wpa_sm *sm, char *buf, size_t buflen, int verbose)356 static inline int wpa_sm_get_status(struct wpa_sm *sm, char *buf,
357 size_t buflen, int verbose)
358 {
359 return 0;
360 }
361
wpa_sm_pmf_enabled(struct wpa_sm *sm)362 static inline int wpa_sm_pmf_enabled(struct wpa_sm *sm)
363 {
364 return 0;
365 }
366
wpa_sm_ext_key_id(struct wpa_sm *sm)367 static inline int wpa_sm_ext_key_id(struct wpa_sm *sm)
368 {
369 return 0;
370 }
371
wpa_sm_ext_key_id_active(struct wpa_sm *sm)372 static inline int wpa_sm_ext_key_id_active(struct wpa_sm *sm)
373 {
374 return 0;
375 }
376
wpa_sm_ocv_enabled(struct wpa_sm *sm)377 static inline int wpa_sm_ocv_enabled(struct wpa_sm *sm)
378 {
379 return 0;
380 }
381
wpa_sm_key_request(struct wpa_sm *sm, int error, int pairwise)382 static inline void wpa_sm_key_request(struct wpa_sm *sm, int error,
383 int pairwise)
384 {
385 }
386
wpa_parse_wpa_ie(const u8 *wpa_ie, size_t wpa_ie_len, struct wpa_ie_data *data)387 static inline int wpa_parse_wpa_ie(const u8 *wpa_ie, size_t wpa_ie_len,
388 struct wpa_ie_data *data)
389 {
390 return -1;
391 }
392
wpa_sm_aborted_cached(struct wpa_sm *sm)393 static inline void wpa_sm_aborted_cached(struct wpa_sm *sm)
394 {
395 }
396
wpa_sm_aborted_external_cached(struct wpa_sm *sm)397 static inline void wpa_sm_aborted_external_cached(struct wpa_sm *sm)
398 {
399 }
400
wpa_sm_rx_eapol(struct wpa_sm *sm, const u8 *src_addr, const u8 *buf, size_t len)401 static inline int wpa_sm_rx_eapol(struct wpa_sm *sm, const u8 *src_addr,
402 const u8 *buf, size_t len)
403 {
404 return -1;
405 }
406
wpa_sm_parse_own_wpa_ie(struct wpa_sm *sm, struct wpa_ie_data *data)407 static inline int wpa_sm_parse_own_wpa_ie(struct wpa_sm *sm,
408 struct wpa_ie_data *data)
409 {
410 return -1;
411 }
412
wpa_sm_pmksa_cache_list(struct wpa_sm *sm, char *buf, size_t len)413 static inline int wpa_sm_pmksa_cache_list(struct wpa_sm *sm, char *buf,
414 size_t len)
415 {
416 return -1;
417 }
418
wpa_sm_drop_sa(struct wpa_sm *sm)419 static inline void wpa_sm_drop_sa(struct wpa_sm *sm)
420 {
421 }
422
423 static inline struct rsn_pmksa_cache_entry *
wpa_sm_pmksa_cache_get(struct wpa_sm *sm, const u8 *aa, const u8 *pmkid, const void *network_ctx, int akmp)424 wpa_sm_pmksa_cache_get(struct wpa_sm *sm, const u8 *aa, const u8 *pmkid,
425 const void *network_ctx, int akmp)
426 {
427 return NULL;
428 }
429
wpa_sm_has_ptk(struct wpa_sm *sm)430 static inline int wpa_sm_has_ptk(struct wpa_sm *sm)
431 {
432 return 0;
433 }
434
wpa_sm_update_replay_ctr(struct wpa_sm *sm, const u8 *replay_ctr)435 static inline void wpa_sm_update_replay_ctr(struct wpa_sm *sm,
436 const u8 *replay_ctr)
437 {
438 }
439
wpa_sm_external_pmksa_cache_flush(struct wpa_sm *sm, void *network_ctx)440 static inline void wpa_sm_external_pmksa_cache_flush(struct wpa_sm *sm,
441 void *network_ctx)
442 {
443 }
444
wpa_sm_pmksa_cache_flush(struct wpa_sm *sm, void *network_ctx)445 static inline void wpa_sm_pmksa_cache_flush(struct wpa_sm *sm,
446 void *network_ctx)
447 {
448 }
449
wpa_sm_set_rx_replay_ctr(struct wpa_sm *sm, const u8 *rx_replay_counter)450 static inline void wpa_sm_set_rx_replay_ctr(struct wpa_sm *sm,
451 const u8 *rx_replay_counter)
452 {
453 }
454
wpa_sm_set_ptk_kck_kek(struct wpa_sm *sm, const u8 *ptk_kck, size_t ptk_kck_len, const u8 *ptk_kek, size_t ptk_kek_len)455 static inline void wpa_sm_set_ptk_kck_kek(struct wpa_sm *sm, const u8 *ptk_kck,
456 size_t ptk_kck_len,
457 const u8 *ptk_kek, size_t ptk_kek_len)
458 {
459 }
460
wpa_fils_is_completed(struct wpa_sm *sm)461 static inline int wpa_fils_is_completed(struct wpa_sm *sm)
462 {
463 return 0;
464 }
465
wpa_sm_pmksa_cache_reconfig(struct wpa_sm *sm)466 static inline void wpa_sm_pmksa_cache_reconfig(struct wpa_sm *sm)
467 {
468 }
469 #ifdef CONFIG_MLD_PATCH
wpa_sm_set_mlo_params(struct wpa_sm *sm, const struct wpa_sm_mlo *mlo)470 static inline int wpa_sm_set_mlo_params(struct wpa_sm *sm,
471 const struct wpa_sm_mlo *mlo)
472 {
473 return 0;
474 }
475 #endif
476 #endif /* CONFIG_NO_WPA */
477
478 #ifdef CONFIG_IEEE80211R
479
480 int wpa_sm_set_ft_params(struct wpa_sm *sm, const u8 *ies, size_t ies_len);
481 int wpa_ft_prepare_auth_request(struct wpa_sm *sm, const u8 *mdie);
482 int wpa_ft_add_mdie(struct wpa_sm *sm, u8 *ies, size_t ies_len,
483 const u8 *mdie);
484 const u8 * wpa_sm_get_ft_md(struct wpa_sm *sm);
485 int wpa_ft_process_response(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
486 int ft_action, const u8 *target_ap,
487 const u8 *ric_ies, size_t ric_ies_len);
488 int wpa_ft_is_completed(struct wpa_sm *sm);
489 void wpa_reset_ft_completed(struct wpa_sm *sm);
490 int wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies,
491 size_t ies_len, const u8 *src_addr);
492 int wpa_ft_start_over_ds(struct wpa_sm *sm, const u8 *target_ap,
493 const u8 *mdie);
494
495 #ifdef CONFIG_PASN
496
497 int wpa_pasn_ft_derive_pmk_r1(struct wpa_sm *sm, int akmp, const u8 *r1kh_id,
498 u8 *pmk_r1, size_t *pmk_r1_len, u8 *pmk_r1_name);
499
500 #endif /* CONFIG_PASN */
501
502 #else /* CONFIG_IEEE80211R */
503
504 static inline int
wpa_sm_set_ft_params(struct wpa_sm *sm, const u8 *ies, size_t ies_len)505 wpa_sm_set_ft_params(struct wpa_sm *sm, const u8 *ies, size_t ies_len)
506 {
507 return 0;
508 }
509
wpa_ft_prepare_auth_request(struct wpa_sm *sm, const u8 *mdie)510 static inline int wpa_ft_prepare_auth_request(struct wpa_sm *sm,
511 const u8 *mdie)
512 {
513 return 0;
514 }
515
wpa_ft_add_mdie(struct wpa_sm *sm, u8 *ies, size_t ies_len, const u8 *mdie)516 static inline int wpa_ft_add_mdie(struct wpa_sm *sm, u8 *ies, size_t ies_len,
517 const u8 *mdie)
518 {
519 return 0;
520 }
521
522 static inline int
wpa_ft_process_response(struct wpa_sm *sm, const u8 *ies, size_t ies_len, int ft_action, const u8 *target_ap)523 wpa_ft_process_response(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
524 int ft_action, const u8 *target_ap)
525 {
526 return 0;
527 }
528
wpa_ft_is_completed(struct wpa_sm *sm)529 static inline int wpa_ft_is_completed(struct wpa_sm *sm)
530 {
531 return 0;
532 }
533
wpa_reset_ft_completed(struct wpa_sm *sm)534 static inline void wpa_reset_ft_completed(struct wpa_sm *sm)
535 {
536 }
537
538 static inline int
wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies, size_t ies_len, const u8 *src_addr)539 wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
540 const u8 *src_addr)
541 {
542 return -1;
543 }
544
545 #ifdef CONFIG_PASN
546
wpa_pasn_ft_derive_pmk_r1(struct wpa_sm *sm, int akmp, const u8 *r1kh_id, u8 *pmk_r1, size_t *pmk_r1_len, u8 *pmk_r1_name)547 int wpa_pasn_ft_derive_pmk_r1(struct wpa_sm *sm, int akmp, const u8 *r1kh_id,
548 u8 *pmk_r1, size_t *pmk_r1_len, u8 *pmk_r1_name)
549 {
550 return -1;
551 }
552
553 #endif /* CONFIG_PASN */
554
555 #endif /* CONFIG_IEEE80211R */
556
557
558 /* tdls.c */
559 void wpa_tdls_ap_ies(struct wpa_sm *sm, const u8 *ies, size_t len);
560 void wpa_tdls_assoc_resp_ies(struct wpa_sm *sm, const u8 *ies, size_t len);
561 int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr);
562 void wpa_tdls_remove(struct wpa_sm *sm, const u8 *addr);
563 int wpa_tdls_teardown_link(struct wpa_sm *sm, const u8 *addr, u16 reason_code);
564 int wpa_tdls_send_discovery_request(struct wpa_sm *sm, const u8 *addr);
565 int wpa_tdls_init(struct wpa_sm *sm);
566 void wpa_tdls_teardown_peers(struct wpa_sm *sm);
567 void wpa_tdls_deinit(struct wpa_sm *sm);
568 void wpa_tdls_enable(struct wpa_sm *sm, int enabled);
569 void wpa_tdls_disable_unreachable_link(struct wpa_sm *sm, const u8 *addr);
570 const char * wpa_tdls_get_link_status(struct wpa_sm *sm, const u8 *addr);
571 int wpa_tdls_is_external_setup(struct wpa_sm *sm);
572 int wpa_tdls_enable_chan_switch(struct wpa_sm *sm, const u8 *addr,
573 u8 oper_class,
574 struct hostapd_freq_params *freq_params);
575 int wpa_tdls_disable_chan_switch(struct wpa_sm *sm, const u8 *addr);
576 #ifdef CONFIG_TDLS_TESTING
577 extern unsigned int tdls_testing;
578 #endif /* CONFIG_TDLS_TESTING */
579
580
581 int wpa_wnmsleep_install_key(struct wpa_sm *sm, u8 subelem_id, u8 *buf);
582 void wpa_sm_set_test_assoc_ie(struct wpa_sm *sm, struct wpabuf *buf);
583 const u8 * wpa_sm_get_anonce(struct wpa_sm *sm);
584 unsigned int wpa_sm_get_key_mgmt(struct wpa_sm *sm);
585
586 struct wpabuf * fils_build_auth(struct wpa_sm *sm, int dh_group, const u8 *md);
587 int fils_process_auth(struct wpa_sm *sm, const u8 *bssid, const u8 *data,
588 size_t len);
589 struct wpabuf * fils_build_assoc_req(struct wpa_sm *sm, const u8 **kek,
590 size_t *kek_len, const u8 **snonce,
591 const u8 **anonce,
592 const struct wpabuf **hlp,
593 unsigned int num_hlp);
594 int fils_process_assoc_resp(struct wpa_sm *sm, const u8 *resp, size_t len);
595
596 struct wpabuf * owe_build_assoc_req(struct wpa_sm *sm, u16 group);
597 int owe_process_assoc_resp(struct wpa_sm *sm, const u8 *bssid,
598 const u8 *resp_ies, size_t resp_ies_len);
599
600 void wpa_sm_set_reset_fils_completed(struct wpa_sm *sm, int set);
601 void wpa_sm_set_fils_cache_id(struct wpa_sm *sm, const u8 *fils_cache_id);
602 void wpa_sm_set_dpp_z(struct wpa_sm *sm, const struct wpabuf *z);
603 void wpa_pasn_pmksa_cache_add(struct wpa_sm *sm, const u8 *pmk, size_t pmk_len,
604 const u8 *pmkid, const u8 *bssid, int key_mgmt);
605 #ifdef CONFIG_MLD_PATCH
606 const u8 * wpa_sm_get_auth_addr(struct wpa_sm *sm);
607 #endif
608 #endif /* WPA_H */
609