ieee802_1x.h revision 8d520ff1dc2da35cdca849e982051b86468016d8
1/* 2 * hostapd / IEEE 802.1X-2004 Authenticator 3 * Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License version 2 as 7 * published by the Free Software Foundation. 8 * 9 * Alternatively, this software may be distributed under the terms of BSD 10 * license. 11 * 12 * See README and COPYING for more details. 13 */ 14 15#ifndef IEEE802_1X_H 16#define IEEE802_1X_H 17 18struct hostapd_data; 19struct sta_info; 20struct eapol_state_machine; 21struct hostapd_config; 22struct hostapd_bss_config; 23 24#ifdef _MSC_VER 25#pragma pack(push, 1) 26#endif /* _MSC_VER */ 27 28/* RFC 3580, 4. RC4 EAPOL-Key Frame */ 29 30struct ieee802_1x_eapol_key { 31 u8 type; 32 u16 key_length; 33 u8 replay_counter[8]; /* does not repeat within the life of the keying 34 * material used to encrypt the Key field; 35 * 64-bit NTP timestamp MAY be used here */ 36 u8 key_iv[16]; /* cryptographically random number */ 37 u8 key_index; /* key flag in the most significant bit: 38 * 0 = broadcast (default key), 39 * 1 = unicast (key mapping key); key index is in the 40 * 7 least significant bits */ 41 u8 key_signature[16]; /* HMAC-MD5 message integrity check computed with 42 * MS-MPPE-Send-Key as the key */ 43 44 /* followed by key: if packet body length = 44 + key length, then the 45 * key field (of key_length bytes) contains the key in encrypted form; 46 * if packet body length = 44, key field is absent and key_length 47 * represents the number of least significant octets from 48 * MS-MPPE-Send-Key attribute to be used as the keying material; 49 * RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key */ 50} STRUCT_PACKED; 51 52#ifdef _MSC_VER 53#pragma pack(pop) 54#endif /* _MSC_VER */ 55 56 57void ieee802_1x_receive(struct hostapd_data *hapd, const u8 *sa, const u8 *buf, 58 size_t len); 59void ieee802_1x_new_station(struct hostapd_data *hapd, struct sta_info *sta); 60void ieee802_1x_free_station(struct sta_info *sta); 61 62void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta); 63void ieee802_1x_abort_auth(struct hostapd_data *hapd, struct sta_info *sta); 64void ieee802_1x_set_sta_authorized(struct hostapd_data *hapd, 65 struct sta_info *sta, int authorized); 66void ieee802_1x_dump_state(FILE *f, const char *prefix, struct sta_info *sta); 67int ieee802_1x_init(struct hostapd_data *hapd); 68void ieee802_1x_deinit(struct hostapd_data *hapd); 69int ieee802_1x_tx_status(struct hostapd_data *hapd, struct sta_info *sta, 70 const u8 *buf, size_t len, int ack); 71u8 * ieee802_1x_get_identity(struct eapol_state_machine *sm, size_t *len); 72u8 * ieee802_1x_get_radius_class(struct eapol_state_machine *sm, size_t *len, 73 int idx); 74const u8 * ieee802_1x_get_key(struct eapol_state_machine *sm, size_t *len); 75void ieee802_1x_notify_port_enabled(struct eapol_state_machine *sm, 76 int enabled); 77void ieee802_1x_notify_port_valid(struct eapol_state_machine *sm, 78 int valid); 79void ieee802_1x_notify_pre_auth(struct eapol_state_machine *sm, int pre_auth); 80int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen); 81int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta, 82 char *buf, size_t buflen); 83void hostapd_get_ntp_timestamp(u8 *buf); 84char *eap_type_text(u8 type); 85 86const char *radius_mode_txt(struct hostapd_data *hapd); 87int radius_sta_rate(struct hostapd_data *hapd, struct sta_info *sta); 88 89#endif /* IEEE802_1X_H */ 90