2 * wpa_supplicant - WPA2/RSN PMKSA cache functions
3 * Copyright (c) 2003-2009, 2011-2012, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
13 * struct rsn_pmksa_cache_entry - PMKSA cache entry
15 struct rsn_pmksa_cache_entry {
16 struct rsn_pmksa_cache_entry *next;
21 int akmp; /* WPA_KEY_MGMT_* */
25 * If FILS Cache Identifier is included (fils_cache_id_set), this PMKSA
26 * cache entry is applicable to all BSSs (any BSSID/aa[]) that
27 * advertise the same FILS Cache Identifier within the same ESS.
30 unsigned int fils_cache_id_set:1;
32 os_time_t reauth_time;
35 * network_ctx - Network configuration context
37 * This field is only used to match PMKSA cache entries to a specific
38 * network configuration (e.g., a specific SSID and security policy).
39 * This can be a pointer to the configuration entry, but PMKSA caching
40 * code does not dereference the value and this could be any kind of
47 struct rsn_pmksa_cache;
49 enum pmksa_free_reason {
55 #if defined(IEEE8021X_EAPOL) && !defined(CONFIG_NO_WPA)
57 struct rsn_pmksa_cache *
58 pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
59 void *ctx, enum pmksa_free_reason reason),
60 void *ctx, struct wpa_sm *sm);
61 void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa);
62 struct rsn_pmksa_cache_entry * pmksa_cache_get(struct rsn_pmksa_cache *pmksa,
63 const u8 *aa, const u8 *pmkid,
64 const void *network_ctx,
66 int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf, size_t len);
67 struct rsn_pmksa_cache_entry * pmksa_cache_head(struct rsn_pmksa_cache *pmksa);
68 struct rsn_pmksa_cache_entry *
69 pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
70 const u8 *pmkid, const u8 *kck, size_t kck_len,
71 const u8 *aa, const u8 *spa, void *network_ctx, int akmp,
73 struct rsn_pmksa_cache_entry *
74 pmksa_cache_add_entry(struct rsn_pmksa_cache *pmksa,
75 struct rsn_pmksa_cache_entry *entry);
76 struct rsn_pmksa_cache_entry * pmksa_cache_get_current(struct wpa_sm *sm);
77 void pmksa_cache_clear_current(struct wpa_sm *sm);
78 int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid,
79 const u8 *bssid, void *network_ctx,
80 int try_opportunistic, const u8 *fils_cache_id,
82 struct rsn_pmksa_cache_entry *
83 pmksa_cache_get_opportunistic(struct rsn_pmksa_cache *pmksa,
84 void *network_ctx, const u8 *aa, int akmp);
85 void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa, void *network_ctx,
86 const u8 *pmk, size_t pmk_len);
88 #else /* IEEE8021X_EAPOL */
90 static inline struct rsn_pmksa_cache *
91 pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
92 void *ctx, enum pmksa_free_reason reason),
93 void *ctx, struct wpa_sm *sm)
98 static inline void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa)
102 static inline struct rsn_pmksa_cache_entry *
103 pmksa_cache_get(struct rsn_pmksa_cache *pmksa, const u8 *aa, const u8 *pmkid,
104 const void *network_ctx, int akmp)
109 static inline struct rsn_pmksa_cache_entry *
110 pmksa_cache_get_current(struct wpa_sm *sm)
115 static inline int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf,
121 static inline struct rsn_pmksa_cache_entry *
122 pmksa_cache_head(struct rsn_pmksa_cache *pmksa)
127 static inline struct rsn_pmksa_cache_entry *
128 pmksa_cache_add_entry(struct rsn_pmksa_cache *pmksa,
129 struct rsn_pmksa_cache_entry *entry)
134 static inline struct rsn_pmksa_cache_entry *
135 pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
136 const u8 *pmkid, const u8 *kck, size_t kck_len,
137 const u8 *aa, const u8 *spa, void *network_ctx, int akmp,
143 static inline void pmksa_cache_clear_current(struct wpa_sm *sm)
147 static inline int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid,
150 int try_opportunistic,
151 const u8 *fils_cache_id,
157 static inline void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa,
159 const u8 *pmk, size_t pmk_len)
163 #endif /* IEEE8021X_EAPOL */
165 #endif /* PMKSA_CACHE_H */