]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/common/defs.h
AP: Allow PTK rekeying without Ext KeyID to be disabled as a workaround
[thirdparty/hostap.git] / src / common / defs.h
CommitLineData
6fc6879b
JM
1/*
2 * WPA Supplicant - Common definitions
c22bb5bb 3 * Copyright (c) 2004-2018, Jouni Malinen <j@w1.fi>
6fc6879b 4 *
0f3d578e
JM
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
6fc6879b
JM
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
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)
6fc6879b 26#define WPA_CIPHER_AES_128_CMAC BIT(5)
eb7719ff 27#define WPA_CIPHER_GCMP BIT(6)
369c8d7b 28#define WPA_CIPHER_SMS4 BIT(7)
30675c34
JM
29#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)
dff1e285 34#define WPA_CIPHER_GTK_NOT_USED BIT(14)
6fc6879b
JM
35
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)
56586197
JM
43#define WPA_KEY_MGMT_IEEE8021X_SHA256 BIT(7)
44#define WPA_KEY_MGMT_PSK_SHA256 BIT(8)
ad08c363 45#define WPA_KEY_MGMT_WPS BIT(9)
c10347f2
JM
46#define WPA_KEY_MGMT_SAE BIT(10)
47#define WPA_KEY_MGMT_FT_SAE BIT(11)
369c8d7b
JM
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)
a5d75636 51#define WPA_KEY_MGMT_OSEN BIT(15)
666497c8 52#define WPA_KEY_MGMT_IEEE8021X_SUITE_B BIT(16)
5e3b5197 53#define WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 BIT(17)
94318a0d
JM
54#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)
a1ea1b45 58#define WPA_KEY_MGMT_OWE BIT(22)
567da5bb 59#define WPA_KEY_MGMT_DPP BIT(23)
c22bb5bb 60#define WPA_KEY_MGMT_FT_IEEE8021X_SHA384 BIT(24)
56586197 61
bb35e2d2
JD
62#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
56586197
JM
69static inline int wpa_key_mgmt_wpa_ieee8021x(int akm)
70{
03d3f28a
JM
71 return !!(akm & (WPA_KEY_MGMT_IEEE8021X |
72 WPA_KEY_MGMT_FT_IEEE8021X |
c22bb5bb 73 WPA_KEY_MGMT_FT_IEEE8021X_SHA384 |
369c8d7b 74 WPA_KEY_MGMT_CCKM |
a5d75636 75 WPA_KEY_MGMT_OSEN |
666497c8 76 WPA_KEY_MGMT_IEEE8021X_SHA256 |
5e3b5197 77 WPA_KEY_MGMT_IEEE8021X_SUITE_B |
94318a0d
JM
78 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));
56586197
JM
83}
84
85static inline int wpa_key_mgmt_wpa_psk(int akm)
86{
03d3f28a
JM
87 return !!(akm & (WPA_KEY_MGMT_PSK |
88 WPA_KEY_MGMT_FT_PSK |
c10347f2 89 WPA_KEY_MGMT_PSK_SHA256 |
aa189ac9
JM
90 WPA_KEY_MGMT_SAE |
91 WPA_KEY_MGMT_FT_SAE));
56586197
JM
92}
93
94static inline int wpa_key_mgmt_ft(int akm)
95{
bb35e2d2
JD
96 return !!(akm & WPA_KEY_MGMT_FT);
97}
98
99static inline int wpa_key_mgmt_only_ft(int akm)
100{
101 int ft = wpa_key_mgmt_ft(akm);
102 akm &= ~WPA_KEY_MGMT_FT;
103 return ft && !akm;
c10347f2
JM
104}
105
96590564
MB
106static inline int wpa_key_mgmt_ft_psk(int akm)
107{
108 return !!(akm & WPA_KEY_MGMT_FT_PSK);
109}
110
c10347f2
JM
111static inline int wpa_key_mgmt_sae(int akm)
112{
113 return !!(akm & (WPA_KEY_MGMT_SAE |
114 WPA_KEY_MGMT_FT_SAE));
56586197
JM
115}
116
94318a0d
JM
117static inline int wpa_key_mgmt_fils(int akm)
118{
119 return !!(akm & (WPA_KEY_MGMT_FILS_SHA256 |
120 WPA_KEY_MGMT_FILS_SHA384 |
121 WPA_KEY_MGMT_FT_FILS_SHA256 |
122 WPA_KEY_MGMT_FT_FILS_SHA384));
123}
124
56586197
JM
125static inline int wpa_key_mgmt_sha256(int akm)
126{
03d3f28a 127 return !!(akm & (WPA_KEY_MGMT_PSK_SHA256 |
a5d75636 128 WPA_KEY_MGMT_IEEE8021X_SHA256 |
1778f1e9
JM
129 WPA_KEY_MGMT_SAE |
130 WPA_KEY_MGMT_FT_SAE |
666497c8 131 WPA_KEY_MGMT_OSEN |
94318a0d
JM
132 WPA_KEY_MGMT_IEEE8021X_SUITE_B |
133 WPA_KEY_MGMT_FILS_SHA256 |
134 WPA_KEY_MGMT_FT_FILS_SHA256));
666497c8
JM
135}
136
5e3b5197
JM
137static inline int wpa_key_mgmt_sha384(int akm)
138{
94318a0d 139 return !!(akm & (WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 |
c22bb5bb 140 WPA_KEY_MGMT_FT_IEEE8021X_SHA384 |
94318a0d
JM
141 WPA_KEY_MGMT_FILS_SHA384 |
142 WPA_KEY_MGMT_FT_FILS_SHA384));
5e3b5197
JM
143}
144
666497c8
JM
145static inline int wpa_key_mgmt_suite_b(int akm)
146{
5e3b5197
JM
147 return !!(akm & (WPA_KEY_MGMT_IEEE8021X_SUITE_B |
148 WPA_KEY_MGMT_IEEE8021X_SUITE_B_192));
56586197
JM
149}
150
43882f1e
JM
151static inline int wpa_key_mgmt_wpa(int akm)
152{
153 return wpa_key_mgmt_wpa_ieee8021x(akm) ||
aa189ac9 154 wpa_key_mgmt_wpa_psk(akm) ||
94318a0d 155 wpa_key_mgmt_fils(akm) ||
a1ea1b45 156 wpa_key_mgmt_sae(akm) ||
567da5bb
JM
157 akm == WPA_KEY_MGMT_OWE ||
158 akm == WPA_KEY_MGMT_DPP;
43882f1e
JM
159}
160
0bf927a0
JM
161static inline int wpa_key_mgmt_wpa_any(int akm)
162{
163 return wpa_key_mgmt_wpa(akm) || (akm & WPA_KEY_MGMT_WPA_NONE);
164}
165
369c8d7b
JM
166static inline int wpa_key_mgmt_cckm(int akm)
167{
168 return akm == WPA_KEY_MGMT_CCKM;
169}
170
6fc6879b
JM
171
172#define WPA_PROTO_WPA BIT(0)
173#define WPA_PROTO_RSN BIT(1)
369c8d7b 174#define WPA_PROTO_WAPI BIT(2)
a5d75636 175#define WPA_PROTO_OSEN BIT(3)
6fc6879b
JM
176
177#define WPA_AUTH_ALG_OPEN BIT(0)
178#define WPA_AUTH_ALG_SHARED BIT(1)
179#define WPA_AUTH_ALG_LEAP BIT(2)
f400f4f3 180#define WPA_AUTH_ALG_FT BIT(3)
c10347f2 181#define WPA_AUTH_ALG_SAE BIT(4)
274d8b77 182#define WPA_AUTH_ALG_FILS BIT(5)
cad291d6 183#define WPA_AUTH_ALG_FILS_SK_PFS BIT(6)
6fc6879b 184
da6a28ba
VK
185static inline int wpa_auth_alg_fils(int alg)
186{
187 return !!(alg & (WPA_AUTH_ALG_FILS | WPA_AUTH_ALG_FILS_SK_PFS));
188}
6fc6879b 189
71934751
JM
190enum wpa_alg {
191 WPA_ALG_NONE,
192 WPA_ALG_WEP,
193 WPA_ALG_TKIP,
194 WPA_ALG_CCMP,
195 WPA_ALG_IGTK,
eb7719ff 196 WPA_ALG_PMK,
369c8d7b
JM
197 WPA_ALG_GCMP,
198 WPA_ALG_SMS4,
30675c34
JM
199 WPA_ALG_KRK,
200 WPA_ALG_GCMP_256,
201 WPA_ALG_CCMP_256,
202 WPA_ALG_BIP_GMAC_128,
203 WPA_ALG_BIP_GMAC_256,
204 WPA_ALG_BIP_CMAC_256
71934751
JM
205};
206
6fc6879b
JM
207/**
208 * enum wpa_states - wpa_supplicant state
209 *
210 * These enumeration values are used to indicate the current wpa_supplicant
211 * state (wpa_s->wpa_state). The current state can be retrieved with
212 * wpa_supplicant_get_state() function and the state can be changed by calling
213 * wpa_supplicant_set_state(). In WPA state machine (wpa.c and preauth.c), the
214 * wrapper functions wpa_sm_get_state() and wpa_sm_set_state() should be used
215 * to access the state variable.
216 */
71934751 217enum wpa_states {
6fc6879b
JM
218 /**
219 * WPA_DISCONNECTED - Disconnected state
220 *
221 * This state indicates that client is not associated, but is likely to
222 * start looking for an access point. This state is entered when a
223 * connection is lost.
224 */
225 WPA_DISCONNECTED,
226
8401a6b0
JM
227 /**
228 * WPA_INTERFACE_DISABLED - Interface disabled
229 *
6995536f 230 * This state is entered if the network interface is disabled, e.g.,
8401a6b0
JM
231 * due to rfkill. wpa_supplicant refuses any new operations that would
232 * use the radio until the interface has been enabled.
233 */
234 WPA_INTERFACE_DISABLED,
235
6fc6879b
JM
236 /**
237 * WPA_INACTIVE - Inactive state (wpa_supplicant disabled)
238 *
239 * This state is entered if there are no enabled networks in the
240 * configuration. wpa_supplicant is not trying to associate with a new
241 * network and external interaction (e.g., ctrl_iface call to add or
242 * enable a network) is needed to start association.
243 */
244 WPA_INACTIVE,
245
246 /**
247 * WPA_SCANNING - Scanning for a network
248 *
249 * This state is entered when wpa_supplicant starts scanning for a
250 * network.
251 */
252 WPA_SCANNING,
253
c2a04078
JM
254 /**
255 * WPA_AUTHENTICATING - Trying to authenticate with a BSS/SSID
256 *
257 * This state is entered when wpa_supplicant has found a suitable BSS
258 * to authenticate with and the driver is configured to try to
259 * authenticate with this BSS. This state is used only with drivers
260 * that use wpa_supplicant as the SME.
261 */
262 WPA_AUTHENTICATING,
263
6fc6879b
JM
264 /**
265 * WPA_ASSOCIATING - Trying to associate with a BSS/SSID
266 *
267 * This state is entered when wpa_supplicant has found a suitable BSS
268 * to associate with and the driver is configured to try to associate
269 * with this BSS in ap_scan=1 mode. When using ap_scan=2 mode, this
270 * state is entered when the driver is configured to try to associate
271 * with a network using the configured SSID and security policy.
272 */
273 WPA_ASSOCIATING,
274
275 /**
276 * WPA_ASSOCIATED - Association completed
277 *
278 * This state is entered when the driver reports that association has
279 * been successfully completed with an AP. If IEEE 802.1X is used
280 * (with or without WPA/WPA2), wpa_supplicant remains in this state
281 * until the IEEE 802.1X/EAPOL authentication has been completed.
282 */
283 WPA_ASSOCIATED,
284
285 /**
286 * WPA_4WAY_HANDSHAKE - WPA 4-Way Key Handshake in progress
287 *
288 * This state is entered when WPA/WPA2 4-Way Handshake is started. In
289 * case of WPA-PSK, this happens when receiving the first EAPOL-Key
290 * frame after association. In case of WPA-EAP, this state is entered
291 * when the IEEE 802.1X/EAPOL authentication has been completed.
292 */
293 WPA_4WAY_HANDSHAKE,
294
295 /**
296 * WPA_GROUP_HANDSHAKE - WPA Group Key Handshake in progress
297 *
298 * This state is entered when 4-Way Key Handshake has been completed
299 * (i.e., when the supplicant sends out message 4/4) and when Group
300 * Key rekeying is started by the AP (i.e., when supplicant receives
301 * message 1/2).
302 */
303 WPA_GROUP_HANDSHAKE,
304
305 /**
306 * WPA_COMPLETED - All authentication completed
307 *
308 * This state is entered when the full authentication process is
309 * completed. In case of WPA2, this happens when the 4-Way Handshake is
310 * successfully completed. With WPA, this state is entered after the
311 * Group Key Handshake; with IEEE 802.1X (non-WPA) connection is
312 * completed after dynamic keys are received (or if not used, after
313 * the EAP authentication has been completed). With static WEP keys and
314 * plaintext connections, this state is entered when an association
315 * has been completed.
316 *
317 * This state indicates that the supplicant has completed its
318 * processing for the association phase and that data connection is
319 * fully configured.
320 */
321 WPA_COMPLETED
71934751 322};
6fc6879b
JM
323
324#define MLME_SETPROTECTION_PROTECT_TYPE_NONE 0
325#define MLME_SETPROTECTION_PROTECT_TYPE_RX 1
326#define MLME_SETPROTECTION_PROTECT_TYPE_TX 2
327#define MLME_SETPROTECTION_PROTECT_TYPE_RX_TX 3
328
329#define MLME_SETPROTECTION_KEY_TYPE_GROUP 0
330#define MLME_SETPROTECTION_KEY_TYPE_PAIRWISE 1
331
c746331b 332
70f8cc8e
JM
333/**
334 * enum mfp_options - Management frame protection (IEEE 802.11w) options
335 */
c746331b 336enum mfp_options {
70f8cc8e
JM
337 NO_MGMT_FRAME_PROTECTION = 0,
338 MGMT_FRAME_PROTECTION_OPTIONAL = 1,
62d49803 339 MGMT_FRAME_PROTECTION_REQUIRED = 2,
c746331b 340};
62d49803 341#define MGMT_FRAME_PROTECTION_DEFAULT 3
c746331b 342
e0498677
JM
343/**
344 * enum hostapd_hw_mode - Hardware mode
345 */
71934751 346enum hostapd_hw_mode {
6caf9ca6
JM
347 HOSTAPD_MODE_IEEE80211B,
348 HOSTAPD_MODE_IEEE80211G,
349 HOSTAPD_MODE_IEEE80211A,
7829894c 350 HOSTAPD_MODE_IEEE80211AD,
3784c058 351 HOSTAPD_MODE_IEEE80211ANY,
6caf9ca6 352 NUM_HOSTAPD_MODES
71934751 353};
6caf9ca6 354
9ef1aaae
DW
355/**
356 * enum wpa_ctrl_req_type - Control interface request types
357 */
358enum wpa_ctrl_req_type {
81c57e22 359 WPA_CTRL_REQ_UNKNOWN,
9ef1aaae
DW
360 WPA_CTRL_REQ_EAP_IDENTITY,
361 WPA_CTRL_REQ_EAP_PASSWORD,
362 WPA_CTRL_REQ_EAP_NEW_PASSWORD,
363 WPA_CTRL_REQ_EAP_PIN,
364 WPA_CTRL_REQ_EAP_OTP,
365 WPA_CTRL_REQ_EAP_PASSPHRASE,
a5d44ac0 366 WPA_CTRL_REQ_SIM,
a52410c2 367 WPA_CTRL_REQ_PSK_PASSPHRASE,
3c108b75 368 WPA_CTRL_REQ_EXT_CERT_CHECK,
9ef1aaae
DW
369 NUM_WPA_CTRL_REQS
370};
371
e9447a94
JM
372/* Maximum number of EAP methods to store for EAP server user information */
373#define EAP_MAX_METHODS 8
374
7c7e7877 375enum mesh_plink_state {
d02e5498
JM
376 PLINK_IDLE = 1,
377 PLINK_OPN_SNT,
378 PLINK_OPN_RCVD,
7c7e7877
BC
379 PLINK_CNF_RCVD,
380 PLINK_ESTAB,
381 PLINK_HOLDING,
d02e5498 382 PLINK_BLOCKED, /* not defined in the IEEE 802.11 standard */
7c7e7877
BC
383};
384
844dfeb8
SD
385enum set_band {
386 WPA_SETBAND_AUTO,
387 WPA_SETBAND_5G,
388 WPA_SETBAND_2G
389};
390
2b6e9f91
LD
391enum wpa_radio_work_band {
392 BAND_2_4_GHZ = BIT(0),
393 BAND_5_GHZ = BIT(1),
394 BAND_60_GHZ = BIT(2),
395};
396
29483a56
PK
397enum beacon_rate_type {
398 BEACON_RATE_LEGACY,
399 BEACON_RATE_HT,
400 BEACON_RATE_VHT
401};
402
a6f3761f
PK
403enum eap_proxy_sim_state {
404 SIM_STATE_ERROR,
405};
406
332aadb8
AP
407#define OCE_STA BIT(0)
408#define OCE_STA_CFON BIT(1)
65833d71 409#define OCE_AP BIT(2)
332aadb8 410
89d79150
JM
411/* enum chan_width - Channel width definitions */
412enum chan_width {
413 CHAN_WIDTH_20_NOHT,
414 CHAN_WIDTH_20,
415 CHAN_WIDTH_40,
416 CHAN_WIDTH_80,
417 CHAN_WIDTH_80P80,
418 CHAN_WIDTH_160,
a19277a2
AM
419 CHAN_WIDTH_2160,
420 CHAN_WIDTH_4320,
421 CHAN_WIDTH_6480,
422 CHAN_WIDTH_8640,
89d79150
JM
423 CHAN_WIDTH_UNKNOWN
424};
425
a919a260
AW
426enum key_flag {
427 KEY_FLAG_MODIFY = BIT(0),
428 KEY_FLAG_DEFAULT = BIT(1),
429 KEY_FLAG_RX = BIT(2),
430 KEY_FLAG_TX = BIT(3),
431 KEY_FLAG_GROUP = BIT(4),
432 KEY_FLAG_PAIRWISE = BIT(5),
433 KEY_FLAG_PMK = BIT(6),
434 /* Used flag combinations */
435 KEY_FLAG_RX_TX = KEY_FLAG_RX | KEY_FLAG_TX,
436 KEY_FLAG_GROUP_RX_TX = KEY_FLAG_GROUP | KEY_FLAG_RX_TX,
437 KEY_FLAG_GROUP_RX_TX_DEFAULT = KEY_FLAG_GROUP_RX_TX |
438 KEY_FLAG_DEFAULT,
439 KEY_FLAG_GROUP_RX = KEY_FLAG_GROUP | KEY_FLAG_RX,
440 KEY_FLAG_GROUP_TX_DEFAULT = KEY_FLAG_GROUP | KEY_FLAG_TX |
441 KEY_FLAG_DEFAULT,
442 KEY_FLAG_PAIRWISE_RX_TX = KEY_FLAG_PAIRWISE | KEY_FLAG_RX_TX,
443 KEY_FLAG_PAIRWISE_RX = KEY_FLAG_PAIRWISE | KEY_FLAG_RX,
444 KEY_FLAG_PAIRWISE_RX_TX_MODIFY = KEY_FLAG_PAIRWISE_RX_TX |
445 KEY_FLAG_MODIFY,
446};
447
1a7963e3
AW
448enum ptk0_rekey_handling {
449 PTK0_REKEY_ALLOW_ALWAYS,
450 PTK0_REKEY_ALLOW_LOCAL_OK,
451 PTK0_REKEY_ALLOW_NEVER
452};
453
6fc6879b 454#endif /* DEFS_H */