2 * 802.1x EAPOL definitions
6 * IEEE 802.1X RADIUS Usage Guidelines
8 * Copyright (C) 2002 Broadcom Corporation
10 * $Id: eapol.h,v 9.18.260.1.2.1.6.6 2009/04/08 05:00:08 Exp $
20 /* This marks the start of a packed structure section. */
21 #include <packed_section_start.h>
23 #define AKW_BLOCK_LEN 8 /* The only def we need here */
25 /* EAPOL for 802.3/Ethernet */
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) */
34 #define EAPOL_HEADER_LEN 18
37 #define WPA2_EAPOL_VERSION 2
38 #define WPA_EAPOL_VERSION 1
39 #define LEAP_EAPOL_VERSION 1
40 #define SES_EAPOL_VERSION 1
45 #define EAPOL_LOGOFF 2
50 #define EAPOL_RC4_KEY 1
51 #define EAPOL_WPA2_KEY 2 /* 802.11i/WPA2 */
52 #define EAPOL_WPA_KEY 254 /* WPA */
54 /* RC4 EAPOL-Key header field sizes */
55 #define EAPOL_KEY_REPLAY_LEN 8
56 #define EAPOL_KEY_IV_LEN 16
57 #define EAPOL_KEY_SIG_LEN 16
60 typedef BWL_PRE_PACKED_STRUCT struct {
61 unsigned char type; /* Key Descriptor Type */
62 unsigned short length; /* Key Length (unaligned) */
63 unsigned char replay[EAPOL_KEY_REPLAY_LEN]; /* Replay Counter */
64 unsigned char iv[EAPOL_KEY_IV_LEN]; /* Key IV */
65 unsigned char index; /* Key Flags & Index */
66 unsigned char signature[EAPOL_KEY_SIG_LEN]; /* Key Signature */
67 unsigned char key[1]; /* Key (optional) */
68 } BWL_POST_PACKED_STRUCT eapol_key_header_t;
70 #define EAPOL_KEY_HEADER_LEN 44
72 /* RC4 EAPOL-Key flags */
73 #define EAPOL_KEY_FLAGS_MASK 0x80
74 #define EAPOL_KEY_BROADCAST 0
75 #define EAPOL_KEY_UNICAST 0x80
77 /* RC4 EAPOL-Key index */
78 #define EAPOL_KEY_INDEX_MASK 0x7f
80 /* WPA/802.11i/WPA2 EAPOL-Key header field sizes */
81 #define EAPOL_WPA_KEY_REPLAY_LEN 8
82 #define EAPOL_WPA_KEY_NONCE_LEN 32
83 #define EAPOL_WPA_KEY_IV_LEN 16
84 #define EAPOL_WPA_KEY_ID_LEN 8
85 #define EAPOL_WPA_KEY_RSC_LEN 8
86 #define EAPOL_WPA_KEY_MIC_LEN 16
87 #define EAPOL_WPA_KEY_DATA_LEN (EAPOL_WPA_MAX_KEY_SIZE + AKW_BLOCK_LEN)
88 #define EAPOL_WPA_MAX_KEY_SIZE 32
91 typedef BWL_PRE_PACKED_STRUCT struct {
92 unsigned char type; /* Key Descriptor Type */
93 unsigned short key_info; /* Key Information (unaligned) */
94 unsigned short key_len; /* Key Length (unaligned) */
95 unsigned char replay[EAPOL_WPA_KEY_REPLAY_LEN]; /* Replay Counter */
96 unsigned char nonce[EAPOL_WPA_KEY_NONCE_LEN]; /* Nonce */
97 unsigned char iv[EAPOL_WPA_KEY_IV_LEN]; /* Key IV */
98 unsigned char rsc[EAPOL_WPA_KEY_RSC_LEN]; /* Key RSC */
99 unsigned char id[EAPOL_WPA_KEY_ID_LEN]; /* WPA:Key ID, 802.11i/WPA2: Reserved */
100 unsigned char mic[EAPOL_WPA_KEY_MIC_LEN]; /* Key MIC */
101 unsigned short data_len; /* Key Data Length */
102 unsigned char data[EAPOL_WPA_KEY_DATA_LEN]; /* Key data */
103 } BWL_POST_PACKED_STRUCT eapol_wpa_key_header_t;
105 #define EAPOL_WPA_KEY_LEN 95
107 /* WPA/802.11i/WPA2 KEY KEY_INFO bits */
108 #define WPA_KEY_DESC_V1 0x01
109 #define WPA_KEY_DESC_V2 0x02
110 #define WPA_KEY_PAIRWISE 0x08
111 #define WPA_KEY_INSTALL 0x40
112 #define WPA_KEY_ACK 0x80
113 #define WPA_KEY_MIC 0x100
114 #define WPA_KEY_SECURE 0x200
115 #define WPA_KEY_ERROR 0x400
116 #define WPA_KEY_REQ 0x800
118 /* WPA-only KEY KEY_INFO bits */
119 #define WPA_KEY_INDEX_0 0x00
120 #define WPA_KEY_INDEX_1 0x10
121 #define WPA_KEY_INDEX_2 0x20
122 #define WPA_KEY_INDEX_3 0x30
123 #define WPA_KEY_INDEX_MASK 0x30
124 #define WPA_KEY_INDEX_SHIFT 0x04
126 /* 802.11i/WPA2-only KEY KEY_INFO bits */
127 #define WPA_KEY_ENCRYPTED_DATA 0x1000
129 /* Key Data encapsulation */
130 typedef BWL_PRE_PACKED_STRUCT struct {
136 } BWL_POST_PACKED_STRUCT eapol_wpa2_encap_data_t;
138 #define EAPOL_WPA2_ENCAP_DATA_HDR_LEN 6
140 #define WPA2_KEY_DATA_SUBTYPE_GTK 1
141 #define WPA2_KEY_DATA_SUBTYPE_STAKEY 2
142 #define WPA2_KEY_DATA_SUBTYPE_MAC 3
143 #define WPA2_KEY_DATA_SUBTYPE_PMKID 4
145 /* GTK encapsulation */
146 typedef BWL_PRE_PACKED_STRUCT struct {
149 uint8 gtk[EAPOL_WPA_MAX_KEY_SIZE];
150 } BWL_POST_PACKED_STRUCT eapol_wpa2_key_gtk_encap_t;
152 #define EAPOL_WPA2_KEY_GTK_ENCAP_HDR_LEN 2
154 #define WPA2_GTK_INDEX_MASK 0x03
155 #define WPA2_GTK_INDEX_SHIFT 0x00
157 #define WPA2_GTK_TRANSMIT 0x04
159 /* STAKey encapsulation */
160 typedef BWL_PRE_PACKED_STRUCT struct {
162 uint8 mac[ETHER_ADDR_LEN];
163 uint8 stakey[EAPOL_WPA_MAX_KEY_SIZE];
164 } BWL_POST_PACKED_STRUCT eapol_wpa2_key_stakey_encap_t;
166 #define WPA2_KEY_DATA_PAD 0xdd
169 /* This marks the end of a packed structure section. */
170 #include <packed_section_end.h>
172 #endif /* _eapol_h_ */