1e5b75505Sopenharmony_ci/* 2e5b75505Sopenharmony_ci * EAPOL definitions shared between hostapd and wpa_supplicant 3e5b75505Sopenharmony_ci * Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi> 4e5b75505Sopenharmony_ci * 5e5b75505Sopenharmony_ci * This software may be distributed under the terms of the BSD license. 6e5b75505Sopenharmony_ci * See README for more details. 7e5b75505Sopenharmony_ci */ 8e5b75505Sopenharmony_ci 9e5b75505Sopenharmony_ci#ifndef EAPOL_COMMON_H 10e5b75505Sopenharmony_ci#define EAPOL_COMMON_H 11e5b75505Sopenharmony_ci 12e5b75505Sopenharmony_ci/* IEEE Std 802.1X-2004 */ 13e5b75505Sopenharmony_ci 14e5b75505Sopenharmony_ci#ifdef _MSC_VER 15e5b75505Sopenharmony_ci#pragma pack(push, 1) 16e5b75505Sopenharmony_ci#endif /* _MSC_VER */ 17e5b75505Sopenharmony_ci 18e5b75505Sopenharmony_cistruct ieee802_1x_hdr { 19e5b75505Sopenharmony_ci u8 version; 20e5b75505Sopenharmony_ci u8 type; 21e5b75505Sopenharmony_ci be16 length; 22e5b75505Sopenharmony_ci /* followed by length octets of data */ 23e5b75505Sopenharmony_ci} STRUCT_PACKED; 24e5b75505Sopenharmony_ci 25e5b75505Sopenharmony_cistruct ieee8023_hdr { 26e5b75505Sopenharmony_ci u8 dest[ETH_ALEN]; 27e5b75505Sopenharmony_ci u8 src[ETH_ALEN]; 28e5b75505Sopenharmony_ci be16 ethertype; 29e5b75505Sopenharmony_ci} STRUCT_PACKED; 30e5b75505Sopenharmony_ci 31e5b75505Sopenharmony_ci#ifdef _MSC_VER 32e5b75505Sopenharmony_ci#pragma pack(pop) 33e5b75505Sopenharmony_ci#endif /* _MSC_VER */ 34e5b75505Sopenharmony_ci 35e5b75505Sopenharmony_ci#ifdef CONFIG_MACSEC 36e5b75505Sopenharmony_ci#define EAPOL_VERSION 3 37e5b75505Sopenharmony_ci#else /* CONFIG_MACSEC */ 38e5b75505Sopenharmony_ci#define EAPOL_VERSION 2 39e5b75505Sopenharmony_ci#endif /* CONFIG_MACSEC */ 40e5b75505Sopenharmony_ci 41e5b75505Sopenharmony_cienum { IEEE802_1X_TYPE_EAP_PACKET = 0, 42e5b75505Sopenharmony_ci IEEE802_1X_TYPE_EAPOL_START = 1, 43e5b75505Sopenharmony_ci IEEE802_1X_TYPE_EAPOL_LOGOFF = 2, 44e5b75505Sopenharmony_ci IEEE802_1X_TYPE_EAPOL_KEY = 3, 45e5b75505Sopenharmony_ci IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT = 4, 46e5b75505Sopenharmony_ci IEEE802_1X_TYPE_EAPOL_MKA = 5, 47e5b75505Sopenharmony_ci}; 48e5b75505Sopenharmony_ci 49e5b75505Sopenharmony_cienum { EAPOL_KEY_TYPE_RC4 = 1, EAPOL_KEY_TYPE_RSN = 2, 50e5b75505Sopenharmony_ci EAPOL_KEY_TYPE_WPA = 254 }; 51e5b75505Sopenharmony_ci 52e5b75505Sopenharmony_ci 53e5b75505Sopenharmony_ci#define IEEE8021X_REPLAY_COUNTER_LEN 8 54e5b75505Sopenharmony_ci#define IEEE8021X_KEY_SIGN_LEN 16 55e5b75505Sopenharmony_ci#define IEEE8021X_KEY_IV_LEN 16 56e5b75505Sopenharmony_ci 57e5b75505Sopenharmony_ci#define IEEE8021X_KEY_INDEX_FLAG 0x80 58e5b75505Sopenharmony_ci#define IEEE8021X_KEY_INDEX_MASK 0x03 59e5b75505Sopenharmony_ci 60e5b75505Sopenharmony_ci#ifdef _MSC_VER 61e5b75505Sopenharmony_ci#pragma pack(push, 1) 62e5b75505Sopenharmony_ci#endif /* _MSC_VER */ 63e5b75505Sopenharmony_ci 64e5b75505Sopenharmony_cistruct ieee802_1x_eapol_key { 65e5b75505Sopenharmony_ci u8 type; 66e5b75505Sopenharmony_ci /* Note: key_length is unaligned */ 67e5b75505Sopenharmony_ci u8 key_length[2]; 68e5b75505Sopenharmony_ci /* does not repeat within the life of the keying material used to 69e5b75505Sopenharmony_ci * encrypt the Key field; 64-bit NTP timestamp MAY be used here */ 70e5b75505Sopenharmony_ci u8 replay_counter[IEEE8021X_REPLAY_COUNTER_LEN]; 71e5b75505Sopenharmony_ci u8 key_iv[IEEE8021X_KEY_IV_LEN]; /* cryptographically random number */ 72e5b75505Sopenharmony_ci u8 key_index; /* key flag in the most significant bit: 73e5b75505Sopenharmony_ci * 0 = broadcast (default key), 74e5b75505Sopenharmony_ci * 1 = unicast (key mapping key); key index is in the 75e5b75505Sopenharmony_ci * 7 least significant bits */ 76e5b75505Sopenharmony_ci /* HMAC-MD5 message integrity check computed with MS-MPPE-Send-Key as 77e5b75505Sopenharmony_ci * the key */ 78e5b75505Sopenharmony_ci u8 key_signature[IEEE8021X_KEY_SIGN_LEN]; 79e5b75505Sopenharmony_ci 80e5b75505Sopenharmony_ci /* followed by key: if packet body length = 44 + key length, then the 81e5b75505Sopenharmony_ci * key field (of key_length bytes) contains the key in encrypted form; 82e5b75505Sopenharmony_ci * if packet body length = 44, key field is absent and key_length 83e5b75505Sopenharmony_ci * represents the number of least significant octets from 84e5b75505Sopenharmony_ci * MS-MPPE-Send-Key attribute to be used as the keying material; 85e5b75505Sopenharmony_ci * RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key */ 86e5b75505Sopenharmony_ci} STRUCT_PACKED; 87e5b75505Sopenharmony_ci 88e5b75505Sopenharmony_ci#ifdef _MSC_VER 89e5b75505Sopenharmony_ci#pragma pack(pop) 90e5b75505Sopenharmony_ci#endif /* _MSC_VER */ 91e5b75505Sopenharmony_ci 92e5b75505Sopenharmony_ci#endif /* EAPOL_COMMON_H */ 93