xref: /dflybsd-src/contrib/wpa_supplicant/src/ap/pmksa_cache_auth.h (revision 3a84a4273475ed07d0ab1c2dfeffdfedef35d9cd)
13ff40c12SJohn Marino /*
23ff40c12SJohn Marino  * hostapd - PMKSA cache for IEEE 802.11i RSN
33ff40c12SJohn Marino  * Copyright (c) 2004-2008, 2012, Jouni Malinen <j@w1.fi>
43ff40c12SJohn Marino  *
53ff40c12SJohn Marino  * This software may be distributed under the terms of the BSD license.
63ff40c12SJohn Marino  * See README for more details.
73ff40c12SJohn Marino  */
83ff40c12SJohn Marino 
93ff40c12SJohn Marino #ifndef PMKSA_CACHE_H
103ff40c12SJohn Marino #define PMKSA_CACHE_H
113ff40c12SJohn Marino 
123ff40c12SJohn Marino #include "radius/radius.h"
133ff40c12SJohn Marino 
143ff40c12SJohn Marino /**
153ff40c12SJohn Marino  * struct rsn_pmksa_cache_entry - PMKSA cache entry
163ff40c12SJohn Marino  */
173ff40c12SJohn Marino struct rsn_pmksa_cache_entry {
183ff40c12SJohn Marino 	struct rsn_pmksa_cache_entry *next, *hnext;
193ff40c12SJohn Marino 	u8 pmkid[PMKID_LEN];
20*a1157835SDaniel Fojt 	u8 pmk[PMK_LEN_MAX];
213ff40c12SJohn Marino 	size_t pmk_len;
223ff40c12SJohn Marino 	os_time_t expiration;
233ff40c12SJohn Marino 	int akmp; /* WPA_KEY_MGMT_* */
243ff40c12SJohn Marino 	u8 spa[ETH_ALEN];
253ff40c12SJohn Marino 
263ff40c12SJohn Marino 	u8 *identity;
273ff40c12SJohn Marino 	size_t identity_len;
283ff40c12SJohn Marino 	struct wpabuf *cui;
293ff40c12SJohn Marino 	struct radius_class_data radius_class;
303ff40c12SJohn Marino 	u8 eap_type_authsrv;
31*a1157835SDaniel Fojt 	struct vlan_description *vlan_desc;
323ff40c12SJohn Marino 	int opportunistic;
33*a1157835SDaniel Fojt 
34*a1157835SDaniel Fojt 	u64 acct_multi_session_id;
353ff40c12SJohn Marino };
363ff40c12SJohn Marino 
373ff40c12SJohn Marino struct rsn_pmksa_cache;
38*a1157835SDaniel Fojt struct radius_das_attrs;
393ff40c12SJohn Marino 
403ff40c12SJohn Marino struct rsn_pmksa_cache *
413ff40c12SJohn Marino pmksa_cache_auth_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
423ff40c12SJohn Marino 				      void *ctx), void *ctx);
433ff40c12SJohn Marino void pmksa_cache_auth_deinit(struct rsn_pmksa_cache *pmksa);
443ff40c12SJohn Marino struct rsn_pmksa_cache_entry *
453ff40c12SJohn Marino pmksa_cache_auth_get(struct rsn_pmksa_cache *pmksa,
463ff40c12SJohn Marino 		     const u8 *spa, const u8 *pmkid);
473ff40c12SJohn Marino struct rsn_pmksa_cache_entry * pmksa_cache_get_okc(
483ff40c12SJohn Marino 	struct rsn_pmksa_cache *pmksa, const u8 *spa, const u8 *aa,
493ff40c12SJohn Marino 	const u8 *pmkid);
503ff40c12SJohn Marino struct rsn_pmksa_cache_entry *
513ff40c12SJohn Marino pmksa_cache_auth_add(struct rsn_pmksa_cache *pmksa,
52*a1157835SDaniel Fojt 		     const u8 *pmk, size_t pmk_len, const u8 *pmkid,
53*a1157835SDaniel Fojt 		     const u8 *kck, size_t kck_len,
543ff40c12SJohn Marino 		     const u8 *aa, const u8 *spa, int session_timeout,
553ff40c12SJohn Marino 		     struct eapol_state_machine *eapol, int akmp);
563ff40c12SJohn Marino struct rsn_pmksa_cache_entry *
57*a1157835SDaniel Fojt pmksa_cache_auth_create_entry(const u8 *pmk, size_t pmk_len, const u8 *pmkid,
58*a1157835SDaniel Fojt 			      const u8 *kck, size_t kck_len, const u8 *aa,
59*a1157835SDaniel Fojt 			      const u8 *spa, int session_timeout,
60*a1157835SDaniel Fojt 			      struct eapol_state_machine *eapol, int akmp);
61*a1157835SDaniel Fojt int pmksa_cache_auth_add_entry(struct rsn_pmksa_cache *pmksa,
62*a1157835SDaniel Fojt 			       struct rsn_pmksa_cache_entry *entry);
63*a1157835SDaniel Fojt struct rsn_pmksa_cache_entry *
643ff40c12SJohn Marino pmksa_cache_add_okc(struct rsn_pmksa_cache *pmksa,
653ff40c12SJohn Marino 		    const struct rsn_pmksa_cache_entry *old_entry,
663ff40c12SJohn Marino 		    const u8 *aa, const u8 *pmkid);
67*a1157835SDaniel Fojt void pmksa_cache_to_eapol_data(struct hostapd_data *hapd,
68*a1157835SDaniel Fojt 			       struct rsn_pmksa_cache_entry *entry,
693ff40c12SJohn Marino 			       struct eapol_state_machine *eapol);
703ff40c12SJohn Marino void pmksa_cache_free_entry(struct rsn_pmksa_cache *pmksa,
713ff40c12SJohn Marino 			    struct rsn_pmksa_cache_entry *entry);
72*a1157835SDaniel Fojt int pmksa_cache_auth_radius_das_disconnect(struct rsn_pmksa_cache *pmksa,
73*a1157835SDaniel Fojt 					   struct radius_das_attrs *attr);
74*a1157835SDaniel Fojt int pmksa_cache_auth_list(struct rsn_pmksa_cache *pmksa, char *buf, size_t len);
75*a1157835SDaniel Fojt void pmksa_cache_auth_flush(struct rsn_pmksa_cache *pmksa);
76*a1157835SDaniel Fojt int pmksa_cache_auth_list_mesh(struct rsn_pmksa_cache *pmksa, const u8 *addr,
77*a1157835SDaniel Fojt 			       char *buf, size_t len);
783ff40c12SJohn Marino 
793ff40c12SJohn Marino #endif /* PMKSA_CACHE_H */
80