1189251Ssam/* 2189251Ssam * wpa_supplicant - WPA2/RSN PMKSA cache functions 3189251Ssam * Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi> 4189251Ssam * 5189251Ssam * This program is free software; you can redistribute it and/or modify 6189251Ssam * it under the terms of the GNU General Public License version 2 as 7189251Ssam * published by the Free Software Foundation. 8189251Ssam * 9189251Ssam * Alternatively, this software may be distributed under the terms of BSD 10189251Ssam * license. 11189251Ssam * 12189251Ssam * See README and COPYING for more details. 13189251Ssam */ 14189251Ssam 15189251Ssam#ifndef PMKSA_CACHE_H 16189251Ssam#define PMKSA_CACHE_H 17189251Ssam 18189251Ssam/** 19189251Ssam * struct rsn_pmksa_cache_entry - PMKSA cache entry 20189251Ssam */ 21189251Ssamstruct rsn_pmksa_cache_entry { 22189251Ssam struct rsn_pmksa_cache_entry *next; 23189251Ssam u8 pmkid[PMKID_LEN]; 24189251Ssam u8 pmk[PMK_LEN]; 25189251Ssam size_t pmk_len; 26189251Ssam os_time_t expiration; 27189251Ssam int akmp; /* WPA_KEY_MGMT_* */ 28189251Ssam u8 aa[ETH_ALEN]; 29189251Ssam 30189251Ssam os_time_t reauth_time; 31189251Ssam 32189251Ssam /** 33189251Ssam * network_ctx - Network configuration context 34189251Ssam * 35189251Ssam * This field is only used to match PMKSA cache entries to a specific 36189251Ssam * network configuration (e.g., a specific SSID and security policy). 37189251Ssam * This can be a pointer to the configuration entry, but PMKSA caching 38189251Ssam * code does not dereference the value and this could be any kind of 39189251Ssam * identifier. 40189251Ssam */ 41189251Ssam void *network_ctx; 42189251Ssam int opportunistic; 43189251Ssam}; 44189251Ssam 45189251Ssamstruct rsn_pmksa_cache; 46189251Ssam 47189251Ssam#if defined(IEEE8021X_EAPOL) && !defined(CONFIG_NO_WPA2) 48189251Ssam 49189251Ssamstruct rsn_pmksa_cache * 50189251Ssampmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry, 51189251Ssam void *ctx, int replace), 52189251Ssam void *ctx, struct wpa_sm *sm); 53189251Ssamvoid pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa); 54189251Ssamstruct rsn_pmksa_cache_entry * pmksa_cache_get(struct rsn_pmksa_cache *pmksa, 55189251Ssam const u8 *aa, const u8 *pmkid); 56214734Srpauloint pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf, size_t len); 57189251Ssamstruct rsn_pmksa_cache_entry * 58189251Ssampmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len, 59189251Ssam const u8 *aa, const u8 *spa, void *network_ctx, int akmp); 60189251Ssamvoid pmksa_cache_notify_reconfig(struct rsn_pmksa_cache *pmksa); 61189251Ssamstruct rsn_pmksa_cache_entry * pmksa_cache_get_current(struct wpa_sm *sm); 62189251Ssamvoid pmksa_cache_clear_current(struct wpa_sm *sm); 63189251Ssamint pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid, 64189251Ssam const u8 *bssid, void *network_ctx, 65189251Ssam int try_opportunistic); 66189251Ssamstruct rsn_pmksa_cache_entry * 67189251Ssampmksa_cache_get_opportunistic(struct rsn_pmksa_cache *pmksa, 68189251Ssam void *network_ctx, const u8 *aa); 69189251Ssam 70189251Ssam#else /* IEEE8021X_EAPOL and !CONFIG_NO_WPA2 */ 71189251Ssam 72189251Ssamstatic inline struct rsn_pmksa_cache * 73189251Ssampmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry, 74189251Ssam void *ctx, int replace), 75189251Ssam void *ctx, struct wpa_sm *sm) 76189251Ssam{ 77189251Ssam return (void *) -1; 78189251Ssam} 79189251Ssam 80189251Ssamstatic inline void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa) 81189251Ssam{ 82189251Ssam} 83189251Ssam 84189251Ssamstatic inline struct rsn_pmksa_cache_entry * 85189251Ssampmksa_cache_get(struct rsn_pmksa_cache *pmksa, const u8 *aa, const u8 *pmkid) 86189251Ssam{ 87189251Ssam return NULL; 88189251Ssam} 89189251Ssam 90189251Ssamstatic inline struct rsn_pmksa_cache_entry * 91189251Ssampmksa_cache_get_current(struct wpa_sm *sm) 92189251Ssam{ 93189251Ssam return NULL; 94189251Ssam} 95189251Ssam 96214734Srpaulostatic inline int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf, 97214734Srpaulo size_t len) 98189251Ssam{ 99189251Ssam return -1; 100189251Ssam} 101189251Ssam 102189251Ssamstatic inline struct rsn_pmksa_cache_entry * 103189251Ssampmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len, 104189251Ssam const u8 *aa, const u8 *spa, void *network_ctx, int akmp) 105189251Ssam{ 106189251Ssam return NULL; 107189251Ssam} 108189251Ssam 109189251Ssamstatic inline void pmksa_cache_notify_reconfig(struct rsn_pmksa_cache *pmksa) 110189251Ssam{ 111189251Ssam} 112189251Ssam 113189251Ssamstatic inline void pmksa_cache_clear_current(struct wpa_sm *sm) 114189251Ssam{ 115189251Ssam} 116189251Ssam 117189251Ssamstatic inline int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid, 118189251Ssam const u8 *bssid, 119189251Ssam void *network_ctx, 120189251Ssam int try_opportunistic) 121189251Ssam{ 122189251Ssam return -1; 123189251Ssam} 124189251Ssam 125189251Ssam#endif /* IEEE8021X_EAPOL and !CONFIG_NO_WPA2 */ 126189251Ssam 127189251Ssam#endif /* PMKSA_CACHE_H */ 128