eap_packet.h (2131B)
1/* SPDX-License-Identifier: GPL-2.0 */ 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 9struct ether_hdr { 10 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ 11 unsigned char h_source[ETH_ALEN]; /* source ether addr */ 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; /* packet type ID field */ 17 /* followed by length octets of data */ 18} __packed; 19 20#define ETHER_HDR_SIZE sizeof(struct ether_hdr) 21 22struct ieee802_1x_hdr { 23 unsigned char version; 24 unsigned char type; 25 unsigned short length; 26 /* followed by length octets of data */ 27} __packed; 28 29enum { 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 40struct 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]; /* Reserved in IEEE 802.11i/RSN */ 49 unsigned char key_mic[16]; 50 unsigned short key_data_length; 51 /* followed by key_data_length bytes of key_data */ 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) /* 1 = Pairwise, 0 = Group key */ 58/* bit4..5 is used in WPA, but is reserved in IEEE 802.11i/RSN */ 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) /* pairwise */ 62#define WPA_KEY_INFO_TXRX BIT(6) /* group */ 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) /* IEEE 802.11i/RSN only */ 69 70#endif /* EAP_PACKET_H */