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