4 /* IEEE Std 802.1X-REV-d11, 7.2 */
6 struct ieee802_1x_hdr
{
10 /* followed by length octets of data */
11 } __attribute__ ((packed
));
13 #define EAPOL_VERSION 2
15 enum { IEEE802_1X_TYPE_EAP_PACKET
= 0,
16 IEEE802_1X_TYPE_EAPOL_START
= 1,
17 IEEE802_1X_TYPE_EAPOL_LOGOFF
= 2,
18 IEEE802_1X_TYPE_EAPOL_KEY
= 3,
19 IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT
= 4
22 /* draft-congdon-radius-8021x-20.txt */
24 struct ieee802_1x_eapol_key
{
27 u8 replay_counter
[8]; /* does not repeat within the life of the keying
28 * material used to encrypt the Key field;
29 * 64-bit NTP timestamp MAY be used here */
30 u8 key_iv
[16]; /* cryptographically random number */
31 u8 key_index
; /* key flag in the most significant bit:
32 * 0 = broadcast (default key),
33 * 1 = unicast (key mapping key); key index is in the
34 * 7 least significant bits */
35 u8 key_signature
[16]; /* HMAC-MD5 message integrity check computed with
36 * MS-MPPE-Send-Key as the key */
38 /* followed by key: if packet body length = 44 + key length, then the
39 * key field (of key_length bytes) contains the key in encrypted form;
40 * if packet body length = 44, key field is absent and key_length
41 * represents the number of least significant octets from
42 * MS-MPPE-Send-Key attribute to be used as the keying material;
43 * RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key */
44 } __attribute__ ((packed
));
46 enum { EAPOL_KEY_TYPE_RC4
= 1, EAPOL_KEY_TYPE_RSN
= 2,
47 EAPOL_KEY_TYPE_WPA
= 254 };
50 void ieee802_1x_receive(struct hostapd_data
*hapd
, const u8
*sa
, const u8
*buf
,
52 void ieee802_1x_new_station(hostapd
*hapd
, struct sta_info
*sta
);
53 void ieee802_1x_free_station(struct sta_info
*sta
);
55 void ieee802_1x_request_identity(struct hostapd_data
*hapd
,
56 struct sta_info
*sta
);
57 void ieee802_1x_tx_canned_eap(struct hostapd_data
*hapd
, struct sta_info
*sta
,
59 void ieee802_1x_tx_req(hostapd
*hapd
, struct sta_info
*sta
);
60 void ieee802_1x_tx_key(struct hostapd_data
*hapd
, struct sta_info
*sta
);
61 void ieee802_1x_send_resp_to_server(hostapd
*hapd
, struct sta_info
*sta
);
62 void ieee802_1x_abort_auth(struct hostapd_data
*hapd
, struct sta_info
*sta
);
63 void ieee802_1x_set_sta_authorized(hostapd
*hapd
, struct sta_info
*sta
,
65 void ieee802_1x_set_port_enabled(hostapd
*hapd
, struct sta_info
*sta
,
67 void ieee802_1x_dump_state(FILE *f
, const char *prefix
, struct sta_info
*sta
);
68 int ieee802_1x_init(hostapd
*hapd
);
69 void ieee802_1x_deinit(hostapd
*hapd
);
70 int ieee802_1x_tx_status(hostapd
*hapd
, struct sta_info
*sta
, u8
*buf
,
72 u8
* ieee802_1x_get_identity(struct eapol_state_machine
*sm
, size_t *len
);
73 u8
* ieee802_1x_get_radius_class(struct eapol_state_machine
*sm
, size_t *len
,
75 u8
* ieee802_1x_get_key_crypt(struct eapol_state_machine
*sm
, size_t *len
);
76 void ieee802_1x_notify_port_enabled(struct eapol_state_machine
*sm
,
78 void ieee802_1x_notify_port_valid(struct eapol_state_machine
*sm
,
80 void ieee802_1x_notify_pre_auth(struct eapol_state_machine
*sm
, int pre_auth
);
81 int ieee802_1x_get_mib(struct hostapd_data
*hapd
, char *buf
, size_t buflen
);
82 int ieee802_1x_get_mib_sta(struct hostapd_data
*hapd
, struct sta_info
*sta
,
83 char *buf
, size_t buflen
);
84 void hostapd_get_ntp_timestamp(u8
*buf
);
85 void ieee802_1x_finished(struct hostapd_data
*hapd
, struct sta_info
*sta
,
88 struct radius_class_data
;
90 void ieee802_1x_free_radius_class(struct radius_class_data
*class);
91 int ieee802_1x_copy_radius_class(struct radius_class_data
*dst
,
92 struct radius_class_data
*src
);
94 #endif /* IEEE802_1X_H */