$search
00001 /* 00002 * wpa_supplicant - WPA2/RSN PMKSA cache functions 00003 * Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation. 00008 * 00009 * Alternatively, this software may be distributed under the terms of BSD 00010 * license. 00011 * 00012 * See README and COPYING for more details. 00013 */ 00014 00015 #ifndef PMKSA_CACHE_H 00016 #define PMKSA_CACHE_H 00017 00021 struct rsn_pmksa_cache_entry { 00022 struct rsn_pmksa_cache_entry *next; 00023 u8 pmkid[PMKID_LEN]; 00024 u8 pmk[PMK_LEN]; 00025 size_t pmk_len; 00026 os_time_t expiration; 00027 int akmp; /* WPA_KEY_MGMT_* */ 00028 u8 aa[ETH_ALEN]; 00029 00030 os_time_t reauth_time; 00031 00041 void *network_ctx; 00042 int opportunistic; 00043 }; 00044 00045 struct rsn_pmksa_cache; 00046 00047 #if defined(IEEE8021X_EAPOL) && !defined(CONFIG_NO_WPA2) 00048 00049 struct rsn_pmksa_cache * 00050 pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry, 00051 void *ctx, int replace), 00052 void *ctx, struct wpa_sm *sm); 00053 void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa); 00054 struct rsn_pmksa_cache_entry * pmksa_cache_get(struct rsn_pmksa_cache *pmksa, 00055 const u8 *aa, const u8 *pmkid); 00056 int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf, size_t len); 00057 struct rsn_pmksa_cache_entry * 00058 pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len, 00059 const u8 *aa, const u8 *spa, void *network_ctx, int akmp); 00060 void pmksa_cache_notify_reconfig(struct rsn_pmksa_cache *pmksa); 00061 struct rsn_pmksa_cache_entry * pmksa_cache_get_current(struct wpa_sm *sm); 00062 void pmksa_cache_clear_current(struct wpa_sm *sm); 00063 int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid, 00064 const u8 *bssid, void *network_ctx, 00065 int try_opportunistic); 00066 struct rsn_pmksa_cache_entry * 00067 pmksa_cache_get_opportunistic(struct rsn_pmksa_cache *pmksa, 00068 void *network_ctx, const u8 *aa); 00069 00070 #else /* IEEE8021X_EAPOL and !CONFIG_NO_WPA2 */ 00071 00072 static inline struct rsn_pmksa_cache * 00073 pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry, 00074 void *ctx, int replace), 00075 void *ctx, struct wpa_sm *sm) 00076 { 00077 return (void *) -1; 00078 } 00079 00080 static inline void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa) 00081 { 00082 } 00083 00084 static inline struct rsn_pmksa_cache_entry * 00085 pmksa_cache_get(struct rsn_pmksa_cache *pmksa, const u8 *aa, const u8 *pmkid) 00086 { 00087 return NULL; 00088 } 00089 00090 static inline struct rsn_pmksa_cache_entry * 00091 pmksa_cache_get_current(struct wpa_sm *sm) 00092 { 00093 return NULL; 00094 } 00095 00096 static inline int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf, 00097 size_t len) 00098 { 00099 return -1; 00100 } 00101 00102 static inline struct rsn_pmksa_cache_entry * 00103 pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len, 00104 const u8 *aa, const u8 *spa, void *network_ctx, int akmp) 00105 { 00106 return NULL; 00107 } 00108 00109 static inline void pmksa_cache_notify_reconfig(struct rsn_pmksa_cache *pmksa) 00110 { 00111 } 00112 00113 static inline void pmksa_cache_clear_current(struct wpa_sm *sm) 00114 { 00115 } 00116 00117 static inline int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid, 00118 const u8 *bssid, 00119 void *network_ctx, 00120 int try_opportunistic) 00121 { 00122 return -1; 00123 } 00124 00125 #endif /* IEEE8021X_EAPOL and !CONFIG_NO_WPA2 */ 00126 00127 #endif /* PMKSA_CACHE_H */