2 * 802.1x EAPOL definitions
6 * IEEE 802.1X RADIUS Usage Guidelines
8 * Copyright (C) 2002 Broadcom Corporation
16 /* enable structure packing */
18 #define PACKED __attribute__((packed))
24 #include <bcmcrypto/aeskeywrap.h>
26 /* EAPOL for 802.3/Ethernet */
28 struct ether_header eth
; /* 802.3/Ethernet header */
29 unsigned char version
; /* EAPOL protocol version */
30 unsigned char type
; /* EAPOL type */
31 unsigned short length
; /* Length of body */
32 unsigned char body
[1]; /* Body (optional) */
35 #define EAPOL_HEADER_LEN 18
38 #define WPA2_EAPOL_VERSION 2
39 #define WPA_EAPOL_VERSION 1
40 #define LEAP_EAPOL_VERSION 1
41 #define SES_EAPOL_VERSION 1
46 #define EAPOL_LOGOFF 2
51 #define EAPOL_RC4_KEY 1
53 #define EAPOL_WPA2_KEY 2 /* 802.11i/WPA2 */
55 #define EAPOL_WPA_KEY 254 /* WPA */
57 /* RC4 EAPOL-Key header field sizes */
58 #define EAPOL_KEY_REPLAY_LEN 8
59 #define EAPOL_KEY_IV_LEN 16
60 #define EAPOL_KEY_SIG_LEN 16
64 unsigned char type
; /* Key Descriptor Type */
65 unsigned short length
; /* Key Length (unaligned) */
66 unsigned char replay
[EAPOL_KEY_REPLAY_LEN
]; /* Replay Counter */
67 unsigned char iv
[EAPOL_KEY_IV_LEN
]; /* Key IV */
68 unsigned char index
; /* Key Flags & Index */
69 unsigned char signature
[EAPOL_KEY_SIG_LEN
]; /* Key Signature */
70 unsigned char key
[1]; /* Key (optional) */
71 } PACKED eapol_key_header_t
;
73 #define EAPOL_KEY_HEADER_LEN 44
75 /* RC4 EAPOL-Key flags */
76 #define EAPOL_KEY_FLAGS_MASK 0x80
77 #define EAPOL_KEY_BROADCAST 0
78 #define EAPOL_KEY_UNICAST 0x80
80 /* RC4 EAPOL-Key index */
81 #define EAPOL_KEY_INDEX_MASK 0x7f
83 /* WPA/802.11i/WPA2 EAPOL-Key header field sizes */
84 #define EAPOL_WPA_KEY_REPLAY_LEN 8
85 #define EAPOL_WPA_KEY_NONCE_LEN 32
86 #define EAPOL_WPA_KEY_IV_LEN 16
87 #define EAPOL_WPA_KEY_RSC_LEN 8
88 #define EAPOL_WPA_KEY_ID_LEN 8
89 #define EAPOL_WPA_KEY_MIC_LEN 16
90 #define EAPOL_WPA_KEY_DATA_LEN (EAPOL_WPA_MAX_KEY_SIZE + AKW_BLOCK_LEN)
91 #define EAPOL_WPA_MAX_KEY_SIZE 32
95 unsigned char type
; /* Key Descriptor Type */
96 unsigned short key_info
; /* Key Information (unaligned) */
97 unsigned short key_len
; /* Key Length (unaligned) */
98 unsigned char replay
[EAPOL_WPA_KEY_REPLAY_LEN
]; /* Replay Counter */
99 unsigned char nonce
[EAPOL_WPA_KEY_NONCE_LEN
]; /* Nonce */
100 unsigned char iv
[EAPOL_WPA_KEY_IV_LEN
]; /* Key IV */
101 unsigned char rsc
[EAPOL_WPA_KEY_RSC_LEN
]; /* Key RSC */
102 unsigned char id
[EAPOL_WPA_KEY_ID_LEN
]; /* WPA:Key ID, 802.11i/WPA2: Reserved */
103 unsigned char mic
[EAPOL_WPA_KEY_MIC_LEN
]; /* Key MIC */
104 unsigned short data_len
; /* Key Data Length */
105 unsigned char data
[EAPOL_WPA_KEY_DATA_LEN
]; /* Key data */
106 } PACKED eapol_wpa_key_header_t
;
108 #define EAPOL_WPA_KEY_LEN 95
110 /* WPA/802.11i/WPA2 KEY KEY_INFO bits */
111 #define WPA_KEY_DESC_V1 0x01
112 #define WPA_KEY_DESC_V2 0x02
113 #define WPA_KEY_PAIRWISE 0x08
114 #define WPA_KEY_INSTALL 0x40
115 #define WPA_KEY_ACK 0x80
116 #define WPA_KEY_MIC 0x100
117 #define WPA_KEY_SECURE 0x200
118 #define WPA_KEY_ERROR 0x400
119 #define WPA_KEY_REQ 0x800
121 /* WPA-only KEY KEY_INFO bits */
122 #define WPA_KEY_INDEX_0 0x00
123 #define WPA_KEY_INDEX_1 0x10
124 #define WPA_KEY_INDEX_2 0x20
125 #define WPA_KEY_INDEX_3 0x30
126 #define WPA_KEY_INDEX_MASK 0x30
127 #define WPA_KEY_INDEX_SHIFT 0x04
130 /* 802.11i/WPA2-only KEY KEY_INFO bits */
131 #define WPA_KEY_ENCRYPTED_DATA 0x1000
133 /* Key Data encapsulation */
140 } PACKED eapol_wpa2_encap_data_t
;
142 #define EAPOL_WPA2_ENCAP_DATA_HDR_LEN 6
144 #define WPA2_KEY_DATA_SUBTYPE_GTK 1
145 #define WPA2_KEY_DATA_SUBTYPE_STAKEY 2
146 #define WPA2_KEY_DATA_SUBTYPE_MAC 3
147 #define WPA2_KEY_DATA_SUBTYPE_PMKID 4
149 /* GTK encapsulation */
153 uint8 gtk
[EAPOL_WPA_MAX_KEY_SIZE
];
154 } PACKED eapol_wpa2_key_gtk_encap_t
;
156 #define EAPOL_WPA2_KEY_GTK_ENCAP_HDR_LEN 2
158 #define WPA2_GTK_INDEX_MASK 0x03
159 #define WPA2_GTK_INDEX_SHIFT 0x00
161 #define WPA2_GTK_TRANSMIT 0x04
163 /* STAKey encapsulation */
166 uint8 mac
[ETHER_ADDR_LEN
];
167 uint8 stakey
[EAPOL_WPA_MAX_KEY_SIZE
];
168 } PACKED eapol_wpa2_key_stakey_encap_t
;
170 #define WPA2_KEY_DATA_PAD 0xdd
175 #if !defined(__GNUC__)
179 #endif /* _eapol_h_ */