xref: /freebsd/contrib/wpa/wpa_supplicant/ibss_rsn.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
1e28a4053SRui Paulo /*
2e28a4053SRui Paulo  * wpa_supplicant - IBSS RSN
3e28a4053SRui Paulo  * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
4e28a4053SRui Paulo  *
5f05cddf9SRui Paulo  * This software may be distributed under the terms of the BSD license.
6f05cddf9SRui Paulo  * See README for more details.
7e28a4053SRui Paulo  */
8e28a4053SRui Paulo 
9e28a4053SRui Paulo #ifndef IBSS_RSN_H
10e28a4053SRui Paulo #define IBSS_RSN_H
11e28a4053SRui Paulo 
12e28a4053SRui Paulo struct ibss_rsn;
13e28a4053SRui Paulo 
145b9c547cSRui Paulo /* not authenticated */
155b9c547cSRui Paulo #define IBSS_RSN_AUTH_NOT_AUTHENTICATED	0x00
165b9c547cSRui Paulo /* remote peer sent an EAPOL message */
175b9c547cSRui Paulo #define IBSS_RSN_AUTH_EAPOL_BY_PEER	0x01
185b9c547cSRui Paulo /* we sent an AUTH message with seq 1 */
195b9c547cSRui Paulo #define IBSS_RSN_AUTH_BY_US		0x02
205b9c547cSRui Paulo /* we sent an EAPOL message */
215b9c547cSRui Paulo #define IBSS_RSN_AUTH_EAPOL_BY_US	0x04
225b9c547cSRui Paulo /* PTK derived as supplicant */
235b9c547cSRui Paulo #define IBSS_RSN_SET_PTK_SUPP		0x08
245b9c547cSRui Paulo /* PTK derived as authenticator */
255b9c547cSRui Paulo #define IBSS_RSN_SET_PTK_AUTH		0x10
265b9c547cSRui Paulo /* PTK completion reported */
275b9c547cSRui Paulo #define IBSS_RSN_REPORTED_PTK		0x20
285b9c547cSRui Paulo 
29e28a4053SRui Paulo struct ibss_rsn_peer {
30e28a4053SRui Paulo 	struct ibss_rsn_peer *next;
31e28a4053SRui Paulo 	struct ibss_rsn *ibss_rsn;
32e28a4053SRui Paulo 
33e28a4053SRui Paulo 	u8 addr[ETH_ALEN];
34e28a4053SRui Paulo 
35e28a4053SRui Paulo 	struct wpa_sm *supp;
36e28a4053SRui Paulo 	enum wpa_states supp_state;
37e28a4053SRui Paulo 	u8 supp_ie[80];
38e28a4053SRui Paulo 	size_t supp_ie_len;
39e28a4053SRui Paulo 
40e28a4053SRui Paulo 	struct wpa_state_machine *auth;
415b9c547cSRui Paulo 	int authentication_status;
425b9c547cSRui Paulo 
435b9c547cSRui Paulo 	struct os_reltime own_auth_tx;
44e28a4053SRui Paulo };
45e28a4053SRui Paulo 
46e28a4053SRui Paulo struct ibss_rsn {
47e28a4053SRui Paulo 	struct wpa_supplicant *wpa_s;
48e28a4053SRui Paulo 	struct wpa_authenticator *auth_group;
49e28a4053SRui Paulo 	struct ibss_rsn_peer *peers;
50e28a4053SRui Paulo 	u8 psk[PMK_LEN];
51e28a4053SRui Paulo };
52e28a4053SRui Paulo 
53e28a4053SRui Paulo 
54780fb4a2SCy Schubert struct ibss_rsn * ibss_rsn_init(struct wpa_supplicant *wpa_s,
55780fb4a2SCy Schubert 				struct wpa_ssid *ssid);
56e28a4053SRui Paulo void ibss_rsn_deinit(struct ibss_rsn *ibss_rsn);
57e28a4053SRui Paulo int ibss_rsn_start(struct ibss_rsn *ibss_rsn, const u8 *addr);
58f05cddf9SRui Paulo void ibss_rsn_stop(struct ibss_rsn *ibss_rsn, const u8 *peermac);
59e28a4053SRui Paulo int ibss_rsn_rx_eapol(struct ibss_rsn *ibss_rsn, const u8 *src_addr,
60*a90b9d01SCy Schubert 		      const u8 *buf, size_t len,
61*a90b9d01SCy Schubert 		      enum frame_encryption encrypted);
62e28a4053SRui Paulo void ibss_rsn_set_psk(struct ibss_rsn *ibss_rsn, const u8 *psk);
635b9c547cSRui Paulo void ibss_rsn_handle_auth(struct ibss_rsn *ibss_rsn, const u8 *auth_frame,
645b9c547cSRui Paulo 			  size_t len);
65e28a4053SRui Paulo 
66e28a4053SRui Paulo #endif /* IBSS_RSN_H */
67