blob: f62c3ceeede9994be6eef900f815d500a01e08fe [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * WPA Supplicant - Common definitions
Roshan Pius3a1667e2018-07-03 15:17:14 -07003 * Copyright (c) 2004-2018, 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 DEFS_H
10#define DEFS_H
11
12#ifdef FALSE
13#undef FALSE
14#endif
15#ifdef TRUE
16#undef TRUE
17#endif
18typedef enum { FALSE = 0, TRUE = 1 } Boolean;
19
20
21#define WPA_CIPHER_NONE BIT(0)
22#define WPA_CIPHER_WEP40 BIT(1)
23#define WPA_CIPHER_WEP104 BIT(2)
24#define WPA_CIPHER_TKIP BIT(3)
25#define WPA_CIPHER_CCMP BIT(4)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070026#define WPA_CIPHER_AES_128_CMAC BIT(5)
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070027#define WPA_CIPHER_GCMP BIT(6)
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080028#define WPA_CIPHER_SMS4 BIT(7)
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -080029#define WPA_CIPHER_GCMP_256 BIT(8)
30#define WPA_CIPHER_CCMP_256 BIT(9)
31#define WPA_CIPHER_BIP_GMAC_128 BIT(11)
32#define WPA_CIPHER_BIP_GMAC_256 BIT(12)
33#define WPA_CIPHER_BIP_CMAC_256 BIT(13)
34#define WPA_CIPHER_GTK_NOT_USED BIT(14)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070035
36#define WPA_KEY_MGMT_IEEE8021X BIT(0)
37#define WPA_KEY_MGMT_PSK BIT(1)
38#define WPA_KEY_MGMT_NONE BIT(2)
39#define WPA_KEY_MGMT_IEEE8021X_NO_WPA BIT(3)
40#define WPA_KEY_MGMT_WPA_NONE BIT(4)
41#define WPA_KEY_MGMT_FT_IEEE8021X BIT(5)
42#define WPA_KEY_MGMT_FT_PSK BIT(6)
43#define WPA_KEY_MGMT_IEEE8021X_SHA256 BIT(7)
44#define WPA_KEY_MGMT_PSK_SHA256 BIT(8)
45#define WPA_KEY_MGMT_WPS BIT(9)
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080046#define WPA_KEY_MGMT_SAE BIT(10)
47#define WPA_KEY_MGMT_FT_SAE BIT(11)
48#define WPA_KEY_MGMT_WAPI_PSK BIT(12)
49#define WPA_KEY_MGMT_WAPI_CERT BIT(13)
50#define WPA_KEY_MGMT_CCKM BIT(14)
Dmitry Shmidtf21452a2014-02-26 10:55:25 -080051#define WPA_KEY_MGMT_OSEN BIT(15)
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080052#define WPA_KEY_MGMT_IEEE8021X_SUITE_B BIT(16)
Dmitry Shmidt807291d2015-01-27 13:40:23 -080053#define WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 BIT(17)
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -080054#define WPA_KEY_MGMT_FILS_SHA256 BIT(18)
55#define WPA_KEY_MGMT_FILS_SHA384 BIT(19)
56#define WPA_KEY_MGMT_FT_FILS_SHA256 BIT(20)
57#define WPA_KEY_MGMT_FT_FILS_SHA384 BIT(21)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070058#define WPA_KEY_MGMT_OWE BIT(22)
59#define WPA_KEY_MGMT_DPP BIT(23)
Roshan Pius3a1667e2018-07-03 15:17:14 -070060#define WPA_KEY_MGMT_FT_IEEE8021X_SHA384 BIT(24)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070061
Hai Shalom74f70d42019-02-11 14:42:39 -080062#define WPA_KEY_MGMT_FT (WPA_KEY_MGMT_FT_PSK | \
63 WPA_KEY_MGMT_FT_IEEE8021X | \
64 WPA_KEY_MGMT_FT_IEEE8021X_SHA384 | \
65 WPA_KEY_MGMT_FT_SAE | \
66 WPA_KEY_MGMT_FT_FILS_SHA256 | \
67 WPA_KEY_MGMT_FT_FILS_SHA384)
68
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070069static inline int wpa_key_mgmt_wpa_ieee8021x(int akm)
70{
71 return !!(akm & (WPA_KEY_MGMT_IEEE8021X |
72 WPA_KEY_MGMT_FT_IEEE8021X |
Roshan Pius3a1667e2018-07-03 15:17:14 -070073 WPA_KEY_MGMT_FT_IEEE8021X_SHA384 |
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080074 WPA_KEY_MGMT_CCKM |
Dmitry Shmidtf21452a2014-02-26 10:55:25 -080075 WPA_KEY_MGMT_OSEN |
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080076 WPA_KEY_MGMT_IEEE8021X_SHA256 |
Dmitry Shmidt807291d2015-01-27 13:40:23 -080077 WPA_KEY_MGMT_IEEE8021X_SUITE_B |
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -080078 WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 |
79 WPA_KEY_MGMT_FILS_SHA256 |
80 WPA_KEY_MGMT_FILS_SHA384 |
81 WPA_KEY_MGMT_FT_FILS_SHA256 |
82 WPA_KEY_MGMT_FT_FILS_SHA384));
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070083}
84
Hai Shalomfdcde762020-04-02 11:19:20 -070085static inline int wpa_key_mgmt_wpa_psk_no_sae(int akm)
86{
87 return !!(akm & (WPA_KEY_MGMT_PSK |
88 WPA_KEY_MGMT_FT_PSK |
89 WPA_KEY_MGMT_PSK_SHA256));
90}
91
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070092static inline int wpa_key_mgmt_wpa_psk(int akm)
93{
94 return !!(akm & (WPA_KEY_MGMT_PSK |
95 WPA_KEY_MGMT_FT_PSK |
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080096 WPA_KEY_MGMT_PSK_SHA256 |
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -080097 WPA_KEY_MGMT_SAE |
98 WPA_KEY_MGMT_FT_SAE));
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070099}
100
101static inline int wpa_key_mgmt_ft(int akm)
102{
Hai Shalom74f70d42019-02-11 14:42:39 -0800103 return !!(akm & WPA_KEY_MGMT_FT);
104}
105
106static inline int wpa_key_mgmt_only_ft(int akm)
107{
108 int ft = wpa_key_mgmt_ft(akm);
109 akm &= ~WPA_KEY_MGMT_FT;
110 return ft && !akm;
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800111}
112
113static inline int wpa_key_mgmt_ft_psk(int akm)
114{
115 return !!(akm & WPA_KEY_MGMT_FT_PSK);
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800116}
117
118static inline int wpa_key_mgmt_sae(int akm)
119{
120 return !!(akm & (WPA_KEY_MGMT_SAE |
121 WPA_KEY_MGMT_FT_SAE));
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700122}
123
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800124static inline int wpa_key_mgmt_fils(int akm)
125{
126 return !!(akm & (WPA_KEY_MGMT_FILS_SHA256 |
127 WPA_KEY_MGMT_FILS_SHA384 |
128 WPA_KEY_MGMT_FT_FILS_SHA256 |
129 WPA_KEY_MGMT_FT_FILS_SHA384));
130}
131
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700132static inline int wpa_key_mgmt_sha256(int akm)
133{
134 return !!(akm & (WPA_KEY_MGMT_PSK_SHA256 |
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800135 WPA_KEY_MGMT_IEEE8021X_SHA256 |
Roshan Pius3a1667e2018-07-03 15:17:14 -0700136 WPA_KEY_MGMT_SAE |
137 WPA_KEY_MGMT_FT_SAE |
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800138 WPA_KEY_MGMT_OSEN |
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800139 WPA_KEY_MGMT_IEEE8021X_SUITE_B |
140 WPA_KEY_MGMT_FILS_SHA256 |
141 WPA_KEY_MGMT_FT_FILS_SHA256));
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800142}
143
Dmitry Shmidt807291d2015-01-27 13:40:23 -0800144static inline int wpa_key_mgmt_sha384(int akm)
145{
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800146 return !!(akm & (WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 |
Roshan Pius3a1667e2018-07-03 15:17:14 -0700147 WPA_KEY_MGMT_FT_IEEE8021X_SHA384 |
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800148 WPA_KEY_MGMT_FILS_SHA384 |
149 WPA_KEY_MGMT_FT_FILS_SHA384));
Dmitry Shmidt807291d2015-01-27 13:40:23 -0800150}
151
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800152static inline int wpa_key_mgmt_suite_b(int akm)
153{
Dmitry Shmidt807291d2015-01-27 13:40:23 -0800154 return !!(akm & (WPA_KEY_MGMT_IEEE8021X_SUITE_B |
155 WPA_KEY_MGMT_IEEE8021X_SUITE_B_192));
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700156}
157
158static inline int wpa_key_mgmt_wpa(int akm)
159{
160 return wpa_key_mgmt_wpa_ieee8021x(akm) ||
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800161 wpa_key_mgmt_wpa_psk(akm) ||
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800162 wpa_key_mgmt_fils(akm) ||
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700163 wpa_key_mgmt_sae(akm) ||
164 akm == WPA_KEY_MGMT_OWE ||
165 akm == WPA_KEY_MGMT_DPP;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700166}
167
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800168static inline int wpa_key_mgmt_wpa_any(int akm)
169{
170 return wpa_key_mgmt_wpa(akm) || (akm & WPA_KEY_MGMT_WPA_NONE);
171}
172
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800173static inline int wpa_key_mgmt_cckm(int akm)
174{
175 return akm == WPA_KEY_MGMT_CCKM;
176}
177
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700178
179#define WPA_PROTO_WPA BIT(0)
180#define WPA_PROTO_RSN BIT(1)
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800181#define WPA_PROTO_WAPI BIT(2)
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800182#define WPA_PROTO_OSEN BIT(3)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700183
184#define WPA_AUTH_ALG_OPEN BIT(0)
185#define WPA_AUTH_ALG_SHARED BIT(1)
186#define WPA_AUTH_ALG_LEAP BIT(2)
187#define WPA_AUTH_ALG_FT BIT(3)
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800188#define WPA_AUTH_ALG_SAE BIT(4)
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800189#define WPA_AUTH_ALG_FILS BIT(5)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700190#define WPA_AUTH_ALG_FILS_SK_PFS BIT(6)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700191
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700192static inline int wpa_auth_alg_fils(int alg)
193{
194 return !!(alg & (WPA_AUTH_ALG_FILS | WPA_AUTH_ALG_FILS_SK_PFS));
195}
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700196
197enum wpa_alg {
198 WPA_ALG_NONE,
199 WPA_ALG_WEP,
200 WPA_ALG_TKIP,
201 WPA_ALG_CCMP,
202 WPA_ALG_IGTK,
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800203 WPA_ALG_GCMP,
204 WPA_ALG_SMS4,
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800205 WPA_ALG_KRK,
206 WPA_ALG_GCMP_256,
207 WPA_ALG_CCMP_256,
208 WPA_ALG_BIP_GMAC_128,
209 WPA_ALG_BIP_GMAC_256,
210 WPA_ALG_BIP_CMAC_256
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700211};
212
213/**
214 * enum wpa_states - wpa_supplicant state
215 *
216 * These enumeration values are used to indicate the current wpa_supplicant
217 * state (wpa_s->wpa_state). The current state can be retrieved with
218 * wpa_supplicant_get_state() function and the state can be changed by calling
219 * wpa_supplicant_set_state(). In WPA state machine (wpa.c and preauth.c), the
220 * wrapper functions wpa_sm_get_state() and wpa_sm_set_state() should be used
221 * to access the state variable.
222 */
223enum wpa_states {
224 /**
225 * WPA_DISCONNECTED - Disconnected state
226 *
227 * This state indicates that client is not associated, but is likely to
228 * start looking for an access point. This state is entered when a
229 * connection is lost.
230 */
231 WPA_DISCONNECTED,
232
233 /**
234 * WPA_INTERFACE_DISABLED - Interface disabled
235 *
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800236 * This state is entered if the network interface is disabled, e.g.,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700237 * due to rfkill. wpa_supplicant refuses any new operations that would
238 * use the radio until the interface has been enabled.
239 */
240 WPA_INTERFACE_DISABLED,
241
242 /**
243 * WPA_INACTIVE - Inactive state (wpa_supplicant disabled)
244 *
245 * This state is entered if there are no enabled networks in the
246 * configuration. wpa_supplicant is not trying to associate with a new
247 * network and external interaction (e.g., ctrl_iface call to add or
248 * enable a network) is needed to start association.
249 */
250 WPA_INACTIVE,
251
252 /**
253 * WPA_SCANNING - Scanning for a network
254 *
255 * This state is entered when wpa_supplicant starts scanning for a
256 * network.
257 */
258 WPA_SCANNING,
259
260 /**
261 * WPA_AUTHENTICATING - Trying to authenticate with a BSS/SSID
262 *
263 * This state is entered when wpa_supplicant has found a suitable BSS
264 * to authenticate with and the driver is configured to try to
265 * authenticate with this BSS. This state is used only with drivers
266 * that use wpa_supplicant as the SME.
267 */
268 WPA_AUTHENTICATING,
269
270 /**
271 * WPA_ASSOCIATING - Trying to associate with a BSS/SSID
272 *
273 * This state is entered when wpa_supplicant has found a suitable BSS
274 * to associate with and the driver is configured to try to associate
275 * with this BSS in ap_scan=1 mode. When using ap_scan=2 mode, this
276 * state is entered when the driver is configured to try to associate
277 * with a network using the configured SSID and security policy.
278 */
279 WPA_ASSOCIATING,
280
281 /**
282 * WPA_ASSOCIATED - Association completed
283 *
284 * This state is entered when the driver reports that association has
285 * been successfully completed with an AP. If IEEE 802.1X is used
286 * (with or without WPA/WPA2), wpa_supplicant remains in this state
287 * until the IEEE 802.1X/EAPOL authentication has been completed.
288 */
289 WPA_ASSOCIATED,
290
291 /**
292 * WPA_4WAY_HANDSHAKE - WPA 4-Way Key Handshake in progress
293 *
294 * This state is entered when WPA/WPA2 4-Way Handshake is started. In
295 * case of WPA-PSK, this happens when receiving the first EAPOL-Key
296 * frame after association. In case of WPA-EAP, this state is entered
297 * when the IEEE 802.1X/EAPOL authentication has been completed.
298 */
299 WPA_4WAY_HANDSHAKE,
300
301 /**
302 * WPA_GROUP_HANDSHAKE - WPA Group Key Handshake in progress
303 *
304 * This state is entered when 4-Way Key Handshake has been completed
305 * (i.e., when the supplicant sends out message 4/4) and when Group
306 * Key rekeying is started by the AP (i.e., when supplicant receives
307 * message 1/2).
308 */
309 WPA_GROUP_HANDSHAKE,
310
311 /**
312 * WPA_COMPLETED - All authentication completed
313 *
314 * This state is entered when the full authentication process is
315 * completed. In case of WPA2, this happens when the 4-Way Handshake is
316 * successfully completed. With WPA, this state is entered after the
317 * Group Key Handshake; with IEEE 802.1X (non-WPA) connection is
318 * completed after dynamic keys are received (or if not used, after
319 * the EAP authentication has been completed). With static WEP keys and
320 * plaintext connections, this state is entered when an association
321 * has been completed.
322 *
323 * This state indicates that the supplicant has completed its
324 * processing for the association phase and that data connection is
325 * fully configured.
326 */
327 WPA_COMPLETED
328};
329
330#define MLME_SETPROTECTION_PROTECT_TYPE_NONE 0
331#define MLME_SETPROTECTION_PROTECT_TYPE_RX 1
332#define MLME_SETPROTECTION_PROTECT_TYPE_TX 2
333#define MLME_SETPROTECTION_PROTECT_TYPE_RX_TX 3
334
335#define MLME_SETPROTECTION_KEY_TYPE_GROUP 0
336#define MLME_SETPROTECTION_KEY_TYPE_PAIRWISE 1
337
338
339/**
340 * enum mfp_options - Management frame protection (IEEE 802.11w) options
341 */
342enum mfp_options {
343 NO_MGMT_FRAME_PROTECTION = 0,
344 MGMT_FRAME_PROTECTION_OPTIONAL = 1,
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800345 MGMT_FRAME_PROTECTION_REQUIRED = 2,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700346};
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800347#define MGMT_FRAME_PROTECTION_DEFAULT 3
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700348
349/**
350 * enum hostapd_hw_mode - Hardware mode
351 */
352enum hostapd_hw_mode {
353 HOSTAPD_MODE_IEEE80211B,
354 HOSTAPD_MODE_IEEE80211G,
355 HOSTAPD_MODE_IEEE80211A,
Dmitry Shmidta54fa5f2013-01-15 13:53:35 -0800356 HOSTAPD_MODE_IEEE80211AD,
Dmitry Shmidtb1e52102015-05-29 12:36:29 -0700357 HOSTAPD_MODE_IEEE80211ANY,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700358 NUM_HOSTAPD_MODES
359};
360
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800361/**
362 * enum wpa_ctrl_req_type - Control interface request types
363 */
364enum wpa_ctrl_req_type {
365 WPA_CTRL_REQ_UNKNOWN,
366 WPA_CTRL_REQ_EAP_IDENTITY,
367 WPA_CTRL_REQ_EAP_PASSWORD,
368 WPA_CTRL_REQ_EAP_NEW_PASSWORD,
369 WPA_CTRL_REQ_EAP_PIN,
370 WPA_CTRL_REQ_EAP_OTP,
371 WPA_CTRL_REQ_EAP_PASSPHRASE,
Dmitry Shmidt051af732013-10-22 13:52:46 -0700372 WPA_CTRL_REQ_SIM,
Dmitry Shmidt912c6ec2015-03-30 13:16:51 -0700373 WPA_CTRL_REQ_PSK_PASSPHRASE,
Dmitry Shmidt55840ad2015-12-14 12:45:46 -0800374 WPA_CTRL_REQ_EXT_CERT_CHECK,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800375 NUM_WPA_CTRL_REQS
376};
377
378/* Maximum number of EAP methods to store for EAP server user information */
379#define EAP_MAX_METHODS 8
380
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800381enum mesh_plink_state {
Dmitry Shmidt58d12ad2016-07-28 10:07:03 -0700382 PLINK_IDLE = 1,
383 PLINK_OPN_SNT,
384 PLINK_OPN_RCVD,
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800385 PLINK_CNF_RCVD,
386 PLINK_ESTAB,
387 PLINK_HOLDING,
Dmitry Shmidt58d12ad2016-07-28 10:07:03 -0700388 PLINK_BLOCKED, /* not defined in the IEEE 802.11 standard */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800389};
390
Ravi Joshie6ccb162015-07-16 17:45:41 -0700391enum set_band {
392 WPA_SETBAND_AUTO,
393 WPA_SETBAND_5G,
394 WPA_SETBAND_2G
395};
396
Dmitry Shmidt9c175262016-03-03 10:20:07 -0800397enum wpa_radio_work_band {
398 BAND_2_4_GHZ = BIT(0),
399 BAND_5_GHZ = BIT(1),
400 BAND_60_GHZ = BIT(2),
401};
402
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800403enum beacon_rate_type {
404 BEACON_RATE_LEGACY,
405 BEACON_RATE_HT,
406 BEACON_RATE_VHT
407};
408
Dmitry Shmidt29333592017-01-09 12:27:11 -0800409enum eap_proxy_sim_state {
410 SIM_STATE_ERROR,
411};
412
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700413#define OCE_STA BIT(0)
414#define OCE_STA_CFON BIT(1)
415#define OCE_AP BIT(2)
416
Hai Shalom74f70d42019-02-11 14:42:39 -0800417/* enum chan_width - Channel width definitions */
418enum chan_width {
419 CHAN_WIDTH_20_NOHT,
420 CHAN_WIDTH_20,
421 CHAN_WIDTH_40,
422 CHAN_WIDTH_80,
423 CHAN_WIDTH_80P80,
424 CHAN_WIDTH_160,
Ahmed ElArabawy0ff61c52019-12-26 12:38:39 -0800425 CHAN_WIDTH_2160,
426 CHAN_WIDTH_4320,
427 CHAN_WIDTH_6480,
428 CHAN_WIDTH_8640,
Hai Shalom74f70d42019-02-11 14:42:39 -0800429 CHAN_WIDTH_UNKNOWN
430};
431
Hai Shalomfdcde762020-04-02 11:19:20 -0700432enum key_flag {
433 KEY_FLAG_MODIFY = BIT(0),
434 KEY_FLAG_DEFAULT = BIT(1),
435 KEY_FLAG_RX = BIT(2),
436 KEY_FLAG_TX = BIT(3),
437 KEY_FLAG_GROUP = BIT(4),
438 KEY_FLAG_PAIRWISE = BIT(5),
439 KEY_FLAG_PMK = BIT(6),
440 /* Used flag combinations */
441 KEY_FLAG_RX_TX = KEY_FLAG_RX | KEY_FLAG_TX,
442 KEY_FLAG_GROUP_RX_TX = KEY_FLAG_GROUP | KEY_FLAG_RX_TX,
443 KEY_FLAG_GROUP_RX_TX_DEFAULT = KEY_FLAG_GROUP_RX_TX |
444 KEY_FLAG_DEFAULT,
445 KEY_FLAG_GROUP_RX = KEY_FLAG_GROUP | KEY_FLAG_RX,
446 KEY_FLAG_GROUP_TX_DEFAULT = KEY_FLAG_GROUP | KEY_FLAG_TX |
447 KEY_FLAG_DEFAULT,
448 KEY_FLAG_PAIRWISE_RX_TX = KEY_FLAG_PAIRWISE | KEY_FLAG_RX_TX,
449 KEY_FLAG_PAIRWISE_RX = KEY_FLAG_PAIRWISE | KEY_FLAG_RX,
450 KEY_FLAG_PAIRWISE_RX_TX_MODIFY = KEY_FLAG_PAIRWISE_RX_TX |
451 KEY_FLAG_MODIFY,
452 /* Max allowed flags for each key type */
453 KEY_FLAG_PAIRWISE_MASK = KEY_FLAG_PAIRWISE_RX_TX_MODIFY,
454 KEY_FLAG_GROUP_MASK = KEY_FLAG_GROUP_RX_TX_DEFAULT,
455 KEY_FLAG_PMK_MASK = KEY_FLAG_PMK,
456};
457
458static inline int check_key_flag(enum key_flag key_flag)
459{
460 return !!(!key_flag ||
461 ((key_flag & (KEY_FLAG_PAIRWISE | KEY_FLAG_MODIFY)) &&
462 (key_flag & ~KEY_FLAG_PAIRWISE_MASK)) ||
463 ((key_flag & KEY_FLAG_GROUP) &&
464 (key_flag & ~KEY_FLAG_GROUP_MASK)) ||
465 ((key_flag & KEY_FLAG_PMK) &&
466 (key_flag & ~KEY_FLAG_PMK_MASK)));
467}
468
469enum ptk0_rekey_handling {
470 PTK0_REKEY_ALLOW_ALWAYS,
471 PTK0_REKEY_ALLOW_LOCAL_OK,
472 PTK0_REKEY_ALLOW_NEVER
473};
474
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700475#endif /* DEFS_H */