2 * hostapd / IEEE 802.1X-2004 Authenticator
3 * Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi>
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.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
20 struct eapol_state_machine
;
21 struct hostapd_config
;
22 struct hostapd_bss_config
;
24 /* RFC 3580, 4. RC4 EAPOL-Key Frame */
26 struct ieee802_1x_eapol_key
{
29 u8 replay_counter
[8]; /* does not repeat within the life of the keying
30 * material used to encrypt the Key field;
31 * 64-bit NTP timestamp MAY be used here */
32 u8 key_iv
[16]; /* cryptographically random number */
33 u8 key_index
; /* key flag in the most significant bit:
34 * 0 = broadcast (default key),
35 * 1 = unicast (key mapping key); key index is in the
36 * 7 least significant bits */
37 u8 key_signature
[16]; /* HMAC-MD5 message integrity check computed with
38 * MS-MPPE-Send-Key as the key */
40 /* followed by key: if packet body length = 44 + key length, then the
41 * key field (of key_length bytes) contains the key in encrypted form;
42 * if packet body length = 44, key field is absent and key_length
43 * represents the number of least significant octets from
44 * MS-MPPE-Send-Key attribute to be used as the keying material;
45 * RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key */
46 } __attribute__ ((packed
));
49 void ieee802_1x_receive(struct hostapd_data
*hapd
, const u8
*sa
, const u8
*buf
,
51 void ieee802_1x_new_station(struct hostapd_data
*hapd
, struct sta_info
*sta
);
52 void ieee802_1x_free_station(struct sta_info
*sta
);
54 void ieee802_1x_tx_key(struct hostapd_data
*hapd
, struct sta_info
*sta
);
55 void ieee802_1x_abort_auth(struct hostapd_data
*hapd
, struct sta_info
*sta
);
56 void ieee802_1x_set_sta_authorized(struct hostapd_data
*hapd
,
57 struct sta_info
*sta
, int authorized
);
58 void ieee802_1x_dump_state(FILE *f
, const char *prefix
, struct sta_info
*sta
);
59 int ieee802_1x_init(struct hostapd_data
*hapd
);
60 void ieee802_1x_deinit(struct hostapd_data
*hapd
);
61 int ieee802_1x_reconfig(struct hostapd_data
*hapd
,
62 struct hostapd_config
*oldconf
,
63 struct hostapd_bss_config
*oldbss
);
64 int ieee802_1x_tx_status(struct hostapd_data
*hapd
, struct sta_info
*sta
,
65 u8
*buf
, size_t len
, int ack
);
66 u8
* ieee802_1x_get_identity(struct eapol_state_machine
*sm
, size_t *len
);
67 u8
* ieee802_1x_get_radius_class(struct eapol_state_machine
*sm
, size_t *len
,
69 const u8
* ieee802_1x_get_key(struct eapol_state_machine
*sm
, size_t *len
);
70 void ieee802_1x_notify_port_enabled(struct eapol_state_machine
*sm
,
72 void ieee802_1x_notify_port_valid(struct eapol_state_machine
*sm
,
74 void ieee802_1x_notify_pre_auth(struct eapol_state_machine
*sm
, int pre_auth
);
75 int ieee802_1x_get_mib(struct hostapd_data
*hapd
, char *buf
, size_t buflen
);
76 int ieee802_1x_get_mib_sta(struct hostapd_data
*hapd
, struct sta_info
*sta
,
77 char *buf
, size_t buflen
);
78 void hostapd_get_ntp_timestamp(u8
*buf
);
79 char *eap_type_text(u8 type
);
81 struct radius_class_data
;
83 void ieee802_1x_free_radius_class(struct radius_class_data
*class);
84 int ieee802_1x_copy_radius_class(struct radius_class_data
*dst
,
85 const struct radius_class_data
*src
);
87 #endif /* IEEE802_1X_H */