2 * 802.1x EAPOL definitions
6 * IEEE 802.1X RADIUS Usage Guidelines
8 * Copyright (C) 2002 Broadcom Corporation
15 /* enable structure packing */
17 #define PACKED __attribute__((packed))
23 #include <bcmcrypto/aeskeywrap.h>
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
52 #define EAPOL_WPA2_KEY 2 /* 802.11i/WPA2 */
54 #define EAPOL_WPA_KEY 254 /* WPA */
56 /* RC4 EAPOL-Key header field sizes */
57 #define EAPOL_KEY_REPLAY_LEN 8
58 #define EAPOL_KEY_IV_LEN 16
59 #define EAPOL_KEY_SIG_LEN 16
63 unsigned char type
; /* Key Descriptor Type */
64 unsigned short length
; /* Key Length (unaligned) */
65 unsigned char replay
[EAPOL_KEY_REPLAY_LEN
]; /* Replay Counter */
66 unsigned char iv
[EAPOL_KEY_IV_LEN
]; /* Key IV */
67 unsigned char index
; /* Key Flags & Index */
68 unsigned char signature
[EAPOL_KEY_SIG_LEN
]; /* Key Signature */
69 unsigned char key
[1]; /* Key (optional) */
70 } PACKED eapol_key_header_t
;
72 #define EAPOL_KEY_HEADER_LEN 44
74 /* RC4 EAPOL-Key flags */
75 #define EAPOL_KEY_FLAGS_MASK 0x80
76 #define EAPOL_KEY_BROADCAST 0
77 #define EAPOL_KEY_UNICAST 0x80
79 /* RC4 EAPOL-Key index */
80 #define EAPOL_KEY_INDEX_MASK 0x7f
82 /* WPA/802.11i/WPA2 EAPOL-Key header field sizes */
83 #define EAPOL_WPA_KEY_REPLAY_LEN 8
84 #define EAPOL_WPA_KEY_NONCE_LEN 32
85 #define EAPOL_WPA_KEY_IV_LEN 16
86 #define EAPOL_WPA_KEY_RSC_LEN 8
87 #define EAPOL_WPA_KEY_ID_LEN 8
88 #define EAPOL_WPA_KEY_MIC_LEN 16
89 #define EAPOL_WPA_KEY_DATA_LEN (EAPOL_WPA_MAX_KEY_SIZE + AKW_BLOCK_LEN)
90 #define EAPOL_WPA_MAX_KEY_SIZE 32
94 unsigned char type
; /* Key Descriptor Type */
95 unsigned short key_info
; /* Key Information (unaligned) */
96 unsigned short key_len
; /* Key Length (unaligned) */
97 unsigned char replay
[EAPOL_WPA_KEY_REPLAY_LEN
]; /* Replay Counter */
98 unsigned char nonce
[EAPOL_WPA_KEY_NONCE_LEN
]; /* Nonce */
99 unsigned char iv
[EAPOL_WPA_KEY_IV_LEN
]; /* Key IV */
100 unsigned char rsc
[EAPOL_WPA_KEY_RSC_LEN
]; /* Key RSC */
101 unsigned char id
[EAPOL_WPA_KEY_ID_LEN
]; /* WPA:Key ID, 802.11i/WPA2: Reserved */
102 unsigned char mic
[EAPOL_WPA_KEY_MIC_LEN
]; /* Key MIC */
103 unsigned short data_len
; /* Key Data Length */
104 unsigned char data
[EAPOL_WPA_KEY_DATA_LEN
]; /* Key data */
105 } PACKED eapol_wpa_key_header_t
;
107 #define EAPOL_WPA_KEY_LEN 95
109 /* WPA/802.11i/WPA2 KEY KEY_INFO bits */
110 #define WPA_KEY_DESC_V1 0x01
111 #define WPA_KEY_DESC_V2 0x02
112 #define WPA_KEY_PAIRWISE 0x08
113 #define WPA_KEY_INSTALL 0x40
114 #define WPA_KEY_ACK 0x80
115 #define WPA_KEY_MIC 0x100
116 #define WPA_KEY_SECURE 0x200
117 #define WPA_KEY_ERROR 0x400
118 #define WPA_KEY_REQ 0x800
120 /* WPA-only KEY KEY_INFO bits */
121 #define WPA_KEY_INDEX_0 0x00
122 #define WPA_KEY_INDEX_1 0x10
123 #define WPA_KEY_INDEX_2 0x20
124 #define WPA_KEY_INDEX_3 0x30
125 #define WPA_KEY_INDEX_MASK 0x30
126 #define WPA_KEY_INDEX_SHIFT 0x04
129 /* 802.11i/WPA2-only KEY KEY_INFO bits */
130 #define WPA_KEY_ENCRYPTED_DATA 0x1000
132 /* Key Data encapsulation */
139 } PACKED eapol_wpa2_encap_data_t
;
141 #define EAPOL_WPA2_ENCAP_DATA_HDR_LEN 6
143 #define WPA2_KEY_DATA_SUBTYPE_GTK 1
144 #define WPA2_KEY_DATA_SUBTYPE_STAKEY 2
145 #define WPA2_KEY_DATA_SUBTYPE_MAC 3
146 #define WPA2_KEY_DATA_SUBTYPE_PMKID 4
148 /* GTK encapsulation */
152 uint8 gtk
[EAPOL_WPA_MAX_KEY_SIZE
];
153 } PACKED eapol_wpa2_key_gtk_encap_t
;
155 #define EAPOL_WPA2_KEY_GTK_ENCAP_HDR_LEN 2
157 #define WPA2_GTK_INDEX_MASK 0x03
158 #define WPA2_GTK_INDEX_SHIFT 0x00
160 #define WPA2_GTK_TRANSMIT 0x04
162 /* STAKey encapsulation */
165 uint8 mac
[ETHER_ADDR_LEN
];
166 uint8 stakey
[EAPOL_WPA_MAX_KEY_SIZE
];
167 } PACKED eapol_wpa2_key_stakey_encap_t
;
169 #define WPA2_KEY_DATA_PAD 0xdd
174 #if !defined(__GNUC__)
178 #endif /* _eapol_h_ */