xref: /freebsd/contrib/wpa/src/common/defs.h (revision 71e72c9e91c4b8007a4292e09669e8b549c29e97)
1 /*
2  * WPA Supplicant - Common definitions
3  * Copyright (c) 2004-2018, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #ifndef DEFS_H
10 #define DEFS_H
11 
12 #define WPA_CIPHER_NONE BIT(0)
13 #define WPA_CIPHER_WEP40 BIT(1)
14 #define WPA_CIPHER_WEP104 BIT(2)
15 #define WPA_CIPHER_TKIP BIT(3)
16 #define WPA_CIPHER_CCMP BIT(4)
17 #define WPA_CIPHER_AES_128_CMAC BIT(5)
18 #define WPA_CIPHER_GCMP BIT(6)
19 #define WPA_CIPHER_SMS4 BIT(7)
20 #define WPA_CIPHER_GCMP_256 BIT(8)
21 #define WPA_CIPHER_CCMP_256 BIT(9)
22 #define WPA_CIPHER_BIP_GMAC_128 BIT(11)
23 #define WPA_CIPHER_BIP_GMAC_256 BIT(12)
24 #define WPA_CIPHER_BIP_CMAC_256 BIT(13)
25 #define WPA_CIPHER_GTK_NOT_USED BIT(14)
26 
27 #define WPA_KEY_MGMT_IEEE8021X BIT(0)
28 #define WPA_KEY_MGMT_PSK BIT(1)
29 #define WPA_KEY_MGMT_NONE BIT(2)
30 #define WPA_KEY_MGMT_IEEE8021X_NO_WPA BIT(3)
31 #define WPA_KEY_MGMT_WPA_NONE BIT(4)
32 #define WPA_KEY_MGMT_FT_IEEE8021X BIT(5)
33 #define WPA_KEY_MGMT_FT_PSK BIT(6)
34 #define WPA_KEY_MGMT_IEEE8021X_SHA256 BIT(7)
35 #define WPA_KEY_MGMT_PSK_SHA256 BIT(8)
36 #define WPA_KEY_MGMT_WPS BIT(9)
37 #define WPA_KEY_MGMT_SAE BIT(10)
38 #define WPA_KEY_MGMT_FT_SAE BIT(11)
39 #define WPA_KEY_MGMT_WAPI_PSK BIT(12)
40 #define WPA_KEY_MGMT_WAPI_CERT BIT(13)
41 #define WPA_KEY_MGMT_CCKM BIT(14)
42 #define WPA_KEY_MGMT_IEEE8021X_SUITE_B BIT(16)
43 #define WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 BIT(17)
44 #define WPA_KEY_MGMT_FILS_SHA256 BIT(18)
45 #define WPA_KEY_MGMT_FILS_SHA384 BIT(19)
46 #define WPA_KEY_MGMT_FT_FILS_SHA256 BIT(20)
47 #define WPA_KEY_MGMT_FT_FILS_SHA384 BIT(21)
48 #define WPA_KEY_MGMT_OWE BIT(22)
49 #define WPA_KEY_MGMT_DPP BIT(23)
50 #define WPA_KEY_MGMT_FT_IEEE8021X_SHA384 BIT(24)
51 #define WPA_KEY_MGMT_PASN BIT(25)
52 #define WPA_KEY_MGMT_SAE_EXT_KEY BIT(26)
53 #define WPA_KEY_MGMT_FT_SAE_EXT_KEY BIT(27)
54 #define WPA_KEY_MGMT_IEEE8021X_SHA384 BIT(28)
55 #define WPA_KEY_MGMT_EPPKE BIT(29)
56 
57 
58 #define WPA_KEY_MGMT_FT (WPA_KEY_MGMT_FT_PSK | \
59 			 WPA_KEY_MGMT_FT_IEEE8021X | \
60 			 WPA_KEY_MGMT_FT_IEEE8021X_SHA384 | \
61 			 WPA_KEY_MGMT_FT_SAE | \
62 			 WPA_KEY_MGMT_FT_SAE_EXT_KEY | \
63 			 WPA_KEY_MGMT_FT_FILS_SHA256 | \
64 			 WPA_KEY_MGMT_FT_FILS_SHA384)
65 
wpa_key_mgmt_wpa_ieee8021x(int akm)66 static inline int wpa_key_mgmt_wpa_ieee8021x(int akm)
67 {
68 	return !!(akm & (WPA_KEY_MGMT_IEEE8021X |
69 			 WPA_KEY_MGMT_FT_IEEE8021X |
70 			 WPA_KEY_MGMT_FT_IEEE8021X_SHA384 |
71 			 WPA_KEY_MGMT_CCKM |
72 			 WPA_KEY_MGMT_IEEE8021X_SHA256 |
73 			 WPA_KEY_MGMT_IEEE8021X_SUITE_B |
74 			 WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 |
75 			 WPA_KEY_MGMT_FILS_SHA256 |
76 			 WPA_KEY_MGMT_FILS_SHA384 |
77 			 WPA_KEY_MGMT_FT_FILS_SHA256 |
78 			 WPA_KEY_MGMT_FT_FILS_SHA384 |
79 			 WPA_KEY_MGMT_IEEE8021X_SHA384));
80 }
81 
wpa_key_mgmt_wpa_psk_no_sae(int akm)82 static inline int wpa_key_mgmt_wpa_psk_no_sae(int akm)
83 {
84 	return !!(akm & (WPA_KEY_MGMT_PSK |
85 			 WPA_KEY_MGMT_FT_PSK |
86 			 WPA_KEY_MGMT_PSK_SHA256));
87 }
88 
wpa_key_mgmt_wpa_psk(int akm)89 static inline int wpa_key_mgmt_wpa_psk(int akm)
90 {
91 	return !!(akm & (WPA_KEY_MGMT_PSK |
92 			 WPA_KEY_MGMT_FT_PSK |
93 			 WPA_KEY_MGMT_PSK_SHA256 |
94 			 WPA_KEY_MGMT_SAE |
95 			 WPA_KEY_MGMT_SAE_EXT_KEY |
96 			 WPA_KEY_MGMT_FT_SAE |
97 			 WPA_KEY_MGMT_FT_SAE_EXT_KEY));
98 }
99 
wpa_key_mgmt_ft(int akm)100 static inline int wpa_key_mgmt_ft(int akm)
101 {
102 	return !!(akm & WPA_KEY_MGMT_FT);
103 }
104 
wpa_key_mgmt_only_ft(int akm)105 static inline int wpa_key_mgmt_only_ft(int akm)
106 {
107 	int ft = wpa_key_mgmt_ft(akm);
108 	akm &= ~WPA_KEY_MGMT_FT;
109 	return ft && !akm;
110 }
111 
wpa_key_mgmt_ft_psk(int akm)112 static inline int wpa_key_mgmt_ft_psk(int akm)
113 {
114 	return !!(akm & WPA_KEY_MGMT_FT_PSK);
115 }
116 
wpa_key_mgmt_sae(int akm)117 static inline int wpa_key_mgmt_sae(int akm)
118 {
119 	return !!(akm & (WPA_KEY_MGMT_SAE |
120 			 WPA_KEY_MGMT_SAE_EXT_KEY |
121 			 WPA_KEY_MGMT_FT_SAE |
122 			 WPA_KEY_MGMT_FT_SAE_EXT_KEY));
123 }
124 
wpa_key_mgmt_sae_ext_key(int akm)125 static inline int wpa_key_mgmt_sae_ext_key(int akm)
126 {
127 	return !!(akm & (WPA_KEY_MGMT_SAE_EXT_KEY |
128 			 WPA_KEY_MGMT_FT_SAE_EXT_KEY));
129 }
130 
wpa_key_mgmt_only_sae(int akm)131 static inline int wpa_key_mgmt_only_sae(int akm)
132 {
133 	return wpa_key_mgmt_sae(akm) &&
134 		!(akm & ~(WPA_KEY_MGMT_SAE |
135 			  WPA_KEY_MGMT_SAE_EXT_KEY |
136 			  WPA_KEY_MGMT_FT_SAE |
137 			  WPA_KEY_MGMT_FT_SAE_EXT_KEY));
138 }
139 
wpa_key_mgmt_only_sae_ext_key(int akm)140 static inline int wpa_key_mgmt_only_sae_ext_key(int akm)
141 {
142 	return wpa_key_mgmt_sae_ext_key(akm) &&
143 		!(akm & ~(WPA_KEY_MGMT_SAE_EXT_KEY |
144 			  WPA_KEY_MGMT_FT_SAE_EXT_KEY));
145 }
146 
wpa_key_mgmt_fils(int akm)147 static inline int wpa_key_mgmt_fils(int akm)
148 {
149 	return !!(akm & (WPA_KEY_MGMT_FILS_SHA256 |
150 			 WPA_KEY_MGMT_FILS_SHA384 |
151 			 WPA_KEY_MGMT_FT_FILS_SHA256 |
152 			 WPA_KEY_MGMT_FT_FILS_SHA384));
153 }
154 
wpa_key_mgmt_sha256(int akm)155 static inline int wpa_key_mgmt_sha256(int akm)
156 {
157 	return !!(akm & (WPA_KEY_MGMT_FT_IEEE8021X |
158 			 WPA_KEY_MGMT_PSK_SHA256 |
159 			 WPA_KEY_MGMT_IEEE8021X_SHA256 |
160 			 WPA_KEY_MGMT_SAE |
161 			 WPA_KEY_MGMT_FT_SAE |
162 			 WPA_KEY_MGMT_IEEE8021X_SUITE_B |
163 			 WPA_KEY_MGMT_FILS_SHA256 |
164 			 WPA_KEY_MGMT_FT_FILS_SHA256));
165 }
166 
wpa_key_mgmt_sha384(int akm)167 static inline int wpa_key_mgmt_sha384(int akm)
168 {
169 	return !!(akm & (WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 |
170 			 WPA_KEY_MGMT_FT_IEEE8021X_SHA384 |
171 			 WPA_KEY_MGMT_FILS_SHA384 |
172 			 WPA_KEY_MGMT_FT_FILS_SHA384 |
173 			 WPA_KEY_MGMT_IEEE8021X_SHA384));
174 }
175 
wpa_key_mgmt_suite_b(int akm)176 static inline int wpa_key_mgmt_suite_b(int akm)
177 {
178 	return !!(akm & (WPA_KEY_MGMT_IEEE8021X_SUITE_B |
179 			 WPA_KEY_MGMT_IEEE8021X_SUITE_B_192));
180 }
181 
wpa_key_mgmt_wpa(int akm)182 static inline int wpa_key_mgmt_wpa(int akm)
183 {
184 	return wpa_key_mgmt_wpa_ieee8021x(akm) ||
185 		wpa_key_mgmt_wpa_psk(akm) ||
186 		wpa_key_mgmt_fils(akm) ||
187 		wpa_key_mgmt_sae(akm) ||
188 		akm == WPA_KEY_MGMT_OWE ||
189 		akm == WPA_KEY_MGMT_DPP ||
190 		akm == WPA_KEY_MGMT_EPPKE;
191 }
192 
wpa_key_mgmt_wpa_any(int akm)193 static inline int wpa_key_mgmt_wpa_any(int akm)
194 {
195 	return wpa_key_mgmt_wpa(akm) || (akm & WPA_KEY_MGMT_WPA_NONE);
196 }
197 
wpa_key_mgmt_cckm(int akm)198 static inline int wpa_key_mgmt_cckm(int akm)
199 {
200 	return akm == WPA_KEY_MGMT_CCKM;
201 }
202 
wpa_key_mgmt_cross_akm(int akm)203 static inline int wpa_key_mgmt_cross_akm(int akm)
204 {
205 	return !!(akm & (WPA_KEY_MGMT_PSK |
206 			 WPA_KEY_MGMT_PSK_SHA256 |
207 			 WPA_KEY_MGMT_SAE |
208 			 WPA_KEY_MGMT_SAE_EXT_KEY));
209 }
210 
wpa_key_mgmt_eppke(int akm)211 static inline bool wpa_key_mgmt_eppke(int akm)
212 {
213 	return !!(akm & WPA_KEY_MGMT_EPPKE);
214 }
215 
wpa_key_mgmt_enhanced_open(int akm)216 static inline int wpa_key_mgmt_enhanced_open(int akm)
217 {
218 	return !!(akm & (WPA_KEY_MGMT_OWE |
219 			 WPA_KEY_MGMT_EPPKE));
220 }
221 
wpa_key_mgmt_only_enhanced_open(int akm)222 static inline int wpa_key_mgmt_only_enhanced_open(int akm)
223 {
224 	return wpa_key_mgmt_enhanced_open(akm) &&
225 		!(akm & ~(WPA_KEY_MGMT_OWE |
226 			  WPA_KEY_MGMT_EPPKE));
227 }
228 
229 #define WPA_PROTO_WPA BIT(0)
230 #define WPA_PROTO_RSN BIT(1)
231 #define WPA_PROTO_WAPI BIT(2)
232 
233 #define WPA_AUTH_ALG_OPEN BIT(0)
234 #define WPA_AUTH_ALG_SHARED BIT(1)
235 #define WPA_AUTH_ALG_LEAP BIT(2)
236 #define WPA_AUTH_ALG_FT BIT(3)
237 #define WPA_AUTH_ALG_SAE BIT(4)
238 #define WPA_AUTH_ALG_FILS BIT(5)
239 #define WPA_AUTH_ALG_FILS_SK_PFS BIT(6)
240 #define WPA_AUTH_ALG_EPPKE BIT(7)
241 #define WPA_AUTH_ALG_802_1X BIT(8)
242 
wpa_auth_alg_fils(int alg)243 static inline int wpa_auth_alg_fils(int alg)
244 {
245 	return !!(alg & (WPA_AUTH_ALG_FILS | WPA_AUTH_ALG_FILS_SK_PFS));
246 }
247 
wpa_auth_alg_eppke(int alg)248 static inline bool wpa_auth_alg_eppke(int alg)
249 {
250 	return !!(alg & WPA_AUTH_ALG_EPPKE);
251 }
252 
253 enum wpa_alg {
254 	WPA_ALG_NONE,
255 	WPA_ALG_WEP,
256 	WPA_ALG_TKIP,
257 	WPA_ALG_CCMP,
258 	WPA_ALG_BIP_CMAC_128,
259 	WPA_ALG_GCMP,
260 	WPA_ALG_SMS4,
261 	WPA_ALG_KRK,
262 	WPA_ALG_GCMP_256,
263 	WPA_ALG_CCMP_256,
264 	WPA_ALG_BIP_GMAC_128,
265 	WPA_ALG_BIP_GMAC_256,
266 	WPA_ALG_BIP_CMAC_256
267 };
268 
wpa_alg_bip(enum wpa_alg alg)269 static inline int wpa_alg_bip(enum wpa_alg alg)
270 {
271 	return alg == WPA_ALG_BIP_CMAC_128 ||
272 		alg == WPA_ALG_BIP_GMAC_128 ||
273 		alg == WPA_ALG_BIP_GMAC_256 ||
274 		alg == WPA_ALG_BIP_CMAC_256;
275 }
276 
277 /**
278  * enum wpa_states - wpa_supplicant state
279  *
280  * These enumeration values are used to indicate the current wpa_supplicant
281  * state (wpa_s->wpa_state). The current state can be retrieved with
282  * wpa_supplicant_get_state() function and the state can be changed by calling
283  * wpa_supplicant_set_state(). In WPA state machine (wpa.c and preauth.c), the
284  * wrapper functions wpa_sm_get_state() and wpa_sm_set_state() should be used
285  * to access the state variable.
286  */
287 enum wpa_states {
288 	/**
289 	 * WPA_DISCONNECTED - Disconnected state
290 	 *
291 	 * This state indicates that client is not associated, but is likely to
292 	 * start looking for an access point. This state is entered when a
293 	 * connection is lost.
294 	 */
295 	WPA_DISCONNECTED,
296 
297 	/**
298 	 * WPA_INTERFACE_DISABLED - Interface disabled
299 	 *
300 	 * This state is entered if the network interface is disabled, e.g.,
301 	 * due to rfkill. wpa_supplicant refuses any new operations that would
302 	 * use the radio until the interface has been enabled.
303 	 */
304 	WPA_INTERFACE_DISABLED,
305 
306 	/**
307 	 * WPA_INACTIVE - Inactive state (wpa_supplicant disabled)
308 	 *
309 	 * This state is entered if there are no enabled networks in the
310 	 * configuration. wpa_supplicant is not trying to associate with a new
311 	 * network and external interaction (e.g., ctrl_iface call to add or
312 	 * enable a network) is needed to start association.
313 	 */
314 	WPA_INACTIVE,
315 
316 	/**
317 	 * WPA_SCANNING - Scanning for a network
318 	 *
319 	 * This state is entered when wpa_supplicant starts scanning for a
320 	 * network.
321 	 */
322 	WPA_SCANNING,
323 
324 	/**
325 	 * WPA_AUTHENTICATING - Trying to authenticate with a BSS/SSID
326 	 *
327 	 * This state is entered when wpa_supplicant has found a suitable BSS
328 	 * to authenticate with and the driver is configured to try to
329 	 * authenticate with this BSS. This state is used only with drivers
330 	 * that use wpa_supplicant as the SME.
331 	 */
332 	WPA_AUTHENTICATING,
333 
334 	/**
335 	 * WPA_ASSOCIATING - Trying to associate with a BSS/SSID
336 	 *
337 	 * This state is entered when wpa_supplicant has found a suitable BSS
338 	 * to associate with and the driver is configured to try to associate
339 	 * with this BSS in ap_scan=1 mode. When using ap_scan=2 mode, this
340 	 * state is entered when the driver is configured to try to associate
341 	 * with a network using the configured SSID and security policy.
342 	 */
343 	WPA_ASSOCIATING,
344 
345 	/**
346 	 * WPA_ASSOCIATED - Association completed
347 	 *
348 	 * This state is entered when the driver reports that association has
349 	 * been successfully completed with an AP. If IEEE 802.1X is used
350 	 * (with or without WPA/WPA2), wpa_supplicant remains in this state
351 	 * until the IEEE 802.1X/EAPOL authentication has been completed.
352 	 */
353 	WPA_ASSOCIATED,
354 
355 	/**
356 	 * WPA_4WAY_HANDSHAKE - WPA 4-Way Key Handshake in progress
357 	 *
358 	 * This state is entered when WPA/WPA2 4-Way Handshake is started. In
359 	 * case of WPA-PSK, this happens when receiving the first EAPOL-Key
360 	 * frame after association. In case of WPA-EAP, this state is entered
361 	 * when the IEEE 802.1X/EAPOL authentication has been completed.
362 	 */
363 	WPA_4WAY_HANDSHAKE,
364 
365 	/**
366 	 * WPA_GROUP_HANDSHAKE - WPA Group Key Handshake in progress
367 	 *
368 	 * This state is entered when 4-Way Key Handshake has been completed
369 	 * (i.e., when the supplicant sends out message 4/4) and when Group
370 	 * Key rekeying is started by the AP (i.e., when supplicant receives
371 	 * message 1/2).
372 	 */
373 	WPA_GROUP_HANDSHAKE,
374 
375 	/**
376 	 * WPA_COMPLETED - All authentication completed
377 	 *
378 	 * This state is entered when the full authentication process is
379 	 * completed. In case of WPA2, this happens when the 4-Way Handshake is
380 	 * successfully completed. With WPA, this state is entered after the
381 	 * Group Key Handshake; with IEEE 802.1X (non-WPA) connection is
382 	 * completed after dynamic keys are received (or if not used, after
383 	 * the EAP authentication has been completed). With static WEP keys and
384 	 * plaintext connections, this state is entered when an association
385 	 * has been completed.
386 	 *
387 	 * This state indicates that the supplicant has completed its
388 	 * processing for the association phase and that data connection is
389 	 * fully configured.
390 	 */
391 	WPA_COMPLETED
392 };
393 
394 #define MLME_SETPROTECTION_PROTECT_TYPE_NONE 0
395 #define MLME_SETPROTECTION_PROTECT_TYPE_RX 1
396 #define MLME_SETPROTECTION_PROTECT_TYPE_TX 2
397 #define MLME_SETPROTECTION_PROTECT_TYPE_RX_TX 3
398 
399 #define MLME_SETPROTECTION_KEY_TYPE_GROUP 0
400 #define MLME_SETPROTECTION_KEY_TYPE_PAIRWISE 1
401 
402 
403 /**
404  * enum mfp_options - Management frame protection (IEEE 802.11w) options
405  */
406 enum mfp_options {
407 	NO_MGMT_FRAME_PROTECTION = 0,
408 	MGMT_FRAME_PROTECTION_OPTIONAL = 1,
409 	MGMT_FRAME_PROTECTION_REQUIRED = 2,
410 };
411 #define MGMT_FRAME_PROTECTION_DEFAULT 3
412 
413 /**
414  * enum hostapd_hw_mode - Hardware mode
415  */
416 enum hostapd_hw_mode {
417 	HOSTAPD_MODE_IEEE80211B,
418 	HOSTAPD_MODE_IEEE80211G,
419 	HOSTAPD_MODE_IEEE80211A,
420 	HOSTAPD_MODE_IEEE80211AD,
421 	HOSTAPD_MODE_IEEE80211ANY,
422 	NUM_HOSTAPD_MODES
423 };
424 
425 /**
426  * enum wpa_ctrl_req_type - Control interface request types
427  */
428 enum wpa_ctrl_req_type {
429 	WPA_CTRL_REQ_UNKNOWN,
430 	WPA_CTRL_REQ_EAP_IDENTITY,
431 	WPA_CTRL_REQ_EAP_PASSWORD,
432 	WPA_CTRL_REQ_EAP_NEW_PASSWORD,
433 	WPA_CTRL_REQ_EAP_PIN,
434 	WPA_CTRL_REQ_EAP_OTP,
435 	WPA_CTRL_REQ_EAP_PASSPHRASE,
436 	WPA_CTRL_REQ_SIM,
437 	WPA_CTRL_REQ_PSK_PASSPHRASE,
438 	WPA_CTRL_REQ_EXT_CERT_CHECK,
439 	NUM_WPA_CTRL_REQS
440 };
441 
442 /* Maximum number of EAP methods to store for EAP server user information */
443 #define EAP_MAX_METHODS 8
444 
445 enum mesh_plink_state {
446 	PLINK_IDLE = 1,
447 	PLINK_OPN_SNT,
448 	PLINK_OPN_RCVD,
449 	PLINK_CNF_RCVD,
450 	PLINK_ESTAB,
451 	PLINK_HOLDING,
452 	PLINK_BLOCKED, /* not defined in the IEEE 802.11 standard */
453 };
454 
455 enum set_band {
456 	WPA_SETBAND_AUTO = 0,
457 	WPA_SETBAND_5G = BIT(0),
458 	WPA_SETBAND_2G = BIT(1),
459 	WPA_SETBAND_6G = BIT(2),
460 };
461 
462 enum wpa_radio_work_band {
463 	BAND_2_4_GHZ = BIT(0),
464 	BAND_5_GHZ = BIT(1),
465 	BAND_60_GHZ = BIT(2),
466 };
467 
468 enum beacon_rate_type {
469 	BEACON_RATE_LEGACY,
470 	BEACON_RATE_HT,
471 	BEACON_RATE_VHT,
472 	BEACON_RATE_HE
473 };
474 
475 enum eap_proxy_sim_state {
476 	SIM_STATE_ERROR,
477 };
478 
479 #define OCE_STA BIT(0)
480 #define OCE_STA_CFON BIT(1)
481 #define OCE_AP BIT(2)
482 
483 /* enum chan_width - Channel width definitions */
484 enum chan_width {
485 	CHAN_WIDTH_20_NOHT,
486 	CHAN_WIDTH_20,
487 	CHAN_WIDTH_40,
488 	CHAN_WIDTH_80,
489 	CHAN_WIDTH_80P80,
490 	CHAN_WIDTH_160,
491 	CHAN_WIDTH_2160,
492 	CHAN_WIDTH_4320,
493 	CHAN_WIDTH_6480,
494 	CHAN_WIDTH_8640,
495 	CHAN_WIDTH_320,
496 	CHAN_WIDTH_UNKNOWN
497 };
498 
499 /* VHT/EDMG/etc. channel widths
500  * Note: The first four values are used in hostapd.conf and as such, must
501  * maintain their defined values. Other values are used internally. */
502 enum oper_chan_width {
503 	CONF_OPER_CHWIDTH_USE_HT = 0,
504 	CONF_OPER_CHWIDTH_80MHZ = 1,
505 	CONF_OPER_CHWIDTH_160MHZ = 2,
506 	CONF_OPER_CHWIDTH_80P80MHZ = 3,
507 	CONF_OPER_CHWIDTH_2160MHZ,
508 	CONF_OPER_CHWIDTH_4320MHZ,
509 	CONF_OPER_CHWIDTH_6480MHZ,
510 	CONF_OPER_CHWIDTH_8640MHZ,
511 	CONF_OPER_CHWIDTH_40MHZ_6GHZ,
512 	CONF_OPER_CHWIDTH_320MHZ,
513 };
514 
515 enum key_flag {
516 	KEY_FLAG_MODIFY			= BIT(0),
517 	KEY_FLAG_DEFAULT		= BIT(1),
518 	KEY_FLAG_RX			= BIT(2),
519 	KEY_FLAG_TX			= BIT(3),
520 	KEY_FLAG_GROUP			= BIT(4),
521 	KEY_FLAG_PAIRWISE		= BIT(5),
522 	KEY_FLAG_PMK			= BIT(6),
523 	KEY_FLAG_NEXT			= BIT(7),
524 	/* Used flag combinations */
525 	KEY_FLAG_RX_TX			= KEY_FLAG_RX | KEY_FLAG_TX,
526 	KEY_FLAG_GROUP_RX_TX		= KEY_FLAG_GROUP | KEY_FLAG_RX_TX,
527 	KEY_FLAG_GROUP_RX_TX_DEFAULT	= KEY_FLAG_GROUP_RX_TX |
528 					  KEY_FLAG_DEFAULT,
529 	KEY_FLAG_GROUP_RX		= KEY_FLAG_GROUP | KEY_FLAG_RX,
530 	KEY_FLAG_GROUP_TX_DEFAULT	= KEY_FLAG_GROUP | KEY_FLAG_TX |
531 					  KEY_FLAG_DEFAULT,
532 	KEY_FLAG_PAIRWISE_RX_TX		= KEY_FLAG_PAIRWISE | KEY_FLAG_RX_TX,
533 	KEY_FLAG_PAIRWISE_RX		= KEY_FLAG_PAIRWISE | KEY_FLAG_RX,
534 	KEY_FLAG_PAIRWISE_RX_TX_MODIFY	= KEY_FLAG_PAIRWISE_RX_TX |
535 					  KEY_FLAG_MODIFY,
536 	KEY_FLAG_PAIRWISE_NEXT		= KEY_FLAG_PAIRWISE_RX | KEY_FLAG_NEXT,
537 	/* Max allowed flags for each key type */
538 	KEY_FLAG_PAIRWISE_MASK		= KEY_FLAG_PAIRWISE_RX_TX_MODIFY |
539 					  KEY_FLAG_NEXT,
540 	KEY_FLAG_GROUP_MASK		= KEY_FLAG_GROUP_RX_TX_DEFAULT,
541 	KEY_FLAG_PMK_MASK		= KEY_FLAG_PMK,
542 };
543 
check_key_flag(enum key_flag key_flag)544 static inline int check_key_flag(enum key_flag key_flag)
545 {
546 	return !!(!key_flag ||
547 		  ((key_flag & (KEY_FLAG_PAIRWISE | KEY_FLAG_MODIFY)) &&
548 		   (key_flag & ~KEY_FLAG_PAIRWISE_MASK)) ||
549 		  ((key_flag & KEY_FLAG_GROUP) &&
550 		   (key_flag & ~KEY_FLAG_GROUP_MASK)) ||
551 		  ((key_flag & KEY_FLAG_PMK) &&
552 		   (key_flag & ~KEY_FLAG_PMK_MASK)));
553 }
554 
555 enum ptk0_rekey_handling {
556 	PTK0_REKEY_ALLOW_ALWAYS,
557 	PTK0_REKEY_ALLOW_LOCAL_OK,
558 	PTK0_REKEY_ALLOW_NEVER
559 };
560 
561 enum frame_encryption {
562 	FRAME_ENCRYPTION_UNKNOWN = -1,
563 	FRAME_NOT_ENCRYPTED = 0,
564 	FRAME_ENCRYPTED = 1
565 };
566 
567 #define MAX_NUM_MLD_LINKS 15
568 
569 enum sae_pwe {
570 	SAE_PWE_HUNT_AND_PECK = 0,
571 	SAE_PWE_HASH_TO_ELEMENT = 1,
572 	SAE_PWE_BOTH = 2,
573 	SAE_PWE_FORCE_HUNT_AND_PECK = 3,
574 	SAE_PWE_NOT_SET = 4,
575 };
576 
577 enum wpa_p2p_mode {
578 	WPA_P2P_MODE_WFD_R1	= 0,
579 	WPA_P2P_MODE_WFD_R2	= 1,
580 	WPA_P2P_MODE_WFD_PCC	= 2,
581 };
582 
583 #define USEC_80211_TU 1024
584 
585 #define USEC_TO_TU(m) ((m) / USEC_80211_TU)
586 #define TU_TO_USEC(m) ((m) * USEC_80211_TU)
587 
588 #endif /* DEFS_H */
589