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