2 * wpa_supplicant - WPA2/RSN PMKSA cache functions
3 * Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
19 * struct rsn_pmksa_cache_entry - PMKSA cache entry
21 struct rsn_pmksa_cache_entry
{
22 struct rsn_pmksa_cache_entry
*next
;
27 int akmp
; /* WPA_KEY_MGMT_* */
30 os_time_t reauth_time
;
33 * network_ctx - Network configuration context
35 * This field is only used to match PMKSA cache entries to a specific
36 * network configuration (e.g., a specific SSID and security policy).
37 * This can be a pointer to the configuration entry, but PMKSA caching
38 * code does not dereference the value and this could be any kind of
45 struct rsn_pmksa_cache
;
47 #if defined(IEEE8021X_EAPOL) && !defined(CONFIG_NO_WPA2)
49 struct rsn_pmksa_cache
*
50 pmksa_cache_init(void (*free_cb
)(struct rsn_pmksa_cache_entry
*entry
,
51 void *ctx
, int replace
),
52 void *ctx
, struct wpa_sm
*sm
);
53 void pmksa_cache_deinit(struct rsn_pmksa_cache
*pmksa
);
54 struct rsn_pmksa_cache_entry
* pmksa_cache_get(struct rsn_pmksa_cache
*pmksa
,
55 const u8
*aa
, const u8
*pmkid
);
56 int pmksa_cache_list(struct rsn_pmksa_cache
*pmksa
, char *buf
, size_t len
);
57 struct rsn_pmksa_cache_entry
*
58 pmksa_cache_add(struct rsn_pmksa_cache
*pmksa
, const u8
*pmk
, size_t pmk_len
,
59 const u8
*aa
, const u8
*spa
, void *network_ctx
, int akmp
);
60 void pmksa_cache_notify_reconfig(struct rsn_pmksa_cache
*pmksa
);
61 struct rsn_pmksa_cache_entry
* pmksa_cache_get_current(struct wpa_sm
*sm
);
62 void pmksa_cache_clear_current(struct wpa_sm
*sm
);
63 int pmksa_cache_set_current(struct wpa_sm
*sm
, const u8
*pmkid
,
64 const u8
*bssid
, void *network_ctx
,
65 int try_opportunistic
);
66 struct rsn_pmksa_cache_entry
*
67 pmksa_cache_get_opportunistic(struct rsn_pmksa_cache
*pmksa
,
68 void *network_ctx
, const u8
*aa
);
70 #else /* IEEE8021X_EAPOL and !CONFIG_NO_WPA2 */
72 static inline struct rsn_pmksa_cache
*
73 pmksa_cache_init(void (*free_cb
)(struct rsn_pmksa_cache_entry
*entry
,
74 void *ctx
, int replace
),
75 void *ctx
, struct wpa_sm
*sm
)
80 static inline void pmksa_cache_deinit(struct rsn_pmksa_cache
*pmksa
)
84 static inline struct rsn_pmksa_cache_entry
*
85 pmksa_cache_get(struct rsn_pmksa_cache
*pmksa
, const u8
*aa
, const u8
*pmkid
)
90 static inline struct rsn_pmksa_cache_entry
*
91 pmksa_cache_get_current(struct wpa_sm
*sm
)
96 static inline int pmksa_cache_list(struct rsn_pmksa_cache
*pmksa
, char *buf
,
102 static inline struct rsn_pmksa_cache_entry
*
103 pmksa_cache_add(struct rsn_pmksa_cache
*pmksa
, const u8
*pmk
, size_t pmk_len
,
104 const u8
*aa
, const u8
*spa
, void *network_ctx
, int akmp
)
109 static inline void pmksa_cache_notify_reconfig(struct rsn_pmksa_cache
*pmksa
)
113 static inline void pmksa_cache_clear_current(struct wpa_sm
*sm
)
117 static inline int pmksa_cache_set_current(struct wpa_sm
*sm
, const u8
*pmkid
,
120 int try_opportunistic
)
125 #endif /* IEEE8021X_EAPOL and !CONFIG_NO_WPA2 */
127 #endif /* PMKSA_CACHE_H */