$search
00001 /* 00002 * hostapd / IEEE 802.1X-2004 Authenticator 00003 * Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation. 00008 * 00009 * Alternatively, this software may be distributed under the terms of BSD 00010 * license. 00011 * 00012 * See README and COPYING for more details. 00013 */ 00014 00015 #ifndef IEEE802_1X_H 00016 #define IEEE802_1X_H 00017 00018 struct hostapd_data; 00019 struct sta_info; 00020 struct eapol_state_machine; 00021 struct hostapd_config; 00022 struct hostapd_bss_config; 00023 00024 #ifdef _MSC_VER 00025 #pragma pack(push, 1) 00026 #endif /* _MSC_VER */ 00027 00028 /* RFC 3580, 4. RC4 EAPOL-Key Frame */ 00029 00030 struct ieee802_1x_eapol_key { 00031 u8 type; 00032 u16 key_length; 00033 u8 replay_counter[8]; /* does not repeat within the life of the keying 00034 * material used to encrypt the Key field; 00035 * 64-bit NTP timestamp MAY be used here */ 00036 u8 key_iv[16]; /* cryptographically random number */ 00037 u8 key_index; /* key flag in the most significant bit: 00038 * 0 = broadcast (default key), 00039 * 1 = unicast (key mapping key); key index is in the 00040 * 7 least significant bits */ 00041 u8 key_signature[16]; /* HMAC-MD5 message integrity check computed with 00042 * MS-MPPE-Send-Key as the key */ 00043 00044 /* followed by key: if packet body length = 44 + key length, then the 00045 * key field (of key_length bytes) contains the key in encrypted form; 00046 * if packet body length = 44, key field is absent and key_length 00047 * represents the number of least significant octets from 00048 * MS-MPPE-Send-Key attribute to be used as the keying material; 00049 * RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key */ 00050 } STRUCT_PACKED; 00051 00052 #ifdef _MSC_VER 00053 #pragma pack(pop) 00054 #endif /* _MSC_VER */ 00055 00056 00057 void ieee802_1x_receive(struct hostapd_data *hapd, const u8 *sa, const u8 *buf, 00058 size_t len); 00059 void ieee802_1x_new_station(struct hostapd_data *hapd, struct sta_info *sta); 00060 void ieee802_1x_free_station(struct sta_info *sta); 00061 00062 void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta); 00063 void ieee802_1x_abort_auth(struct hostapd_data *hapd, struct sta_info *sta); 00064 void ieee802_1x_set_sta_authorized(struct hostapd_data *hapd, 00065 struct sta_info *sta, int authorized); 00066 void ieee802_1x_dump_state(FILE *f, const char *prefix, struct sta_info *sta); 00067 int ieee802_1x_init(struct hostapd_data *hapd); 00068 void ieee802_1x_deinit(struct hostapd_data *hapd); 00069 int ieee802_1x_tx_status(struct hostapd_data *hapd, struct sta_info *sta, 00070 const u8 *buf, size_t len, int ack); 00071 u8 * ieee802_1x_get_identity(struct eapol_state_machine *sm, size_t *len); 00072 u8 * ieee802_1x_get_radius_class(struct eapol_state_machine *sm, size_t *len, 00073 int idx); 00074 const u8 * ieee802_1x_get_key(struct eapol_state_machine *sm, size_t *len); 00075 void ieee802_1x_notify_port_enabled(struct eapol_state_machine *sm, 00076 int enabled); 00077 void ieee802_1x_notify_port_valid(struct eapol_state_machine *sm, 00078 int valid); 00079 void ieee802_1x_notify_pre_auth(struct eapol_state_machine *sm, int pre_auth); 00080 int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen); 00081 int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta, 00082 char *buf, size_t buflen); 00083 void hostapd_get_ntp_timestamp(u8 *buf); 00084 char *eap_type_text(u8 type); 00085 00086 const char *radius_mode_txt(struct hostapd_data *hapd); 00087 int radius_sta_rate(struct hostapd_data *hapd, struct sta_info *sta); 00088 00089 #endif /* IEEE802_1X_H */