1
2 #ifndef EAP_PACKET_H
3 #define EAP_PACKET_H
4
5 #include <linux/compiler.h>
6 #include <linux/bitops.h>
7 #include <uapi/linux/if_ether.h>
8
9 struct ether_hdr {
10 unsigned char h_dest[ETH_ALEN];
11 unsigned char h_source[ETH_ALEN];
12 unsigned char h_dest_snap;
13 unsigned char h_source_snap;
14 unsigned char h_command;
15 unsigned char h_vendor_id[3];
16 __be16 h_proto;
17
18 } __packed;
19
20 #define ETHER_HDR_SIZE sizeof(struct ether_hdr)
21
22 struct ieee802_1x_hdr {
23 unsigned char version;
24 unsigned char type;
25 unsigned short length;
26
27 } __packed;
28
29 enum {
30 IEEE802_1X_TYPE_EAP_PACKET = 0,
31 IEEE802_1X_TYPE_EAPOL_START = 1,
32 IEEE802_1X_TYPE_EAPOL_LOGOFF = 2,
33 IEEE802_1X_TYPE_EAPOL_KEY = 3,
34 IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT = 4
35 };
36
37 #define WPA_NONCE_LEN 32
38 #define WPA_REPLAY_COUNTER_LEN 8
39
40 struct wpa_eapol_key {
41 unsigned char type;
42 __be16 key_info;
43 unsigned short key_length;
44 unsigned char replay_counter[WPA_REPLAY_COUNTER_LEN];
45 unsigned char key_nonce[WPA_NONCE_LEN];
46 unsigned char key_iv[16];
47 unsigned char key_rsc[8];
48 unsigned char key_id[8];
49 unsigned char key_mic[16];
50 unsigned short key_data_length;
51
52 } __packed;
53
54 #define WPA_KEY_INFO_TYPE_MASK GENMASK(2, 0)
55 #define WPA_KEY_INFO_TYPE_HMAC_MD5_RC4 BIT(0)
56 #define WPA_KEY_INFO_TYPE_HMAC_SHA1_AES BIT(1)
57 #define WPA_KEY_INFO_KEY_TYPE BIT(3)
58
59 #define WPA_KEY_INFO_KEY_INDEX_MASK GENMASK(5, 4)
60 #define WPA_KEY_INFO_KEY_INDEX_SHIFT 4
61 #define WPA_KEY_INFO_INSTALL BIT(6)
62 #define WPA_KEY_INFO_TXRX BIT(6)
63 #define WPA_KEY_INFO_ACK BIT(7)
64 #define WPA_KEY_INFO_MIC BIT(8)
65 #define WPA_KEY_INFO_SECURE BIT(9)
66 #define WPA_KEY_INFO_ERROR BIT(10)
67 #define WPA_KEY_INFO_REQUEST BIT(11)
68 #define WPA_KEY_INFO_ENCR_KEY_DATA BIT(12)
69
70 #endif