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 */
29 #define EAPOL_VERSION 2
31 enum { IEEE802_1X_TYPE_EAP_PACKET = 0,
32 IEEE802_1X_TYPE_EAPOL_START = 1,
33 IEEE802_1X_TYPE_EAPOL_LOGOFF = 2,
34 IEEE802_1X_TYPE_EAPOL_KEY = 3,
35 IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT = 4
38 enum { EAPOL_KEY_TYPE_RC4 = 1, EAPOL_KEY_TYPE_RSN = 2,
39 EAPOL_KEY_TYPE_WPA = 254 };
42 #define IEEE8021X_REPLAY_COUNTER_LEN 8
43 #define IEEE8021X_KEY_SIGN_LEN 16
44 #define IEEE8021X_KEY_IV_LEN 16
46 #define IEEE8021X_KEY_INDEX_FLAG 0x80
47 #define IEEE8021X_KEY_INDEX_MASK 0x03
53 struct ieee802_1x_eapol_key {
55 /* Note: key_length is unaligned */
57 /* does not repeat within the life of the keying material used to
58 * encrypt the Key field; 64-bit NTP timestamp MAY be used here */
59 u8 replay_counter[IEEE8021X_REPLAY_COUNTER_LEN];
60 u8 key_iv[IEEE8021X_KEY_IV_LEN]; /* cryptographically random number */
61 u8 key_index; /* key flag in the most significant bit:
62 * 0 = broadcast (default key),
63 * 1 = unicast (key mapping key); key index is in the
64 * 7 least significant bits */
65 /* HMAC-MD5 message integrity check computed with MS-MPPE-Send-Key as
67 u8 key_signature[IEEE8021X_KEY_SIGN_LEN];
69 /* followed by key: if packet body length = 44 + key length, then the
70 * key field (of key_length bytes) contains the key in encrypted form;
71 * if packet body length = 44, key field is absent and key_length
72 * represents the number of least significant octets from
73 * MS-MPPE-Send-Key attribute to be used as the keying material;
74 * RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key */
81 #endif /* EAPOL_COMMON_H */