blob: 45c8dd66e619038e3e7fa397012597a641721146 [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * hostapd - IEEE 802.11i-2004 / WPA Authenticator
Sunil Ravia04bd252022-05-02 22:54:18 -07003 * Copyright (c) 2004-2022, Jouni Malinen <j@w1.fi>
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 */
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"
Dmitry Shmidt9d9e6022015-04-23 10:34:55 -070015#include "common/ieee802_11_defs.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070016
Roshan Pius3a1667e2018-07-03 15:17:14 -070017struct vlan_description;
Sunil Ravi2a14cf12023-11-21 00:54:38 +000018struct mld_info;
Roshan Pius3a1667e2018-07-03 15:17:14 -070019
Sunil Ravic0f5d412024-09-11 22:12:49 +000020#define MAX_OWN_IE_OVERRIDE 257
Dmitry Shmidtd80a4012015-11-05 16:35:40 -080021
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070022#ifdef _MSC_VER
23#pragma pack(push, 1)
24#endif /* _MSC_VER */
25
26/* IEEE Std 802.11r-2008, 11A.10.3 - Remote request/response frame definition
27 */
28struct ft_rrb_frame {
29 u8 frame_type; /* RSN_REMOTE_FRAME_TYPE_FT_RRB */
30 u8 packet_type; /* FT_PACKET_REQUEST/FT_PACKET_RESPONSE */
31 le16 action_length; /* little endian length of action_frame */
32 u8 ap_address[ETH_ALEN];
33 /*
34 * Followed by action_length bytes of FT Action frame (from Category
35 * field to the end of Action Frame body.
36 */
37} STRUCT_PACKED;
38
39#define RSN_REMOTE_FRAME_TYPE_FT_RRB 1
40
41#define FT_PACKET_REQUEST 0
42#define FT_PACKET_RESPONSE 1
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070043
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070044/* Vendor-specific types for R0KH-R1KH protocol; not defined in 802.11r. These
45 * use OUI Extended EtherType as the encapsulating format. */
46#define FT_PACKET_R0KH_R1KH_PULL 0x01
47#define FT_PACKET_R0KH_R1KH_RESP 0x02
48#define FT_PACKET_R0KH_R1KH_PUSH 0x03
49#define FT_PACKET_R0KH_R1KH_SEQ_REQ 0x04
50#define FT_PACKET_R0KH_R1KH_SEQ_RESP 0x05
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070051
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070052/* packet layout
53 * IEEE 802 extended OUI ethertype frame header
54 * u16 authlen (little endian)
55 * multiple of struct ft_rrb_tlv (authenticated only, length = authlen)
56 * multiple of struct ft_rrb_tlv (AES-SIV encrypted, AES-SIV needs an extra
57 * blocksize length)
58 *
59 * AES-SIV AAD;
60 * source MAC address (6)
61 * authenticated-only TLVs (authlen)
62 * subtype (1; FT_PACKET_*)
63 */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070064
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070065#define FT_RRB_NONCE_LEN 16
66
67#define FT_RRB_LAST_EMPTY 0 /* placeholder or padding */
68
69#define FT_RRB_SEQ 1 /* struct ft_rrb_seq */
70#define FT_RRB_NONCE 2 /* size FT_RRB_NONCE_LEN */
71#define FT_RRB_TIMESTAMP 3 /* le32 unix seconds */
72
73#define FT_RRB_R0KH_ID 4 /* FT_R0KH_ID_MAX_LEN */
74#define FT_RRB_R1KH_ID 5 /* FT_R1KH_ID_LEN */
75#define FT_RRB_S1KH_ID 6 /* ETH_ALEN */
76
77#define FT_RRB_PMK_R0_NAME 7 /* WPA_PMK_NAME_LEN */
78#define FT_RRB_PMK_R0 8 /* PMK_LEN */
79#define FT_RRB_PMK_R1_NAME 9 /* WPA_PMK_NAME_LEN */
80#define FT_RRB_PMK_R1 10 /* PMK_LEN */
81
82#define FT_RRB_PAIRWISE 11 /* le16 */
Roshan Pius3a1667e2018-07-03 15:17:14 -070083#define FT_RRB_EXPIRES_IN 12 /* le16 seconds */
84
85#define FT_RRB_VLAN_UNTAGGED 13 /* le16 */
86#define FT_RRB_VLAN_TAGGED 14 /* n times le16 */
87
88#define FT_RRB_IDENTITY 15
89#define FT_RRB_RADIUS_CUI 16
90#define FT_RRB_SESSION_TIMEOUT 17 /* le32 seconds */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070091
92struct ft_rrb_tlv {
93 le16 type;
94 le16 len;
95 /* followed by data of length len */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070096} STRUCT_PACKED;
97
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070098struct ft_rrb_seq {
99 le32 dom;
100 le32 seq;
101 le32 ts;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700102} STRUCT_PACKED;
103
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700104/* session TLVs:
105 * required: PMK_R1, PMK_R1_NAME, PAIRWISE
Roshan Pius3a1667e2018-07-03 15:17:14 -0700106 * optional: VLAN_UNTAGGED, VLAN_TAGGED, EXPIRES_IN, IDENTITY, RADIUS_CUI,
107 * SESSION_TIMEOUT
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700108 *
109 * pull frame TLVs:
110 * auth:
111 * required: SEQ, NONCE, R0KH_ID, R1KH_ID
112 * encrypted:
113 * required: PMK_R0_NAME, S1KH_ID
114 *
115 * response frame TLVs:
116 * auth:
117 * required: SEQ, NONCE, R0KH_ID, R1KH_ID
118 * encrypted:
119 * required: S1KH_ID
120 * optional: session TLVs
121 *
122 * push frame TLVs:
123 * auth:
124 * required: SEQ, R0KH_ID, R1KH_ID
125 * encrypted:
126 * required: S1KH_ID, PMK_R0_NAME, session TLVs
127 *
128 * sequence number request frame TLVs:
129 * auth:
130 * required: R0KH_ID, R1KH_ID, NONCE
131 *
132 * sequence number response frame TLVs:
133 * auth:
134 * required: SEQ, NONCE, R0KH_ID, R1KH_ID
135 */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700136
137#ifdef _MSC_VER
138#pragma pack(pop)
139#endif /* _MSC_VER */
140
141
142/* per STA state machine data */
143
144struct wpa_authenticator;
145struct wpa_state_machine;
146struct rsn_pmksa_cache_entry;
147struct eapol_state_machine;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700148struct ft_remote_seq;
Hai Shalom74f70d42019-02-11 14:42:39 -0800149struct wpa_channel_info;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700150
151
152struct ft_remote_r0kh {
153 struct ft_remote_r0kh *next;
154 u8 addr[ETH_ALEN];
155 u8 id[FT_R0KH_ID_MAX_LEN];
156 size_t id_len;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700157 u8 key[32];
158 struct ft_remote_seq *seq;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700159};
160
161
162struct ft_remote_r1kh {
163 struct ft_remote_r1kh *next;
164 u8 addr[ETH_ALEN];
165 u8 id[FT_R1KH_ID_LEN];
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700166 u8 key[32];
167 struct ft_remote_seq *seq;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700168};
169
170
171struct wpa_auth_config {
Hai Shalom899fcc72020-10-19 14:38:18 -0700172 void *msg_ctx;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700173 int wpa;
Hai Shalomfdcde762020-04-02 11:19:20 -0700174 int extended_key_id;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700175 int wpa_key_mgmt;
Sunil Ravi7f769292024-07-23 22:21:32 +0000176 int rsn_override_key_mgmt;
177 int rsn_override_key_mgmt_2;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700178 int wpa_pairwise;
179 int wpa_group;
180 int wpa_group_rekey;
181 int wpa_strict_rekey;
182 int wpa_gmk_rekey;
183 int wpa_ptk_rekey;
Hai Shalomfdcde762020-04-02 11:19:20 -0700184 int wpa_deny_ptk0_rekey;
Dmitry Shmidtebd93af2017-02-21 13:40:44 -0800185 u32 wpa_group_update_count;
186 u32 wpa_pairwise_update_count;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700187 int wpa_disable_eapol_key_retries;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700188 int rsn_pairwise;
Sunil Ravi7f769292024-07-23 22:21:32 +0000189 int rsn_override_pairwise;
190 int rsn_override_pairwise_2;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700191 int rsn_preauth;
192 int eapol_version;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700193 int wmm_enabled;
194 int wmm_uapsd;
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700195 int disable_pmksa_caching;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700196 int okc;
197 int tx_status;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700198 enum mfp_options ieee80211w;
Sunil Ravi7f769292024-07-23 22:21:32 +0000199 enum mfp_options rsn_override_mfp;
200 enum mfp_options rsn_override_mfp_2;
Hai Shalomfdcde762020-04-02 11:19:20 -0700201 int beacon_prot;
Dmitry Shmidtb36ed7c2014-03-17 10:57:26 -0700202 int group_mgmt_cipher;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700203 int sae_require_mfp;
Hai Shalom74f70d42019-02-11 14:42:39 -0800204#ifdef CONFIG_OCV
205 int ocv; /* Operating Channel Validation */
206#endif /* CONFIG_OCV */
Dmitry Shmidt9d9e6022015-04-23 10:34:55 -0700207 u8 ssid[SSID_MAX_LEN];
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700208 size_t ssid_len;
Sunil Ravi7f769292024-07-23 22:21:32 +0000209#ifdef CONFIG_IEEE80211R_AP
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700210 u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
211 u8 r0_key_holder[FT_R0KH_ID_MAX_LEN];
212 size_t r0_key_holder_len;
213 u8 r1_key_holder[FT_R1KH_ID_LEN];
Roshan Pius3a1667e2018-07-03 15:17:14 -0700214 u32 r0_key_lifetime; /* PMK-R0 lifetime seconds */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700215 int rkh_pos_timeout;
216 int rkh_neg_timeout;
217 int rkh_pull_timeout; /* ms */
218 int rkh_pull_retries;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700219 int r1_max_key_lifetime;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700220 u32 reassociation_deadline;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700221 struct ft_remote_r0kh **r0kh_list;
222 struct ft_remote_r1kh **r1kh_list;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700223 int pmk_r1_push;
224 int ft_over_ds;
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800225 int ft_psk_generate_local;
226#endif /* CONFIG_IEEE80211R_AP */
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700227 int disable_gtk;
228 int ap_mlme;
Dmitry Shmidt51b6ea82013-05-08 10:42:09 -0700229#ifdef CONFIG_TESTING_OPTIONS
230 double corrupt_gtk_rekey_mic_probability;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800231 u8 own_ie_override[MAX_OWN_IE_OVERRIDE];
232 size_t own_ie_override_len;
Sunil Ravic0f5d412024-09-11 22:12:49 +0000233 bool rsne_override_set;
234 u8 rsne_override[MAX_OWN_IE_OVERRIDE];
235 size_t rsne_override_len;
236 bool rsnoe_override_set;
237 u8 rsnoe_override[MAX_OWN_IE_OVERRIDE];
238 size_t rsnoe_override_len;
239 bool rsno2e_override_set;
240 u8 rsno2e_override[MAX_OWN_IE_OVERRIDE];
241 size_t rsno2e_override_len;
242 bool rsnxe_override_set;
243 u8 rsnxe_override[MAX_OWN_IE_OVERRIDE];
244 size_t rsnxe_override_len;
245 bool rsnxoe_override_set;
246 u8 rsnxoe_override[MAX_OWN_IE_OVERRIDE];
247 size_t rsnxoe_override_len;
Hai Shalomfdcde762020-04-02 11:19:20 -0700248 u8 rsne_override_eapol[MAX_OWN_IE_OVERRIDE];
249 size_t rsne_override_eapol_len;
Ahmed ElArabawy0ff61c52019-12-26 12:38:39 -0800250 u8 rsnxe_override_eapol[MAX_OWN_IE_OVERRIDE];
251 size_t rsnxe_override_eapol_len;
Hai Shalomfdcde762020-04-02 11:19:20 -0700252 u8 rsne_override_ft[MAX_OWN_IE_OVERRIDE];
253 size_t rsne_override_ft_len;
254 u8 rsnxe_override_ft[MAX_OWN_IE_OVERRIDE];
255 size_t rsnxe_override_ft_len;
256 u8 gtk_rsc_override[WPA_KEY_RSC_LEN];
257 u8 igtk_rsc_override[WPA_KEY_RSC_LEN];
258 unsigned int rsne_override_eapol_set:1;
259 unsigned int rsnxe_override_eapol_set:1;
260 unsigned int rsne_override_ft_set:1;
261 unsigned int rsnxe_override_ft_set:1;
262 unsigned int gtk_rsc_override_set:1;
263 unsigned int igtk_rsc_override_set:1;
Hai Shalomb755a2a2020-04-23 21:49:02 -0700264 int ft_rsnxe_used;
Kai Shie75b0652020-11-24 20:31:29 -0800265 unsigned int skip_send_eapol:1;
266 unsigned int enable_eapol_large_timeout:1;
Sunil Ravi38ad1ed2023-01-17 23:58:31 +0000267 bool delay_eapol_tx;
Sunil Ravib0ac25f2024-07-12 01:42:03 +0000268 struct wpabuf *eapol_m1_elements;
269 struct wpabuf *eapol_m3_elements;
270 bool eapol_m3_no_encrypt;
Sunil Ravic0f5d412024-09-11 22:12:49 +0000271 bool eapol_key_reserved_random;
Dmitry Shmidt51b6ea82013-05-08 10:42:09 -0700272#endif /* CONFIG_TESTING_OPTIONS */
Hai Shalom899fcc72020-10-19 14:38:18 -0700273 unsigned int oci_freq_override_eapol_m3;
274 unsigned int oci_freq_override_eapol_g1;
275 unsigned int oci_freq_override_ft_assoc;
276 unsigned int oci_freq_override_fils_assoc;
Dmitry Shmidtcf32e602014-01-28 10:57:39 -0800277#ifdef CONFIG_P2P
278 u8 ip_addr_go[4];
279 u8 ip_addr_mask[4];
280 u8 ip_addr_start[4];
281 u8 ip_addr_end[4];
282#endif /* CONFIG_P2P */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700283#ifdef CONFIG_FILS
284 unsigned int fils_cache_id_set:1;
285 u8 fils_cache_id[FILS_CACHE_ID_LEN];
286#endif /* CONFIG_FILS */
Sunil Ravi38ad1ed2023-01-17 23:58:31 +0000287 enum sae_pwe sae_pwe;
Hai Shalom899fcc72020-10-19 14:38:18 -0700288 bool sae_pk;
Hai Shalom60840252021-02-19 19:02:11 -0800289
290 unsigned int secure_ltf:1;
291 unsigned int secure_rtt:1;
292 unsigned int prot_range_neg:1;
293
Hai Shalomfdcde762020-04-02 11:19:20 -0700294 int owe_ptk_workaround;
295 u8 transition_disable;
296#ifdef CONFIG_DPP2
297 int dpp_pfs;
298#endif /* CONFIG_DPP2 */
Hai Shalom60840252021-02-19 19:02:11 -0800299
300 /*
301 * If set Key Derivation Key should be derived as part of PMK to
302 * PTK derivation regardless of advertised capabilities.
303 */
304 bool force_kdk_derivation;
Sunil Ravia04bd252022-05-02 22:54:18 -0700305
306 bool radius_psk;
Sunil Ravib0ac25f2024-07-12 01:42:03 +0000307
Sunil Ravi7f769292024-07-23 22:21:32 +0000308 bool no_disconnect_on_group_keyerror;
309
Sunil Ravib0ac25f2024-07-12 01:42:03 +0000310 /* Pointer to Multi-BSSID transmitted BSS authenticator instance.
311 * Set only in nontransmitted BSSs, i.e., is NULL for transmitted BSS
312 * and in BSSs that are not part of a Multi-BSSID set. */
313 struct wpa_authenticator *tx_bss_auth;
Sunil Ravi7f769292024-07-23 22:21:32 +0000314
315#ifdef CONFIG_IEEE80211BE
316 const u8 *mld_addr;
317 int link_id;
318 struct wpa_authenticator *first_link_auth;
319#endif /* CONFIG_IEEE80211BE */
320
321 bool ssid_protection;
Sunil Ravic0f5d412024-09-11 22:12:49 +0000322
323 int rsn_override_omit_rsnxe;
Sunil Ravi876a49b2025-02-03 19:18:32 +0000324
325 bool spp_amsdu;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700326};
327
328typedef enum {
329 LOGGER_DEBUG, LOGGER_INFO, LOGGER_WARNING
330} logger_level;
331
332typedef enum {
333 WPA_EAPOL_portEnabled, WPA_EAPOL_portValid, WPA_EAPOL_authorized,
334 WPA_EAPOL_portControl_Auto, WPA_EAPOL_keyRun, WPA_EAPOL_keyAvailable,
335 WPA_EAPOL_keyDone, WPA_EAPOL_inc_EapolFramesTx
336} wpa_eapol_variable;
337
Sunil Ravi2a14cf12023-11-21 00:54:38 +0000338struct wpa_auth_ml_key_info {
339 unsigned int n_mld_links;
340 bool mgmt_frame_prot;
341 bool beacon_prot;
342
343 struct wpa_auth_ml_link_key_info {
344 u8 link_id;
345
346 u8 gtkidx;
347 u8 gtk_len;
348 u8 pn[6];
349 const u8 *gtk;
350
351 u8 igtkidx;
352 u8 igtk_len;
353 const u8 *igtk;
354 u8 ipn[6];
355
356 u8 bigtkidx;
357 const u8 *bigtk;
358 u8 bipn[6];
359 } links[MAX_NUM_MLD_LINKS];
360};
361
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700362struct wpa_auth_callbacks {
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700363 void (*logger)(void *ctx, const u8 *addr, logger_level level,
364 const char *txt);
365 void (*disconnect)(void *ctx, const u8 *addr, u16 reason);
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800366 int (*mic_failure_report)(void *ctx, const u8 *addr);
Dmitry Shmidtdda10c22015-03-24 16:05:01 -0700367 void (*psk_failure_report)(void *ctx, const u8 *addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700368 void (*set_eapol)(void *ctx, const u8 *addr, wpa_eapol_variable var,
369 int value);
370 int (*get_eapol)(void *ctx, const u8 *addr, wpa_eapol_variable var);
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700371 const u8 * (*get_psk)(void *ctx, const u8 *addr, const u8 *p2p_dev_addr,
Hai Shalom021b0b52019-04-10 11:17:58 -0700372 const u8 *prev_psk, size_t *psk_len,
373 int *vlan_id);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700374 int (*get_msk)(void *ctx, const u8 *addr, u8 *msk, size_t *len);
375 int (*set_key)(void *ctx, int vlan_id, enum wpa_alg alg,
Hai Shalomfdcde762020-04-02 11:19:20 -0700376 const u8 *addr, int idx, u8 *key, size_t key_len,
377 enum key_flag key_flag);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700378 int (*get_seqnum)(void *ctx, const u8 *addr, int idx, u8 *seq);
379 int (*send_eapol)(void *ctx, const u8 *addr, const u8 *data,
380 size_t data_len, int encrypt);
Sunil Ravi2a14cf12023-11-21 00:54:38 +0000381 int (*get_sta_count)(void *ctx);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700382 int (*for_each_sta)(void *ctx, int (*cb)(struct wpa_state_machine *sm,
383 void *ctx), void *cb_ctx);
384 int (*for_each_auth)(void *ctx, int (*cb)(struct wpa_authenticator *a,
385 void *ctx), void *cb_ctx);
386 int (*send_ether)(void *ctx, const u8 *dst, u16 proto, const u8 *data,
387 size_t data_len);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700388 int (*send_oui)(void *ctx, const u8 *dst, u8 oui_suffix, const u8 *data,
389 size_t data_len);
Hai Shalom74f70d42019-02-11 14:42:39 -0800390 int (*channel_info)(void *ctx, struct wpa_channel_info *ci);
Hai Shalom021b0b52019-04-10 11:17:58 -0700391 int (*update_vlan)(void *ctx, const u8 *addr, int vlan_id);
Hai Shalom74f70d42019-02-11 14:42:39 -0800392 int (*get_sta_tx_params)(void *ctx, const u8 *addr,
393 int ap_max_chanwidth, int ap_seg1_idx,
394 int *bandwidth, int *seg1_idx);
Hai Shalom60840252021-02-19 19:02:11 -0800395 void (*store_ptksa)(void *ctx, const u8 *addr, int cipher,
396 u32 life_time, const struct wpa_ptk *ptk);
397 void (*clear_ptksa)(void *ctx, const u8 *addr, int cipher);
Sunil Ravia04bd252022-05-02 22:54:18 -0700398 void (*request_radius_psk)(void *ctx, const u8 *addr, int key_mgmt,
399 const u8 *anonce,
400 const u8 *eapol, size_t eapol_len);
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800401#ifdef CONFIG_IEEE80211R_AP
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700402 struct wpa_state_machine * (*add_sta)(void *ctx, const u8 *sta_addr);
Hai Shalomb755a2a2020-04-23 21:49:02 -0700403 int (*add_sta_ft)(void *ctx, const u8 *sta_addr);
Roshan Pius3a1667e2018-07-03 15:17:14 -0700404 int (*set_vlan)(void *ctx, const u8 *sta_addr,
405 struct vlan_description *vlan);
406 int (*get_vlan)(void *ctx, const u8 *sta_addr,
407 struct vlan_description *vlan);
408 int (*set_identity)(void *ctx, const u8 *sta_addr,
409 const u8 *identity, size_t identity_len);
410 size_t (*get_identity)(void *ctx, const u8 *sta_addr, const u8 **buf);
411 int (*set_radius_cui)(void *ctx, const u8 *sta_addr,
412 const u8 *radius_cui, size_t radius_cui_len);
413 size_t (*get_radius_cui)(void *ctx, const u8 *sta_addr, const u8 **buf);
414 void (*set_session_timeout)(void *ctx, const u8 *sta_addr,
415 int session_timeout);
416 int (*get_session_timeout)(void *ctx, const u8 *sta_addr);
417
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700418 int (*send_ft_action)(void *ctx, const u8 *dst,
419 const u8 *data, size_t data_len);
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700420 int (*add_tspec)(void *ctx, const u8 *sta_addr, u8 *tspec_ie,
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800421 size_t tspec_ielen);
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800422#endif /* CONFIG_IEEE80211R_AP */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800423#ifdef CONFIG_MESH
424 int (*start_ampe)(void *ctx, const u8 *sta_addr);
425#endif /* CONFIG_MESH */
Sunil Ravi89eba102022-09-13 21:04:37 -0700426#ifdef CONFIG_PASN
427 int (*set_ltf_keyseed)(void *ctx, const u8 *addr, const u8 *ltf_keyseed,
428 size_t ltf_keyseed_len);
429#endif /* CONFIG_PASN */
Sunil Ravi2a14cf12023-11-21 00:54:38 +0000430#ifdef CONFIG_IEEE80211BE
Sunil Ravic0f5d412024-09-11 22:12:49 +0000431 int (*get_ml_key_info)(void *ctx, struct wpa_auth_ml_key_info *info,
432 bool rekey);
Sunil Ravi876a49b2025-02-03 19:18:32 +0000433 struct wpa_authenticator * (*next_primary_auth)(void *ctx);
Sunil Ravi2a14cf12023-11-21 00:54:38 +0000434#endif /* CONFIG_IEEE80211BE */
435 int (*get_drv_flags)(void *ctx, u64 *drv_flags, u64 *drv_flags2);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700436};
437
438struct wpa_authenticator * wpa_init(const u8 *addr,
439 struct wpa_auth_config *conf,
Paul Stewart092955c2017-02-06 09:13:09 -0800440 const struct wpa_auth_callbacks *cb,
441 void *cb_ctx);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800442int wpa_init_keys(struct wpa_authenticator *wpa_auth);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700443void wpa_deinit(struct wpa_authenticator *wpa_auth);
444int wpa_reconfig(struct wpa_authenticator *wpa_auth,
445 struct wpa_auth_config *conf);
446
Hai Shalomfdcde762020-04-02 11:19:20 -0700447enum wpa_validate_result {
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700448 WPA_IE_OK, WPA_INVALID_IE, WPA_INVALID_GROUP, WPA_INVALID_PAIRWISE,
449 WPA_INVALID_AKMP, WPA_NOT_ENABLED, WPA_ALLOC_FAIL,
450 WPA_MGMT_FRAME_PROTECTION_VIOLATION, WPA_INVALID_MGMT_GROUP_CIPHER,
Hai Shalomfdcde762020-04-02 11:19:20 -0700451 WPA_INVALID_MDIE, WPA_INVALID_PROTO, WPA_INVALID_PMKID,
452 WPA_DENIED_OTHER_REASON
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700453};
Dmitry Shmidtebd93af2017-02-21 13:40:44 -0800454
Hai Shalomfdcde762020-04-02 11:19:20 -0700455enum wpa_validate_result
456wpa_validate_wpa_ie(struct wpa_authenticator *wpa_auth,
457 struct wpa_state_machine *sm, int freq,
458 const u8 *wpa_ie, size_t wpa_ie_len,
459 const u8 *rsnxe, size_t rsnxe_len,
460 const u8 *mdie, size_t mdie_len,
Sunil Ravi7f769292024-07-23 22:21:32 +0000461 const u8 *owe_dh, size_t owe_dh_len,
Sunil Ravi876a49b2025-02-03 19:18:32 +0000462 struct wpa_state_machine *assoc_sm,
463 bool is_ml);
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800464int wpa_validate_osen(struct wpa_authenticator *wpa_auth,
465 struct wpa_state_machine *sm,
466 const u8 *osen_ie, size_t osen_ie_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700467int wpa_auth_uses_mfp(struct wpa_state_machine *sm);
Sunil Ravi876a49b2025-02-03 19:18:32 +0000468int wpa_auth_uses_spp_amsdu(struct wpa_state_machine *sm);
Hai Shalom74f70d42019-02-11 14:42:39 -0800469void wpa_auth_set_ocv(struct wpa_state_machine *sm, int ocv);
470int wpa_auth_uses_ocv(struct wpa_state_machine *sm);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700471struct wpa_state_machine *
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700472wpa_auth_sta_init(struct wpa_authenticator *wpa_auth, const u8 *addr,
473 const u8 *p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700474int wpa_auth_sta_associated(struct wpa_authenticator *wpa_auth,
475 struct wpa_state_machine *sm);
476void wpa_auth_sta_no_wpa(struct wpa_state_machine *sm);
477void wpa_auth_sta_deinit(struct wpa_state_machine *sm);
478void wpa_receive(struct wpa_authenticator *wpa_auth,
479 struct wpa_state_machine *sm,
480 u8 *data, size_t data_len);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800481enum wpa_event {
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700482 WPA_AUTH, WPA_ASSOC, WPA_DISASSOC, WPA_DEAUTH, WPA_REAUTH,
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700483 WPA_REAUTH_EAPOL, WPA_ASSOC_FT, WPA_ASSOC_FILS, WPA_DRV_STA_REMOVED
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800484};
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700485void wpa_remove_ptk(struct wpa_state_machine *sm);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800486int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700487void wpa_auth_sm_notify(struct wpa_state_machine *sm);
488void wpa_gtk_rekey(struct wpa_authenticator *wpa_auth);
489int wpa_get_mib(struct wpa_authenticator *wpa_auth, char *buf, size_t buflen);
490int wpa_get_mib_sta(struct wpa_state_machine *sm, char *buf, size_t buflen);
491void wpa_auth_countermeasures_start(struct wpa_authenticator *wpa_auth);
492int wpa_auth_pairwise_set(struct wpa_state_machine *sm);
493int wpa_auth_get_pairwise(struct wpa_state_machine *sm);
Hai Shalom74f70d42019-02-11 14:42:39 -0800494const u8 * wpa_auth_get_pmk(struct wpa_state_machine *sm, int *len);
Sunil Ravi38ad1ed2023-01-17 23:58:31 +0000495const u8 * wpa_auth_get_dpp_pkhash(struct wpa_state_machine *sm);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700496int wpa_auth_sta_key_mgmt(struct wpa_state_machine *sm);
497int wpa_auth_sta_wpa_version(struct wpa_state_machine *sm);
Mathy Vanhoeff6e1f662017-07-14 15:15:35 +0200498int wpa_auth_sta_ft_tk_already_set(struct wpa_state_machine *sm);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700499int wpa_auth_sta_fils_tk_already_set(struct wpa_state_machine *sm);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700500int wpa_auth_sta_clear_pmksa(struct wpa_state_machine *sm,
501 struct rsn_pmksa_cache_entry *entry);
502struct rsn_pmksa_cache_entry *
503wpa_auth_sta_get_pmksa(struct wpa_state_machine *sm);
504void wpa_auth_sta_local_mic_failure_report(struct wpa_state_machine *sm);
505const u8 * wpa_auth_get_wpa_ie(struct wpa_authenticator *wpa_auth,
506 size_t *len);
507int wpa_auth_pmksa_add(struct wpa_state_machine *sm, const u8 *pmk,
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800508 unsigned int pmk_len,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700509 int session_timeout, struct eapol_state_machine *eapol);
510int wpa_auth_pmksa_add_preauth(struct wpa_authenticator *wpa_auth,
511 const u8 *pmk, size_t len, const u8 *sta_addr,
512 int session_timeout,
513 struct eapol_state_machine *eapol);
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800514int wpa_auth_pmksa_add_sae(struct wpa_authenticator *wpa_auth, const u8 *addr,
Sunil Ravi89eba102022-09-13 21:04:37 -0700515 const u8 *pmk, size_t pmk_len, const u8 *pmkid,
Sunil Ravi876a49b2025-02-03 19:18:32 +0000516 int akmp, bool is_ml);
Roshan Pius3a1667e2018-07-03 15:17:14 -0700517void wpa_auth_add_sae_pmkid(struct wpa_state_machine *sm, const u8 *pmkid);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700518int wpa_auth_pmksa_add2(struct wpa_authenticator *wpa_auth, const u8 *addr,
519 const u8 *pmk, size_t pmk_len, const u8 *pmkid,
Sunil Ravi876a49b2025-02-03 19:18:32 +0000520 int session_timeout, int akmp, const u8 *dpp_pkhash,
521 bool is_ml);
Dmitry Shmidtf7e0a992013-05-23 11:03:10 -0700522void wpa_auth_pmksa_remove(struct wpa_authenticator *wpa_auth,
523 const u8 *sta_addr);
Dmitry Shmidte4663042016-04-04 10:07:49 -0700524int wpa_auth_pmksa_list(struct wpa_authenticator *wpa_auth, char *buf,
525 size_t len);
526void wpa_auth_pmksa_flush(struct wpa_authenticator *wpa_auth);
Paul Stewart092955c2017-02-06 09:13:09 -0800527int wpa_auth_pmksa_list_mesh(struct wpa_authenticator *wpa_auth, const u8 *addr,
528 char *buf, size_t len);
529struct rsn_pmksa_cache_entry *
530wpa_auth_pmksa_create_entry(const u8 *aa, const u8 *spa, const u8 *pmk,
Sunil Ravi89eba102022-09-13 21:04:37 -0700531 size_t pmk_len, int akmp,
Paul Stewart092955c2017-02-06 09:13:09 -0800532 const u8 *pmkid, int expiration);
533int wpa_auth_pmksa_add_entry(struct wpa_authenticator *wpa_auth,
534 struct rsn_pmksa_cache_entry *entry);
Sunil Ravi38ad1ed2023-01-17 23:58:31 +0000535struct rsn_pmksa_cache *
536wpa_auth_get_pmksa_cache(struct wpa_authenticator *wpa_auth);
Dmitry Shmidte4663042016-04-04 10:07:49 -0700537struct rsn_pmksa_cache_entry *
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800538wpa_auth_pmksa_get(struct wpa_authenticator *wpa_auth, const u8 *sta_addr,
539 const u8 *pmkid);
Sunil Ravi79e6c4f2025-01-04 00:47:06 +0000540int wpa_auth_pmksa_get_pmk(struct wpa_authenticator *wpa_auth,
541 const u8 *sta_addr, const u8 **pmk, size_t *pmk_len,
542 const u8 **pmkid);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700543struct rsn_pmksa_cache_entry *
544wpa_auth_pmksa_get_fils_cache_id(struct wpa_authenticator *wpa_auth,
545 const u8 *sta_addr, const u8 *pmkid);
Dmitry Shmidte4663042016-04-04 10:07:49 -0700546void wpa_auth_pmksa_set_to_sm(struct rsn_pmksa_cache_entry *pmksa,
547 struct wpa_state_machine *sm,
548 struct wpa_authenticator *wpa_auth,
Sunil Ravib0ac25f2024-07-12 01:42:03 +0000549 u8 *pmkid, u8 *pmk, size_t *pmk_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700550int wpa_auth_sta_set_vlan(struct wpa_state_machine *sm, int vlan_id);
551void wpa_auth_eapol_key_tx_status(struct wpa_authenticator *wpa_auth,
552 struct wpa_state_machine *sm, int ack);
553
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800554#ifdef CONFIG_IEEE80211R_AP
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700555u8 * wpa_sm_write_assoc_resp_ies(struct wpa_state_machine *sm, u8 *pos,
556 size_t max_len, int auth_alg,
Hai Shalomfdcde762020-04-02 11:19:20 -0700557 const u8 *req_ies, size_t req_ies_len,
558 int omit_rsnxe);
Sunil Ravi7f769292024-07-23 22:21:32 +0000559void wpa_ft_process_auth(struct wpa_state_machine *sm,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700560 u16 auth_transaction, const u8 *ies, size_t ies_len,
Sunil Ravi7f769292024-07-23 22:21:32 +0000561 void (*cb)(void *ctx, const u8 *dst,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700562 u16 auth_transaction, u16 resp,
563 const u8 *ies, size_t ies_len),
564 void *ctx);
Hai Shalomb755a2a2020-04-23 21:49:02 -0700565int wpa_ft_validate_reassoc(struct wpa_state_machine *sm, const u8 *ies,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700566 size_t ies_len);
567int wpa_ft_action_rx(struct wpa_state_machine *sm, const u8 *data, size_t len);
568int wpa_ft_rrb_rx(struct wpa_authenticator *wpa_auth, const u8 *src_addr,
569 const u8 *data, size_t data_len);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700570void wpa_ft_rrb_oui_rx(struct wpa_authenticator *wpa_auth, const u8 *src_addr,
571 const u8 *dst_addr, u8 oui_suffix, const u8 *data,
572 size_t data_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700573void wpa_ft_push_pmk_r1(struct wpa_authenticator *wpa_auth, const u8 *addr);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700574void wpa_ft_deinit(struct wpa_authenticator *wpa_auth);
575void wpa_ft_sta_deinit(struct wpa_state_machine *sm);
Hai Shalom60840252021-02-19 19:02:11 -0800576int wpa_ft_fetch_pmk_r1(struct wpa_authenticator *wpa_auth,
577 const u8 *spa, const u8 *pmk_r1_name,
578 u8 *pmk_r1, size_t *pmk_r1_len, int *pairwise,
579 struct vlan_description *vlan,
580 const u8 **identity, size_t *identity_len,
581 const u8 **radius_cui, size_t *radius_cui_len,
582 int *session_timeout);
583
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800584#endif /* CONFIG_IEEE80211R_AP */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700585
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700586void wpa_wnmsleep_rekey_gtk(struct wpa_state_machine *sm);
587void wpa_set_wnmsleep(struct wpa_state_machine *sm, int flag);
588int wpa_wnmsleep_gtk_subelem(struct wpa_state_machine *sm, u8 *pos);
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700589int wpa_wnmsleep_igtk_subelem(struct wpa_state_machine *sm, u8 *pos);
Hai Shalomfdcde762020-04-02 11:19:20 -0700590int wpa_wnmsleep_bigtk_subelem(struct wpa_state_machine *sm, u8 *pos);
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700591
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800592int wpa_auth_uses_sae(struct wpa_state_machine *sm);
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800593int wpa_auth_uses_ft_sae(struct wpa_state_machine *sm);
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800594
Dmitry Shmidtcf32e602014-01-28 10:57:39 -0800595int wpa_auth_get_ip_addr(struct wpa_state_machine *sm, u8 *addr);
596
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800597struct radius_das_attrs;
598int wpa_auth_radius_das_disconnect_pmksa(struct wpa_authenticator *wpa_auth,
599 struct radius_das_attrs *attr);
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800600void wpa_auth_reconfig_group_keys(struct wpa_authenticator *wpa_auth);
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800601
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800602int wpa_auth_ensure_group(struct wpa_authenticator *wpa_auth, int vlan_id);
603int wpa_auth_release_group(struct wpa_authenticator *wpa_auth, int vlan_id);
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800604int fils_auth_pmk_to_ptk(struct wpa_state_machine *sm, const u8 *pmk,
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700605 size_t pmk_len, const u8 *snonce, const u8 *anonce,
606 const u8 *dhss, size_t dhss_len,
607 struct wpabuf *g_sta, struct wpabuf *g_ap);
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800608int fils_decrypt_assoc(struct wpa_state_machine *sm, const u8 *fils_session,
609 const struct ieee80211_mgmt *mgmt, size_t frame_len,
610 u8 *pos, size_t left);
611int fils_encrypt_assoc(struct wpa_state_machine *sm, u8 *buf,
Dmitry Shmidtebd93af2017-02-21 13:40:44 -0800612 size_t current_len, size_t max_len,
613 const struct wpabuf *hlp);
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800614int fils_set_tk(struct wpa_state_machine *sm);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700615u8 * hostapd_eid_assoc_fils_session(struct wpa_state_machine *sm, u8 *eid,
616 const u8 *fils_session,
617 struct wpabuf *fils_hlp_resp);
618const u8 * wpa_fils_validate_fils_session(struct wpa_state_machine *sm,
619 const u8 *ies, size_t ies_len,
620 const u8 *fils_session);
621int wpa_fils_validate_key_confirm(struct wpa_state_machine *sm, const u8 *ies,
622 size_t ies_len);
623
Hai Shalom74f70d42019-02-11 14:42:39 -0800624int get_sta_tx_parameters(struct wpa_state_machine *sm, int ap_max_chanwidth,
625 int ap_seg1_idx, int *bandwidth, int *seg1_idx);
626
Sunil Ravi38ad1ed2023-01-17 23:58:31 +0000627int wpa_auth_write_fte(struct wpa_authenticator *wpa_auth,
628 struct wpa_state_machine *sm,
Roshan Pius3a1667e2018-07-03 15:17:14 -0700629 u8 *buf, size_t len);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700630void wpa_auth_get_fils_aead_params(struct wpa_state_machine *sm,
631 u8 *fils_anonce, u8 *fils_snonce,
632 u8 *fils_kek, size_t *fils_kek_len);
Hai Shalom81f62d82019-07-22 12:10:00 -0700633void wpa_auth_add_fils_pmk_pmkid(struct wpa_state_machine *sm, const u8 *pmk,
634 size_t pmk_len, const u8 *pmkid);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700635u8 * wpa_auth_write_assoc_resp_owe(struct wpa_state_machine *sm,
636 u8 *pos, size_t max_len,
637 const u8 *req_ies, size_t req_ies_len);
Hai Shalom81f62d82019-07-22 12:10:00 -0700638u8 * wpa_auth_write_assoc_resp_fils(struct wpa_state_machine *sm,
639 u8 *pos, size_t max_len,
640 const u8 *req_ies, size_t req_ies_len);
Hai Shalom60840252021-02-19 19:02:11 -0800641bool wpa_auth_write_fd_rsn_info(struct wpa_authenticator *wpa_auth,
642 u8 *fd_rsn_info);
Hai Shalom021b0b52019-04-10 11:17:58 -0700643void wpa_auth_set_auth_alg(struct wpa_state_machine *sm, u16 auth_alg);
Sunil Ravic0f5d412024-09-11 22:12:49 +0000644void wpa_auth_set_rsn_selection(struct wpa_state_machine *sm, const u8 *ie,
645 size_t len);
Hai Shalom021b0b52019-04-10 11:17:58 -0700646void wpa_auth_set_dpp_z(struct wpa_state_machine *sm, const struct wpabuf *z);
Sunil Ravi7f769292024-07-23 22:21:32 +0000647void wpa_auth_set_ssid_protection(struct wpa_state_machine *sm, bool val);
Hai Shalom899fcc72020-10-19 14:38:18 -0700648void wpa_auth_set_transition_disable(struct wpa_authenticator *wpa_auth,
649 u8 val);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700650
651int wpa_auth_resend_m1(struct wpa_state_machine *sm, int change_anonce,
652 void (*cb)(void *ctx1, void *ctx2),
653 void *ctx1, void *ctx2);
654int wpa_auth_resend_m3(struct wpa_state_machine *sm,
655 void (*cb)(void *ctx1, void *ctx2),
656 void *ctx1, void *ctx2);
657int wpa_auth_resend_group_m1(struct wpa_state_machine *sm,
658 void (*cb)(void *ctx1, void *ctx2),
659 void *ctx1, void *ctx2);
Hai Shaloma20dcd72022-02-04 13:43:00 -0800660int wpa_auth_rekey_ptk(struct wpa_authenticator *wpa_auth,
661 struct wpa_state_machine *sm);
Roshan Pius3a1667e2018-07-03 15:17:14 -0700662int wpa_auth_rekey_gtk(struct wpa_authenticator *wpa_auth);
Hai Shaloma20dcd72022-02-04 13:43:00 -0800663int hostapd_wpa_auth_send_eapol(void *ctx, const u8 *addr,
664 const u8 *data, size_t data_len,
665 int encrypt);
Hai Shalom81f62d82019-07-22 12:10:00 -0700666void wpa_auth_set_ptk_rekey_timer(struct wpa_state_machine *sm);
Hai Shalomb755a2a2020-04-23 21:49:02 -0700667void wpa_auth_set_ft_rsnxe_used(struct wpa_authenticator *wpa_auth, int val);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800668
Hai Shalom899fcc72020-10-19 14:38:18 -0700669enum wpa_auth_ocv_override_frame {
670 WPA_AUTH_OCV_OVERRIDE_EAPOL_M3,
671 WPA_AUTH_OCV_OVERRIDE_EAPOL_G1,
672 WPA_AUTH_OCV_OVERRIDE_FT_ASSOC,
673 WPA_AUTH_OCV_OVERRIDE_FILS_ASSOC,
674};
675void wpa_auth_set_ocv_override_freq(struct wpa_authenticator *wpa_auth,
676 enum wpa_auth_ocv_override_frame frame,
677 unsigned int freq);
Kai Shie75b0652020-11-24 20:31:29 -0800678void wpa_auth_set_skip_send_eapol(struct wpa_authenticator *wpa_auth,
679 u8 val);
680void wpa_auth_set_enable_eapol_large_timeout(struct wpa_authenticator *wpa_auth,
681 u8 val);
Hai Shalom899fcc72020-10-19 14:38:18 -0700682
Sunil Ravia04bd252022-05-02 22:54:18 -0700683void wpa_auth_sta_radius_psk_resp(struct wpa_state_machine *sm, bool success);
684
Sunil Ravi7f769292024-07-23 22:21:32 +0000685void wpa_auth_set_ml_info(struct wpa_state_machine *sm,
Sunil Ravi2a14cf12023-11-21 00:54:38 +0000686 u8 mld_assoc_link_id, struct mld_info *info);
Sunil Ravi2a14cf12023-11-21 00:54:38 +0000687void wpa_auth_ml_get_key_info(struct wpa_authenticator *a,
688 struct wpa_auth_ml_link_key_info *info,
Sunil Ravic0f5d412024-09-11 22:12:49 +0000689 bool mgmt_frame_prot, bool beacon_prot,
690 bool rekey);
Sunil Ravi2a14cf12023-11-21 00:54:38 +0000691
Sunil Ravi7f769292024-07-23 22:21:32 +0000692void wpa_release_link_auth_ref(struct wpa_state_machine *sm,
693 int release_link_id);
694
695#define for_each_sm_auth(sm, link_id) \
696 for (link_id = 0; link_id < MAX_NUM_MLD_LINKS; link_id++) \
697 if (sm->mld_links[link_id].valid && \
698 sm->mld_links[link_id].wpa_auth && \
699 sm->wpa_auth != sm->mld_links[link_id].wpa_auth)
700
Sunil Ravi876a49b2025-02-03 19:18:32 +0000701static inline bool wpa_auth_pmf_enabled(struct wpa_auth_config *conf)
702{
703 return conf->ieee80211w != NO_MGMT_FRAME_PROTECTION ||
704 conf->rsn_override_mfp != NO_MGMT_FRAME_PROTECTION ||
705 conf->rsn_override_mfp_2 != NO_MGMT_FRAME_PROTECTION;
706}
707
708bool wpa_auth_sm_known_sta_identification(struct wpa_state_machine *sm,
709 const u8 *timestamp,
710 const u8 *mic, size_t mic_len);
711
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700712#endif /* WPA_AUTH_H */