]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/hostapd/ieee802_1x.h
This commit was generated by cvs2svn to compensate for changes in r170222,
[FreeBSD/FreeBSD.git] / contrib / hostapd / ieee802_1x.h
1 /* $FreeBSD$ */
2
3 #ifndef IEEE802_1X_H
4 #define IEEE802_1X_H
5
6 /* IEEE Std 802.1X-REV-d11, 7.2 */
7
8 struct ieee802_1x_hdr {
9         u8 version;
10         u8 type;
11         u16 length;
12         /* followed by length octets of data */
13 } __attribute__ ((packed));
14
15 #define EAPOL_VERSION 2
16
17 enum { IEEE802_1X_TYPE_EAP_PACKET = 0,
18        IEEE802_1X_TYPE_EAPOL_START = 1,
19        IEEE802_1X_TYPE_EAPOL_LOGOFF = 2,
20        IEEE802_1X_TYPE_EAPOL_KEY = 3,
21        IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT = 4
22 };
23
24 /* draft-congdon-radius-8021x-20.txt */
25
26 struct ieee802_1x_eapol_key {
27         u8 type;
28         u16 key_length;
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 */
39
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));
47
48 enum { EAPOL_KEY_TYPE_RC4 = 1, EAPOL_KEY_TYPE_RSN = 2,
49        EAPOL_KEY_TYPE_WPA = 254 };
50
51
52 void ieee802_1x_receive(struct hostapd_data *hapd, const u8 *sa, const u8 *buf,
53                         size_t len);
54 void ieee802_1x_new_station(hostapd *hapd, struct sta_info *sta);
55 void ieee802_1x_free_station(struct sta_info *sta);
56
57 void ieee802_1x_request_identity(struct hostapd_data *hapd,
58                                  struct sta_info *sta);
59 void ieee802_1x_tx_canned_eap(struct hostapd_data *hapd, struct sta_info *sta,
60                               int success);
61 void ieee802_1x_tx_req(hostapd *hapd, struct sta_info *sta);
62 void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta);
63 void ieee802_1x_send_resp_to_server(hostapd *hapd, struct sta_info *sta);
64 void ieee802_1x_abort_auth(struct hostapd_data *hapd, struct sta_info *sta);
65 void ieee802_1x_set_sta_authorized(hostapd *hapd, struct sta_info *sta,
66                                    int authorized);
67 void ieee802_1x_set_port_enabled(hostapd *hapd, struct sta_info *sta,
68                                  int enabled);
69 void ieee802_1x_dump_state(FILE *f, const char *prefix, struct sta_info *sta);
70 int ieee802_1x_init(hostapd *hapd);
71 void ieee802_1x_deinit(hostapd *hapd);
72 int ieee802_1x_tx_status(hostapd *hapd, struct sta_info *sta, u8 *buf,
73                          size_t len, int ack);
74 u8 * ieee802_1x_get_identity(struct eapol_state_machine *sm, size_t *len);
75 u8 * ieee802_1x_get_radius_class(struct eapol_state_machine *sm, size_t *len,
76                                  int idx);
77 u8 * ieee802_1x_get_key_crypt(struct eapol_state_machine *sm, size_t *len);
78 void ieee802_1x_notify_port_enabled(struct eapol_state_machine *sm,
79                                     int enabled);
80 void ieee802_1x_notify_port_valid(struct eapol_state_machine *sm,
81                                   int valid);
82 void ieee802_1x_notify_pre_auth(struct eapol_state_machine *sm, int pre_auth);
83 int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen);
84 int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
85                            char *buf, size_t buflen);
86 void hostapd_get_ntp_timestamp(u8 *buf);
87 void ieee802_1x_finished(struct hostapd_data *hapd, struct sta_info *sta,
88                          int success);
89
90 struct radius_class_data;
91
92 void ieee802_1x_free_radius_class(struct radius_class_data *class);
93 int ieee802_1x_copy_radius_class(struct radius_class_data *dst,
94                                  struct radius_class_data *src);
95
96 #endif /* IEEE802_1X_H */