91 lines
3.6 KiB
C
Raw Normal View History

2007-07-09 16:15:06 +00:00
/*
2009-03-01 22:10:07 +00:00
* hostapd / IEEE 802.1X-2004 Authenticator
* Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi>
2007-07-09 16:15:06 +00:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Alternatively, this software may be distributed under the terms of BSD
* license.
*
* See README and COPYING for more details.
*/
2005-06-05 22:35:03 +00:00
#ifndef IEEE802_1X_H
#define IEEE802_1X_H
2009-03-01 22:10:07 +00:00
struct hostapd_data;
struct sta_info;
struct eapol_state_machine;
struct hostapd_config;
struct hostapd_bss_config;
/* RFC 3580, 4. RC4 EAPOL-Key Frame */
2005-06-05 22:35:03 +00:00
struct ieee802_1x_eapol_key {
u8 type;
u16 key_length;
u8 replay_counter[8]; /* does not repeat within the life of the keying
* material used to encrypt the Key field;
* 64-bit NTP timestamp MAY be used here */
u8 key_iv[16]; /* cryptographically random number */
u8 key_index; /* key flag in the most significant bit:
* 0 = broadcast (default key),
* 1 = unicast (key mapping key); key index is in the
* 7 least significant bits */
u8 key_signature[16]; /* HMAC-MD5 message integrity check computed with
* MS-MPPE-Send-Key as the key */
/* followed by key: if packet body length = 44 + key length, then the
* key field (of key_length bytes) contains the key in encrypted form;
* if packet body length = 44, key field is absent and key_length
* represents the number of least significant octets from
* MS-MPPE-Send-Key attribute to be used as the keying material;
* RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key */
} __attribute__ ((packed));
2006-03-07 05:47:04 +00:00
void ieee802_1x_receive(struct hostapd_data *hapd, const u8 *sa, const u8 *buf,
size_t len);
2007-07-09 16:15:06 +00:00
void ieee802_1x_new_station(struct hostapd_data *hapd, struct sta_info *sta);
2005-06-05 22:35:03 +00:00
void ieee802_1x_free_station(struct sta_info *sta);
void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta);
void ieee802_1x_abort_auth(struct hostapd_data *hapd, struct sta_info *sta);
2007-07-09 16:15:06 +00:00
void ieee802_1x_set_sta_authorized(struct hostapd_data *hapd,
struct sta_info *sta, int authorized);
2005-06-05 22:35:03 +00:00
void ieee802_1x_dump_state(FILE *f, const char *prefix, struct sta_info *sta);
2007-07-09 16:15:06 +00:00
int ieee802_1x_init(struct hostapd_data *hapd);
void ieee802_1x_deinit(struct hostapd_data *hapd);
int ieee802_1x_reconfig(struct hostapd_data *hapd,
struct hostapd_config *oldconf,
struct hostapd_bss_config *oldbss);
int ieee802_1x_tx_status(struct hostapd_data *hapd, struct sta_info *sta,
u8 *buf, size_t len, int ack);
2005-06-05 22:35:03 +00:00
u8 * ieee802_1x_get_identity(struct eapol_state_machine *sm, size_t *len);
2006-03-07 05:47:04 +00:00
u8 * ieee802_1x_get_radius_class(struct eapol_state_machine *sm, size_t *len,
int idx);
2009-03-01 22:10:07 +00:00
const u8 * ieee802_1x_get_key(struct eapol_state_machine *sm, size_t *len);
2005-06-05 22:35:03 +00:00
void ieee802_1x_notify_port_enabled(struct eapol_state_machine *sm,
int enabled);
void ieee802_1x_notify_port_valid(struct eapol_state_machine *sm,
int valid);
void ieee802_1x_notify_pre_auth(struct eapol_state_machine *sm, int pre_auth);
int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen);
int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
char *buf, size_t buflen);
void hostapd_get_ntp_timestamp(u8 *buf);
2007-07-09 16:15:06 +00:00
char *eap_type_text(u8 type);
2005-06-05 22:35:03 +00:00
2006-03-07 05:47:04 +00:00
struct radius_class_data;
void ieee802_1x_free_radius_class(struct radius_class_data *class);
int ieee802_1x_copy_radius_class(struct radius_class_data *dst,
2009-03-01 22:10:07 +00:00
const struct radius_class_data *src);
const char *radius_mode_txt(struct hostapd_data *hapd);
int radius_sta_rate(struct hostapd_data *hapd, struct sta_info *sta);
2006-03-07 05:47:04 +00:00
2005-06-05 22:35:03 +00:00
#endif /* IEEE802_1X_H */