2 * 802.1x EAPOL definitions
6 * IEEE 802.1X RADIUS Usage Guidelines
8 * Copyright (C) 2002 Broadcom Corporation
10 * $Id: eapol.h 241182 2011-02-17 21:50:03Z $
20 /* This marks the start of a packed structure section. */
21 #include <packed_section_start.h>
23 #include <bcmcrypto/aeskeywrap.h>
25 /* EAPOL for 802.3/Ethernet */
26 typedef BWL_PRE_PACKED_STRUCT
struct {
27 struct ether_header eth
; /* 802.3/Ethernet header */
28 unsigned char version
; /* EAPOL protocol version */
29 unsigned char type
; /* EAPOL type */
30 unsigned short length
; /* Length of body */
31 unsigned char body
[1]; /* Body (optional) */
32 } BWL_POST_PACKED_STRUCT eapol_header_t
;
34 #define EAPOL_HEADER_LEN 18
37 unsigned char version
; /* EAPOL protocol version */
38 unsigned char type
; /* EAPOL type */
39 unsigned short length
; /* Length of body */
42 #define EAPOL_HDR_LEN 4
45 #define WPA2_EAPOL_VERSION 2
46 #define WPA_EAPOL_VERSION 1
47 #define LEAP_EAPOL_VERSION 1
48 #define SES_EAPOL_VERSION 1
53 #define EAPOL_LOGOFF 2
58 #define EAPOL_RC4_KEY 1
59 #define EAPOL_WPA2_KEY 2 /* 802.11i/WPA2 */
60 #define EAPOL_WPA_KEY 254 /* WPA */
62 /* RC4 EAPOL-Key header field sizes */
63 #define EAPOL_KEY_REPLAY_LEN 8
64 #define EAPOL_KEY_IV_LEN 16
65 #define EAPOL_KEY_SIG_LEN 16
68 typedef BWL_PRE_PACKED_STRUCT
struct {
69 unsigned char type
; /* Key Descriptor Type */
70 unsigned short length
; /* Key Length (unaligned) */
71 unsigned char replay
[EAPOL_KEY_REPLAY_LEN
]; /* Replay Counter */
72 unsigned char iv
[EAPOL_KEY_IV_LEN
]; /* Key IV */
73 unsigned char index
; /* Key Flags & Index */
74 unsigned char signature
[EAPOL_KEY_SIG_LEN
]; /* Key Signature */
75 unsigned char key
[1]; /* Key (optional) */
76 } BWL_POST_PACKED_STRUCT eapol_key_header_t
;
78 #define EAPOL_KEY_HEADER_LEN 44
80 /* RC4 EAPOL-Key flags */
81 #define EAPOL_KEY_FLAGS_MASK 0x80
82 #define EAPOL_KEY_BROADCAST 0
83 #define EAPOL_KEY_UNICAST 0x80
85 /* RC4 EAPOL-Key index */
86 #define EAPOL_KEY_INDEX_MASK 0x7f
88 /* WPA/802.11i/WPA2 EAPOL-Key header field sizes */
89 #define EAPOL_WPA_KEY_REPLAY_LEN 8
90 #define EAPOL_WPA_KEY_NONCE_LEN 32
91 #define EAPOL_WPA_KEY_IV_LEN 16
92 #define EAPOL_WPA_KEY_RSC_LEN 8
93 #define EAPOL_WPA_KEY_ID_LEN 8
94 #define EAPOL_WPA_KEY_MIC_LEN 16
95 #define EAPOL_WPA_KEY_DATA_LEN (EAPOL_WPA_MAX_KEY_SIZE + AKW_BLOCK_LEN)
96 #define EAPOL_WPA_MAX_KEY_SIZE 32
99 typedef BWL_PRE_PACKED_STRUCT
struct {
100 unsigned char type
; /* Key Descriptor Type */
101 unsigned short key_info
; /* Key Information (unaligned) */
102 unsigned short key_len
; /* Key Length (unaligned) */
103 unsigned char replay
[EAPOL_WPA_KEY_REPLAY_LEN
]; /* Replay Counter */
104 unsigned char nonce
[EAPOL_WPA_KEY_NONCE_LEN
]; /* Nonce */
105 unsigned char iv
[EAPOL_WPA_KEY_IV_LEN
]; /* Key IV */
106 unsigned char rsc
[EAPOL_WPA_KEY_RSC_LEN
]; /* Key RSC */
107 unsigned char id
[EAPOL_WPA_KEY_ID_LEN
]; /* WPA:Key ID, 802.11i/WPA2: Reserved */
108 unsigned char mic
[EAPOL_WPA_KEY_MIC_LEN
]; /* Key MIC */
109 unsigned short data_len
; /* Key Data Length */
110 unsigned char data
[EAPOL_WPA_KEY_DATA_LEN
]; /* Key data */
111 } BWL_POST_PACKED_STRUCT eapol_wpa_key_header_t
;
113 #define EAPOL_WPA_KEY_LEN 95
115 /* WPA/802.11i/WPA2 KEY KEY_INFO bits */
116 #define WPA_KEY_DESC_V1 0x01
117 #define WPA_KEY_DESC_V2 0x02
118 #define WPA_KEY_DESC_V3 0x03
119 #define WPA_KEY_PAIRWISE 0x08
120 #define WPA_KEY_INSTALL 0x40
121 #define WPA_KEY_ACK 0x80
122 #define WPA_KEY_MIC 0x100
123 #define WPA_KEY_SECURE 0x200
124 #define WPA_KEY_ERROR 0x400
125 #define WPA_KEY_REQ 0x800
127 #define WPA_KEY_DESC_V2_OR_V3 WPA_KEY_DESC_V2
129 /* WPA-only KEY KEY_INFO bits */
130 #define WPA_KEY_INDEX_0 0x00
131 #define WPA_KEY_INDEX_1 0x10
132 #define WPA_KEY_INDEX_2 0x20
133 #define WPA_KEY_INDEX_3 0x30
134 #define WPA_KEY_INDEX_MASK 0x30
135 #define WPA_KEY_INDEX_SHIFT 0x04
137 /* 802.11i/WPA2-only KEY KEY_INFO bits */
138 #define WPA_KEY_ENCRYPTED_DATA 0x1000
140 /* Key Data encapsulation */
141 typedef BWL_PRE_PACKED_STRUCT
struct {
147 } BWL_POST_PACKED_STRUCT eapol_wpa2_encap_data_t
;
149 #define EAPOL_WPA2_ENCAP_DATA_HDR_LEN 6
151 #define WPA2_KEY_DATA_SUBTYPE_GTK 1
152 #define WPA2_KEY_DATA_SUBTYPE_STAKEY 2
153 #define WPA2_KEY_DATA_SUBTYPE_MAC 3
154 #define WPA2_KEY_DATA_SUBTYPE_PMKID 4
155 #define WPA2_KEY_DATA_SUBTYPE_IGTK 9
157 /* GTK encapsulation */
158 typedef BWL_PRE_PACKED_STRUCT
struct {
161 uint8 gtk
[EAPOL_WPA_MAX_KEY_SIZE
];
162 } BWL_POST_PACKED_STRUCT eapol_wpa2_key_gtk_encap_t
;
164 #define EAPOL_WPA2_KEY_GTK_ENCAP_HDR_LEN 2
166 #define WPA2_GTK_INDEX_MASK 0x03
167 #define WPA2_GTK_INDEX_SHIFT 0x00
169 #define WPA2_GTK_TRANSMIT 0x04
171 /* IGTK encapsulation */
172 typedef BWL_PRE_PACKED_STRUCT
struct {
175 uint8 key
[EAPOL_WPA_MAX_KEY_SIZE
];
176 } BWL_POST_PACKED_STRUCT eapol_wpa2_key_igtk_encap_t
;
178 #define EAPOL_WPA2_KEY_IGTK_ENCAP_HDR_LEN 8
180 /* STAKey encapsulation */
181 typedef BWL_PRE_PACKED_STRUCT
struct {
183 uint8 mac
[ETHER_ADDR_LEN
];
184 uint8 stakey
[EAPOL_WPA_MAX_KEY_SIZE
];
185 } BWL_POST_PACKED_STRUCT eapol_wpa2_key_stakey_encap_t
;
187 #define WPA2_KEY_DATA_PAD 0xdd
190 /* This marks the end of a packed structure section. */
191 #include <packed_section_end.h>
193 #endif /* _eapol_h_ */