1 /* 2 * hostapd - PMKSA cache for IEEE 802.11i RSN 3 * Copyright (c) 2004-2008, 2012, Jouni Malinen <j@w1.fi> 4 * 5 * This software may be distributed under the terms of the BSD license. 6 * See README for more details. 7 */ 8 9 #ifndef PMKSA_CACHE_H 10 #define PMKSA_CACHE_H 11 #include "ap/ieee802_1x.h" 12 13 /** 14 * struct rsn_pmksa_cache_entry - PMKSA cache entry 15 */ 16 struct rsn_pmksa_cache_entry { 17 struct rsn_pmksa_cache_entry *next, *hnext; 18 u8 pmkid[PMKID_LEN]; 19 u8 pmk[PMK_LEN_MAX]; 20 size_t pmk_len; 21 os_time_t expiration; 22 int akmp; /* WPA_KEY_MGMT_* */ 23 u8 spa[ETH_ALEN]; 24 25 u8 *identity; 26 size_t identity_len; 27 struct wpabuf *cui; 28 u8 eap_type_authsrv; 29 struct vlan_description *vlan_desc; 30 int opportunistic; 31 32 u64 acct_multi_session_id; 33 }; 34 35 struct rsn_pmksa_cache; 36 struct radius_das_attrs; 37 38 struct rsn_pmksa_cache * 39 pmksa_cache_auth_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry, 40 void *ctx), void *ctx); 41 void pmksa_cache_auth_deinit(struct rsn_pmksa_cache *pmksa); 42 struct rsn_pmksa_cache_entry * 43 pmksa_cache_auth_get(struct rsn_pmksa_cache *pmksa, 44 const u8 *spa, const u8 *pmkid); 45 struct rsn_pmksa_cache_entry * pmksa_cache_get_okc( 46 struct rsn_pmksa_cache *pmksa, const u8 *spa, const u8 *aa, 47 const u8 *pmkid); 48 struct rsn_pmksa_cache_entry * 49 pmksa_cache_auth_add(struct rsn_pmksa_cache *pmksa, 50 const u8 *pmk, size_t pmk_len, const u8 *pmkid, 51 const u8 *kck, size_t kck_len, 52 const u8 *aa, const u8 *spa, int session_timeout, 53 struct eapol_state_machine *eapol, int akmp); 54 struct rsn_pmksa_cache_entry * 55 pmksa_cache_auth_create_entry(const u8 *pmk, size_t pmk_len, const u8 *pmkid, 56 const u8 *kck, size_t kck_len, const u8 *aa, 57 const u8 *spa, int session_timeout, 58 struct eapol_state_machine *eapol, int akmp); 59 int pmksa_cache_auth_add_entry(struct rsn_pmksa_cache *pmksa, 60 struct rsn_pmksa_cache_entry *entry); 61 struct rsn_pmksa_cache_entry * 62 pmksa_cache_add_okc(struct rsn_pmksa_cache *pmksa, 63 const struct rsn_pmksa_cache_entry *old_entry, 64 const u8 *aa, const u8 *pmkid); 65 void pmksa_cache_to_eapol_data(struct hostapd_data *hapd, 66 struct rsn_pmksa_cache_entry *entry, 67 struct eapol_state_machine *eapol); 68 void pmksa_cache_free_entry(struct rsn_pmksa_cache *pmksa, 69 struct rsn_pmksa_cache_entry *entry); 70 int pmksa_cache_auth_radius_das_disconnect(struct rsn_pmksa_cache *pmksa, 71 struct radius_das_attrs *attr); 72 int pmksa_cache_auth_list(struct rsn_pmksa_cache *pmksa, char *buf, size_t len); 73 void pmksa_cache_auth_flush(struct rsn_pmksa_cache *pmksa); 74 int pmksa_cache_auth_list_mesh(struct rsn_pmksa_cache *pmksa, const u8 *addr, 75 char *buf, size_t len); 76 77 #endif /* PMKSA_CACHE_H */ 78