• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * hostapd - IEEE 802.11i-2004 / WPA Authenticator
3  * Copyright (c) 2004-2017, 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_AUTH_H
10 #define WPA_AUTH_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 vlan_description;
18 
19 #define MAX_OWN_IE_OVERRIDE 256
20 
21 #ifdef _MSC_VER
22 #pragma pack(push, 1)
23 #endif /* _MSC_VER */
24 
25 /* IEEE Std 802.11r-2008, 11A.10.3 - Remote request/response frame definition
26  */
27 struct ft_rrb_frame {
28 	u8 frame_type; /* RSN_REMOTE_FRAME_TYPE_FT_RRB */
29 	u8 packet_type; /* FT_PACKET_REQUEST/FT_PACKET_RESPONSE */
30 	le16 action_length; /* little endian length of action_frame */
31 	u8 ap_address[ETH_ALEN];
32 	/*
33 	 * Followed by action_length bytes of FT Action frame (from Category
34 	 * field to the end of Action Frame body.
35 	 */
36 } STRUCT_PACKED;
37 
38 #define RSN_REMOTE_FRAME_TYPE_FT_RRB 1
39 
40 #define FT_PACKET_REQUEST 0
41 #define FT_PACKET_RESPONSE 1
42 
43 /* Vendor-specific types for R0KH-R1KH protocol; not defined in 802.11r. These
44  * use OUI Extended EtherType as the encapsulating format. */
45 #define FT_PACKET_R0KH_R1KH_PULL 0x01
46 #define FT_PACKET_R0KH_R1KH_RESP 0x02
47 #define FT_PACKET_R0KH_R1KH_PUSH 0x03
48 #define FT_PACKET_R0KH_R1KH_SEQ_REQ 0x04
49 #define FT_PACKET_R0KH_R1KH_SEQ_RESP 0x05
50 
51 /* packet layout
52  *  IEEE 802 extended OUI ethertype frame header
53  *  u16 authlen (little endian)
54  *  multiple of struct ft_rrb_tlv (authenticated only, length = authlen)
55  *  multiple of struct ft_rrb_tlv (AES-SIV encrypted, AES-SIV needs an extra
56  *                                 blocksize length)
57  *
58  * AES-SIV AAD;
59  *  source MAC address (6)
60  *  authenticated-only TLVs (authlen)
61  *  subtype (1; FT_PACKET_*)
62  */
63 
64 #define FT_RRB_NONCE_LEN 16
65 
66 #define FT_RRB_LAST_EMPTY     0 /* placeholder or padding */
67 
68 #define FT_RRB_SEQ            1 /* struct ft_rrb_seq */
69 #define FT_RRB_NONCE          2 /* size FT_RRB_NONCE_LEN */
70 #define FT_RRB_TIMESTAMP      3 /* le32 unix seconds */
71 
72 #define FT_RRB_R0KH_ID        4 /* FT_R0KH_ID_MAX_LEN */
73 #define FT_RRB_R1KH_ID        5 /* FT_R1KH_ID_LEN */
74 #define FT_RRB_S1KH_ID        6 /* ETH_ALEN */
75 
76 #define FT_RRB_PMK_R0_NAME    7 /* WPA_PMK_NAME_LEN */
77 #define FT_RRB_PMK_R0         8 /* PMK_LEN */
78 #define FT_RRB_PMK_R1_NAME    9 /* WPA_PMK_NAME_LEN */
79 #define FT_RRB_PMK_R1        10 /* PMK_LEN */
80 
81 #define FT_RRB_PAIRWISE      11 /* le16 */
82 #define FT_RRB_EXPIRES_IN    12 /* le16 seconds */
83 
84 #define FT_RRB_VLAN_UNTAGGED 13 /* le16 */
85 #define FT_RRB_VLAN_TAGGED   14 /* n times le16 */
86 
87 #define FT_RRB_IDENTITY      15
88 #define FT_RRB_RADIUS_CUI    16
89 #define FT_RRB_SESSION_TIMEOUT  17 /* le32 seconds */
90 
91 struct ft_rrb_tlv {
92 	le16 type;
93 	le16 len;
94 	/* followed by data of length len */
95 } STRUCT_PACKED;
96 
97 struct ft_rrb_seq {
98 	le32 dom;
99 	le32 seq;
100 	le32 ts;
101 } STRUCT_PACKED;
102 
103 /* session TLVs:
104  *   required: PMK_R1, PMK_R1_NAME, PAIRWISE
105  *   optional: VLAN_UNTAGGED, VLAN_TAGGED, EXPIRES_IN, IDENTITY, RADIUS_CUI,
106  *		 SESSION_TIMEOUT
107  *
108  * pull frame TLVs:
109  *   auth:
110  *     required: SEQ, NONCE, R0KH_ID, R1KH_ID
111  *   encrypted:
112  *     required: PMK_R0_NAME, S1KH_ID
113  *
114  * response frame TLVs:
115  *   auth:
116  *     required: SEQ, NONCE, R0KH_ID, R1KH_ID
117  *   encrypted:
118  *     required: S1KH_ID
119  *     optional: session TLVs
120  *
121  * push frame TLVs:
122  *   auth:
123  *     required: SEQ, R0KH_ID, R1KH_ID
124  *   encrypted:
125  *     required: S1KH_ID, PMK_R0_NAME, session TLVs
126  *
127  * sequence number request frame TLVs:
128  *   auth:
129  *     required: R0KH_ID, R1KH_ID, NONCE
130  *
131  * sequence number response frame TLVs:
132  *   auth:
133  *     required: SEQ, NONCE, R0KH_ID, R1KH_ID
134  */
135 
136 #ifdef _MSC_VER
137 #pragma pack(pop)
138 #endif /* _MSC_VER */
139 
140 
141 /* per STA state machine data */
142 
143 struct wpa_authenticator;
144 struct wpa_state_machine;
145 struct rsn_pmksa_cache_entry;
146 struct eapol_state_machine;
147 struct ft_remote_seq;
148 struct wpa_channel_info;
149 
150 
151 struct ft_remote_r0kh {
152 	struct ft_remote_r0kh *next;
153 	u8 addr[ETH_ALEN];
154 	u8 id[FT_R0KH_ID_MAX_LEN];
155 	size_t id_len;
156 	u8 key[32];
157 	struct ft_remote_seq *seq;
158 };
159 
160 
161 struct ft_remote_r1kh {
162 	struct ft_remote_r1kh *next;
163 	u8 addr[ETH_ALEN];
164 	u8 id[FT_R1KH_ID_LEN];
165 	u8 key[32];
166 	struct ft_remote_seq *seq;
167 };
168 
169 
170 struct wpa_auth_config {
171 	void *msg_ctx;
172 	int wpa;
173 	int extended_key_id;
174 	int wpa_key_mgmt;
175 	int wpa_pairwise;
176 	int wpa_group;
177 	int wpa_group_rekey;
178 	int wpa_strict_rekey;
179 	int wpa_gmk_rekey;
180 	int wpa_ptk_rekey;
181 	int wpa_deny_ptk0_rekey;
182 	u32 wpa_group_update_count;
183 	u32 wpa_pairwise_update_count;
184 	int wpa_disable_eapol_key_retries;
185 	int rsn_pairwise;
186 	int rsn_preauth;
187 	int eapol_version;
188 	int wmm_enabled;
189 	int wmm_uapsd;
190 	int disable_pmksa_caching;
191 	int okc;
192 	int tx_status;
193 	enum mfp_options ieee80211w;
194 	int beacon_prot;
195 	int group_mgmt_cipher;
196 	int sae_require_mfp;
197 #ifdef CONFIG_OCV
198 	int ocv; /* Operating Channel Validation */
199 #endif /* CONFIG_OCV */
200 #ifdef CONFIG_IEEE80211R_AP
201 	u8 ssid[SSID_MAX_LEN];
202 	size_t ssid_len;
203 	u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
204 	u8 r0_key_holder[FT_R0KH_ID_MAX_LEN];
205 	size_t r0_key_holder_len;
206 	u8 r1_key_holder[FT_R1KH_ID_LEN];
207 	u32 r0_key_lifetime; /* PMK-R0 lifetime seconds */
208 	int rkh_pos_timeout;
209 	int rkh_neg_timeout;
210 	int rkh_pull_timeout; /* ms */
211 	int rkh_pull_retries;
212 	int r1_max_key_lifetime;
213 	u32 reassociation_deadline;
214 	struct ft_remote_r0kh **r0kh_list;
215 	struct ft_remote_r1kh **r1kh_list;
216 	int pmk_r1_push;
217 	int ft_over_ds;
218 	int ft_psk_generate_local;
219 #endif /* CONFIG_IEEE80211R_AP */
220 	int disable_gtk;
221 	int ap_mlme;
222 #ifdef CONFIG_TESTING_OPTIONS
223 	double corrupt_gtk_rekey_mic_probability;
224 	u8 own_ie_override[MAX_OWN_IE_OVERRIDE];
225 	size_t own_ie_override_len;
226 	u8 rsne_override_eapol[MAX_OWN_IE_OVERRIDE];
227 	size_t rsne_override_eapol_len;
228 	u8 rsnxe_override_eapol[MAX_OWN_IE_OVERRIDE];
229 	size_t rsnxe_override_eapol_len;
230 	u8 rsne_override_ft[MAX_OWN_IE_OVERRIDE];
231 	size_t rsne_override_ft_len;
232 	u8 rsnxe_override_ft[MAX_OWN_IE_OVERRIDE];
233 	size_t rsnxe_override_ft_len;
234 	u8 gtk_rsc_override[WPA_KEY_RSC_LEN];
235 	u8 igtk_rsc_override[WPA_KEY_RSC_LEN];
236 	unsigned int rsne_override_eapol_set:1;
237 	unsigned int rsnxe_override_eapol_set:1;
238 	unsigned int rsne_override_ft_set:1;
239 	unsigned int rsnxe_override_ft_set:1;
240 	unsigned int gtk_rsc_override_set:1;
241 	unsigned int igtk_rsc_override_set:1;
242 	int ft_rsnxe_used;
243 #endif /* CONFIG_TESTING_OPTIONS */
244 	unsigned int oci_freq_override_eapol_m3;
245 	unsigned int oci_freq_override_eapol_g1;
246 	unsigned int oci_freq_override_ft_assoc;
247 	unsigned int oci_freq_override_fils_assoc;
248 #ifdef CONFIG_P2P
249 	u8 ip_addr_go[4];
250 	u8 ip_addr_mask[4];
251 	u8 ip_addr_start[4];
252 	u8 ip_addr_end[4];
253 #endif /* CONFIG_P2P */
254 #ifdef CONFIG_FILS
255 	unsigned int fils_cache_id_set:1;
256 	u8 fils_cache_id[FILS_CACHE_ID_LEN];
257 #endif /* CONFIG_FILS */
258 	int sae_pwe;
259 	bool sae_pk;
260 
261 	unsigned int secure_ltf:1;
262 	unsigned int secure_rtt:1;
263 	unsigned int prot_range_neg:1;
264 
265 	int owe_ptk_workaround;
266 	u8 transition_disable;
267 #ifdef CONFIG_DPP2
268 	int dpp_pfs;
269 #endif /* CONFIG_DPP2 */
270 
271 	/*
272 	 * If set Key Derivation Key should be derived as part of PMK to
273 	 * PTK derivation regardless of advertised capabilities.
274 	 */
275 	bool force_kdk_derivation;
276 };
277 
278 typedef enum {
279 	LOGGER_DEBUG, LOGGER_INFO, LOGGER_WARNING
280 } logger_level;
281 
282 typedef enum {
283 	WPA_EAPOL_portEnabled, WPA_EAPOL_portValid, WPA_EAPOL_authorized,
284 	WPA_EAPOL_portControl_Auto, WPA_EAPOL_keyRun, WPA_EAPOL_keyAvailable,
285 	WPA_EAPOL_keyDone, WPA_EAPOL_inc_EapolFramesTx
286 } wpa_eapol_variable;
287 
288 struct wpa_auth_callbacks {
289 	void (*logger)(void *ctx, const u8 *addr, logger_level level,
290 		       const char *txt);
291 	void (*disconnect)(void *ctx, const u8 *addr, u16 reason);
292 	int (*mic_failure_report)(void *ctx, const u8 *addr);
293 	void (*psk_failure_report)(void *ctx, const u8 *addr);
294 	void (*set_eapol)(void *ctx, const u8 *addr, wpa_eapol_variable var,
295 			  int value);
296 	int (*get_eapol)(void *ctx, const u8 *addr, wpa_eapol_variable var);
297 	const u8 * (*get_psk)(void *ctx, const u8 *addr, const u8 *p2p_dev_addr,
298 #ifndef LOS_CONFIG_NO_VLAN
299 			      const u8 *prev_psk, size_t *psk_len,
300 			      int *vlan_id);
301 #else
302 			      const u8 *prev_psk, size_t *psk_len);
303 #endif /* LOS_CONFIG_NO_VLAN */
304 	int (*get_msk)(void *ctx, const u8 *addr, u8 *msk, size_t *len);
305 #ifndef EXT_CODE_CROP
306 	int (*set_key)(void *ctx, int vlan_id, enum wpa_alg alg,
307 		       const u8 *addr, int idx, u8 *key, size_t key_len,
308 		       enum key_flag key_flag);
309 #else
310 	int (*set_key)(void *ctx, int vlan_id, enum wpa_alg alg,
311 		       const u8 *addr, int idx, u8 *key, size_t key_len);
312 #endif
313 	int (*get_seqnum)(void *ctx, const u8 *addr, int idx, u8 *seq);
314 	int (*send_eapol)(void *ctx, const u8 *addr, const u8 *data,
315 			  size_t data_len, int encrypt);
316 	int (*for_each_sta)(void *ctx, int (*cb)(struct wpa_state_machine *sm,
317 						 void *ctx), void *cb_ctx);
318 	int (*for_each_auth)(void *ctx, int (*cb)(struct wpa_authenticator *a,
319 						  void *ctx), void *cb_ctx);
320 	int (*send_ether)(void *ctx, const u8 *dst, u16 proto, const u8 *data,
321 			  size_t data_len);
322 	int (*send_oui)(void *ctx, const u8 *dst, u8 oui_suffix, const u8 *data,
323 			size_t data_len);
324 	int (*channel_info)(void *ctx, struct wpa_channel_info *ci);
325 #ifndef LOS_CONFIG_NO_VLAN
326 	int (*update_vlan)(void *ctx, const u8 *addr, int vlan_id);
327 #endif /* LOS_CONFIG_NO_VLAN */
328 	int (*get_sta_tx_params)(void *ctx, const u8 *addr,
329 				 int ap_max_chanwidth, int ap_seg1_idx,
330 				 int *bandwidth, int *seg1_idx);
331 	void (*store_ptksa)(void *ctx, const u8 *addr, int cipher,
332 			    u32 life_time, const struct wpa_ptk *ptk);
333 	void (*clear_ptksa)(void *ctx, const u8 *addr, int cipher);
334 #ifdef CONFIG_IEEE80211R_AP
335 	struct wpa_state_machine * (*add_sta)(void *ctx, const u8 *sta_addr);
336 	int (*add_sta_ft)(void *ctx, const u8 *sta_addr);
337 	int (*set_vlan)(void *ctx, const u8 *sta_addr,
338 			struct vlan_description *vlan);
339 	int (*get_vlan)(void *ctx, const u8 *sta_addr,
340 			struct vlan_description *vlan);
341 	int (*set_identity)(void *ctx, const u8 *sta_addr,
342 			    const u8 *identity, size_t identity_len);
343 	size_t (*get_identity)(void *ctx, const u8 *sta_addr, const u8 **buf);
344 	int (*set_radius_cui)(void *ctx, const u8 *sta_addr,
345 			      const u8 *radius_cui, size_t radius_cui_len);
346 	size_t (*get_radius_cui)(void *ctx, const u8 *sta_addr, const u8 **buf);
347 	void (*set_session_timeout)(void *ctx, const u8 *sta_addr,
348 				    int session_timeout);
349 	int (*get_session_timeout)(void *ctx, const u8 *sta_addr);
350 
351 	int (*send_ft_action)(void *ctx, const u8 *dst,
352 			      const u8 *data, size_t data_len);
353 	int (*add_tspec)(void *ctx, const u8 *sta_addr, u8 *tspec_ie,
354 			 size_t tspec_ielen);
355 #endif /* CONFIG_IEEE80211R_AP */
356 #ifdef CONFIG_MESH
357 	int (*start_ampe)(void *ctx, const u8 *sta_addr);
358 #endif /* CONFIG_MESH */
359 };
360 
361 struct wpa_authenticator * wpa_init(const u8 *addr,
362 				    struct wpa_auth_config *conf,
363 				    const struct wpa_auth_callbacks *cb,
364 				    void *cb_ctx);
365 int wpa_init_keys(struct wpa_authenticator *wpa_auth);
366 void wpa_deinit(struct wpa_authenticator *wpa_auth);
367 int wpa_reconfig(struct wpa_authenticator *wpa_auth,
368 		 struct wpa_auth_config *conf);
369 
370 enum wpa_validate_result {
371 	WPA_IE_OK, WPA_INVALID_IE, WPA_INVALID_GROUP, WPA_INVALID_PAIRWISE,
372 	WPA_INVALID_AKMP, WPA_NOT_ENABLED, WPA_ALLOC_FAIL,
373 	WPA_MGMT_FRAME_PROTECTION_VIOLATION, WPA_INVALID_MGMT_GROUP_CIPHER,
374 	WPA_INVALID_MDIE, WPA_INVALID_PROTO, WPA_INVALID_PMKID,
375 	WPA_DENIED_OTHER_REASON
376 };
377 
378 enum wpa_validate_result
379 wpa_validate_wpa_ie(struct wpa_authenticator *wpa_auth,
380 #ifndef EXT_CODE_CROP
381 		    struct wpa_state_machine *sm, int freq,
382 #else
383 			struct wpa_state_machine *sm,
384 #endif /* EXT_CODE_CROP */
385 			const u8 *wpa_ie, size_t wpa_ie_len,
386 			const u8 *rsnxe, size_t rsnxe_len,
387 #ifdef CONFIG_OWE
388 		    const u8 *mdie, size_t mdie_len,
389 		    const u8 *owe_dh, size_t owe_dh_len);
390 #else
391 			const u8 *mdie, size_t mdie_len);
392 #endif /* CONFIG_OWE */
393 #ifndef EXT_CODE_CROP
394 int wpa_validate_osen(struct wpa_authenticator *wpa_auth,
395 		      struct wpa_state_machine *sm,
396 		      const u8 *osen_ie, size_t osen_ie_len);
397 #endif /* EXT_CODE_CROP */
398 int wpa_auth_uses_mfp(struct wpa_state_machine *sm);
399 void wpa_auth_set_ocv(struct wpa_state_machine *sm, int ocv);
400 int wpa_auth_uses_ocv(struct wpa_state_machine *sm);
401 struct wpa_state_machine *
402 wpa_auth_sta_init(struct wpa_authenticator *wpa_auth, const u8 *addr,
403 		  const u8 *p2p_dev_addr);
404 int wpa_auth_sta_associated(struct wpa_authenticator *wpa_auth,
405 			    struct wpa_state_machine *sm);
406 void wpa_auth_sta_no_wpa(struct wpa_state_machine *sm);
407 void wpa_auth_sta_deinit(struct wpa_state_machine *sm);
408 void wpa_receive(struct wpa_authenticator *wpa_auth,
409 		 struct wpa_state_machine *sm,
410 		 u8 *data, size_t data_len);
411 enum wpa_event {
412 	WPA_AUTH, WPA_ASSOC, WPA_DISASSOC, WPA_DEAUTH, WPA_REAUTH,
413 	WPA_REAUTH_EAPOL, WPA_ASSOC_FT, WPA_ASSOC_FILS, WPA_DRV_STA_REMOVED
414 };
415 void wpa_remove_ptk(struct wpa_state_machine *sm);
416 int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event);
417 void wpa_auth_sm_notify(struct wpa_state_machine *sm);
418 void wpa_gtk_rekey(struct wpa_authenticator *wpa_auth);
419 int wpa_get_mib(struct wpa_authenticator *wpa_auth, char *buf, size_t buflen);
420 int wpa_get_mib_sta(struct wpa_state_machine *sm, char *buf, size_t buflen);
421 void wpa_auth_countermeasures_start(struct wpa_authenticator *wpa_auth);
422 int wpa_auth_pairwise_set(struct wpa_state_machine *sm);
423 int wpa_auth_get_pairwise(struct wpa_state_machine *sm);
424 const u8 * wpa_auth_get_pmk(struct wpa_state_machine *sm, int *len);
425 int wpa_auth_sta_key_mgmt(struct wpa_state_machine *sm);
426 int wpa_auth_sta_wpa_version(struct wpa_state_machine *sm);
427 int wpa_auth_sta_ft_tk_already_set(struct wpa_state_machine *sm);
428 int wpa_auth_sta_fils_tk_already_set(struct wpa_state_machine *sm);
429 int wpa_auth_sta_clear_pmksa(struct wpa_state_machine *sm,
430 			     struct rsn_pmksa_cache_entry *entry);
431 struct rsn_pmksa_cache_entry *
432 wpa_auth_sta_get_pmksa(struct wpa_state_machine *sm);
433 void wpa_auth_sta_local_mic_failure_report(struct wpa_state_machine *sm);
434 const u8 * wpa_auth_get_wpa_ie(struct wpa_authenticator *wpa_auth,
435 			       size_t *len);
436 int wpa_auth_pmksa_add(struct wpa_state_machine *sm, const u8 *pmk,
437 		       unsigned int pmk_len,
438 		       int session_timeout, struct eapol_state_machine *eapol);
439 int wpa_auth_pmksa_add_preauth(struct wpa_authenticator *wpa_auth,
440 			       const u8 *pmk, size_t len, const u8 *sta_addr,
441 			       int session_timeout,
442 			       struct eapol_state_machine *eapol);
443 int wpa_auth_pmksa_add_sae(struct wpa_authenticator *wpa_auth, const u8 *addr,
444 			   const u8 *pmk, const u8 *pmkid);
445 void wpa_auth_add_sae_pmkid(struct wpa_state_machine *sm, const u8 *pmkid);
446 int wpa_auth_pmksa_add2(struct wpa_authenticator *wpa_auth, const u8 *addr,
447 			const u8 *pmk, size_t pmk_len, const u8 *pmkid,
448 			int session_timeout, int akmp);
449 void wpa_auth_pmksa_remove(struct wpa_authenticator *wpa_auth,
450 			   const u8 *sta_addr);
451 int wpa_auth_pmksa_list(struct wpa_authenticator *wpa_auth, char *buf,
452 			size_t len);
453 void wpa_auth_pmksa_flush(struct wpa_authenticator *wpa_auth);
454 int wpa_auth_pmksa_list_mesh(struct wpa_authenticator *wpa_auth, const u8 *addr,
455 			     char *buf, size_t len);
456 struct rsn_pmksa_cache_entry *
457 wpa_auth_pmksa_create_entry(const u8 *aa, const u8 *spa, const u8 *pmk,
458 			    const u8 *pmkid, int expiration);
459 int wpa_auth_pmksa_add_entry(struct wpa_authenticator *wpa_auth,
460 			     struct rsn_pmksa_cache_entry *entry);
461 struct rsn_pmksa_cache_entry *
462 wpa_auth_pmksa_get(struct wpa_authenticator *wpa_auth, const u8 *sta_addr,
463 		   const u8 *pmkid);
464 struct rsn_pmksa_cache_entry *
465 wpa_auth_pmksa_get_fils_cache_id(struct wpa_authenticator *wpa_auth,
466 				 const u8 *sta_addr, const u8 *pmkid);
467 void wpa_auth_pmksa_set_to_sm(struct rsn_pmksa_cache_entry *pmksa,
468 			      struct wpa_state_machine *sm,
469 			      struct wpa_authenticator *wpa_auth,
470 			      u8 *pmkid, u8 *pmk);
471 int wpa_auth_sta_set_vlan(struct wpa_state_machine *sm, int vlan_id);
472 void wpa_auth_eapol_key_tx_status(struct wpa_authenticator *wpa_auth,
473 				  struct wpa_state_machine *sm, int ack);
474 
475 #ifdef CONFIG_IEEE80211R_AP
476 u8 * wpa_sm_write_assoc_resp_ies(struct wpa_state_machine *sm, u8 *pos,
477 				 size_t max_len, int auth_alg,
478 				 const u8 *req_ies, size_t req_ies_len,
479 				 int omit_rsnxe);
480 void wpa_ft_process_auth(struct wpa_state_machine *sm, const u8 *bssid,
481 			 u16 auth_transaction, const u8 *ies, size_t ies_len,
482 			 void (*cb)(void *ctx, const u8 *dst, const u8 *bssid,
483 				    u16 auth_transaction, u16 resp,
484 				    const u8 *ies, size_t ies_len),
485 			 void *ctx);
486 int wpa_ft_validate_reassoc(struct wpa_state_machine *sm, const u8 *ies,
487 			    size_t ies_len);
488 int wpa_ft_action_rx(struct wpa_state_machine *sm, const u8 *data, size_t len);
489 int wpa_ft_rrb_rx(struct wpa_authenticator *wpa_auth, const u8 *src_addr,
490 		  const u8 *data, size_t data_len);
491 void wpa_ft_rrb_oui_rx(struct wpa_authenticator *wpa_auth, const u8 *src_addr,
492 		       const u8 *dst_addr, u8 oui_suffix, const u8 *data,
493 		       size_t data_len);
494 void wpa_ft_push_pmk_r1(struct wpa_authenticator *wpa_auth, const u8 *addr);
495 void wpa_ft_deinit(struct wpa_authenticator *wpa_auth);
496 void wpa_ft_sta_deinit(struct wpa_state_machine *sm);
497 int wpa_ft_fetch_pmk_r1(struct wpa_authenticator *wpa_auth,
498 			const u8 *spa, const u8 *pmk_r1_name,
499 			u8 *pmk_r1, size_t *pmk_r1_len, int *pairwise,
500 			struct vlan_description *vlan,
501 			const u8 **identity, size_t *identity_len,
502 			const u8 **radius_cui, size_t *radius_cui_len,
503 			int *session_timeout);
504 
505 #endif /* CONFIG_IEEE80211R_AP */
506 
507 void wpa_wnmsleep_rekey_gtk(struct wpa_state_machine *sm);
508 void wpa_set_wnmsleep(struct wpa_state_machine *sm, int flag);
509 int wpa_wnmsleep_gtk_subelem(struct wpa_state_machine *sm, u8 *pos);
510 int wpa_wnmsleep_igtk_subelem(struct wpa_state_machine *sm, u8 *pos);
511 int wpa_wnmsleep_bigtk_subelem(struct wpa_state_machine *sm, u8 *pos);
512 
513 int wpa_auth_uses_sae(struct wpa_state_machine *sm);
514 int wpa_auth_uses_ft_sae(struct wpa_state_machine *sm);
515 
516 int wpa_auth_get_ip_addr(struct wpa_state_machine *sm, u8 *addr);
517 
518 struct radius_das_attrs;
519 int wpa_auth_radius_das_disconnect_pmksa(struct wpa_authenticator *wpa_auth,
520 					 struct radius_das_attrs *attr);
521 void wpa_auth_reconfig_group_keys(struct wpa_authenticator *wpa_auth);
522 
523 int wpa_auth_ensure_group(struct wpa_authenticator *wpa_auth, int vlan_id);
524 int wpa_auth_release_group(struct wpa_authenticator *wpa_auth, int vlan_id);
525 int fils_auth_pmk_to_ptk(struct wpa_state_machine *sm, const u8 *pmk,
526 			 size_t pmk_len, const u8 *snonce, const u8 *anonce,
527 			 const u8 *dhss, size_t dhss_len,
528 			 struct wpabuf *g_sta, struct wpabuf *g_ap);
529 int fils_decrypt_assoc(struct wpa_state_machine *sm, const u8 *fils_session,
530 		       const struct ieee80211_mgmt *mgmt, size_t frame_len,
531 		       u8 *pos, size_t left);
532 int fils_encrypt_assoc(struct wpa_state_machine *sm, u8 *buf,
533 		       size_t current_len, size_t max_len,
534 		       const struct wpabuf *hlp);
535 int fils_set_tk(struct wpa_state_machine *sm);
536 u8 * hostapd_eid_assoc_fils_session(struct wpa_state_machine *sm, u8 *eid,
537 				    const u8 *fils_session,
538 				    struct wpabuf *fils_hlp_resp);
539 const u8 *  wpa_fils_validate_fils_session(struct wpa_state_machine *sm,
540 					   const u8 *ies, size_t ies_len,
541 					   const u8 *fils_session);
542 int wpa_fils_validate_key_confirm(struct wpa_state_machine *sm, const u8 *ies,
543 				  size_t ies_len);
544 
545 int get_sta_tx_parameters(struct wpa_state_machine *sm, int ap_max_chanwidth,
546 			  int ap_seg1_idx, int *bandwidth, int *seg1_idx);
547 
548 int wpa_auth_write_fte(struct wpa_authenticator *wpa_auth, int use_sha384,
549 		       u8 *buf, size_t len);
550 void wpa_auth_get_fils_aead_params(struct wpa_state_machine *sm,
551 				   u8 *fils_anonce, u8 *fils_snonce,
552 				   u8 *fils_kek, size_t *fils_kek_len);
553 void wpa_auth_add_fils_pmk_pmkid(struct wpa_state_machine *sm, const u8 *pmk,
554 				 size_t pmk_len, const u8 *pmkid);
555 u8 * wpa_auth_write_assoc_resp_owe(struct wpa_state_machine *sm,
556 				   u8 *pos, size_t max_len,
557 				   const u8 *req_ies, size_t req_ies_len);
558 u8 * wpa_auth_write_assoc_resp_fils(struct wpa_state_machine *sm,
559 				    u8 *pos, size_t max_len,
560 				    const u8 *req_ies, size_t req_ies_len);
561 bool wpa_auth_write_fd_rsn_info(struct wpa_authenticator *wpa_auth,
562 				u8 *fd_rsn_info);
563 void wpa_auth_set_auth_alg(struct wpa_state_machine *sm, u16 auth_alg);
564 void wpa_auth_set_dpp_z(struct wpa_state_machine *sm, const struct wpabuf *z);
565 void wpa_auth_set_transition_disable(struct wpa_authenticator *wpa_auth,
566 				     u8 val);
567 
568 int wpa_auth_resend_m1(struct wpa_state_machine *sm, int change_anonce,
569 		       void (*cb)(void *ctx1, void *ctx2),
570 		       void *ctx1, void *ctx2);
571 int wpa_auth_resend_m3(struct wpa_state_machine *sm,
572 		       void (*cb)(void *ctx1, void *ctx2),
573 		       void *ctx1, void *ctx2);
574 int wpa_auth_resend_group_m1(struct wpa_state_machine *sm,
575 			     void (*cb)(void *ctx1, void *ctx2),
576 			     void *ctx1, void *ctx2);
577 int wpa_auth_rekey_ptk(struct wpa_authenticator *wpa_auth,
578 		       struct wpa_state_machine *sm);
579 int wpa_auth_rekey_gtk(struct wpa_authenticator *wpa_auth);
580 int hostapd_wpa_auth_send_eapol(void *ctx, const u8 *addr,
581 				const u8 *data, size_t data_len,
582 				int encrypt);
583 void wpa_auth_set_ptk_rekey_timer(struct wpa_state_machine *sm);
584 void wpa_auth_set_ft_rsnxe_used(struct wpa_authenticator *wpa_auth, int val);
585 
586 enum wpa_auth_ocv_override_frame {
587 	WPA_AUTH_OCV_OVERRIDE_EAPOL_M3,
588 	WPA_AUTH_OCV_OVERRIDE_EAPOL_G1,
589 	WPA_AUTH_OCV_OVERRIDE_FT_ASSOC,
590 	WPA_AUTH_OCV_OVERRIDE_FILS_ASSOC,
591 };
592 void wpa_auth_set_ocv_override_freq(struct wpa_authenticator *wpa_auth,
593 				    enum wpa_auth_ocv_override_frame frame,
594 				    unsigned int freq);
595 
596 #endif /* WPA_AUTH_H */
597