2 * EAPOL definitions shared between hostapd and wpa_supplicant
3 * Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
10 #define EAPOL_COMMON_H
12 /* IEEE Std 802.1X-2004 */
18 struct ieee802_1x_hdr
{
22 /* followed by length octets of data */
36 #define EAPOL_VERSION 3
37 #else /* CONFIG_MACSEC */
38 #define EAPOL_VERSION 2
39 #endif /* CONFIG_MACSEC */
41 enum { IEEE802_1X_TYPE_EAP_PACKET
= 0,
42 IEEE802_1X_TYPE_EAPOL_START
= 1,
43 IEEE802_1X_TYPE_EAPOL_LOGOFF
= 2,
44 IEEE802_1X_TYPE_EAPOL_KEY
= 3,
45 IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT
= 4,
46 IEEE802_1X_TYPE_EAPOL_MKA
= 5,
49 enum { EAPOL_KEY_TYPE_RC4
= 1, EAPOL_KEY_TYPE_RSN
= 2,
50 EAPOL_KEY_TYPE_WPA
= 254 };
53 #define IEEE8021X_REPLAY_COUNTER_LEN 8
54 #define IEEE8021X_KEY_SIGN_LEN 16
55 #define IEEE8021X_KEY_IV_LEN 16
57 #define IEEE8021X_KEY_INDEX_FLAG 0x80
58 #define IEEE8021X_KEY_INDEX_MASK 0x03
64 struct ieee802_1x_eapol_key
{
66 /* Note: key_length is unaligned */
68 /* does not repeat within the life of the keying material used to
69 * encrypt the Key field; 64-bit NTP timestamp MAY be used here */
70 u8 replay_counter
[IEEE8021X_REPLAY_COUNTER_LEN
];
71 u8 key_iv
[IEEE8021X_KEY_IV_LEN
]; /* cryptographically random number */
72 u8 key_index
; /* key flag in the most significant bit:
73 * 0 = broadcast (default key),
74 * 1 = unicast (key mapping key); key index is in the
75 * 7 least significant bits */
76 /* HMAC-MD5 message integrity check computed with MS-MPPE-Send-Key as
78 u8 key_signature
[IEEE8021X_KEY_SIGN_LEN
];
80 /* followed by key: if packet body length = 44 + key length, then the
81 * key field (of key_length bytes) contains the key in encrypted form;
82 * if packet body length = 44, key field is absent and key_length
83 * represents the number of least significant octets from
84 * MS-MPPE-Send-Key attribute to be used as the keying material;
85 * RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key */
92 #endif /* EAPOL_COMMON_H */