Home | History | Annotate | Download | only in rsn_supp

Lines Matching refs:pmksa

2  * WPA Supplicant - RSN PMKSA cache
31 struct rsn_pmksa_cache_entry *pmksa; /* PMKSA cache */
32 int pmksa_count; /* number of entries in PMKSA cache */
74 static void pmksa_cache_set_expiration(struct rsn_pmksa_cache *pmksa);
83 static void pmksa_cache_free_entry(struct rsn_pmksa_cache *pmksa,
87 pmksa->pmksa_count--;
88 pmksa->free_cb(entry, pmksa->ctx, replace);
95 struct rsn_pmksa_cache *pmksa = eloop_ctx;
99 while (pmksa->pmksa && pmksa->pmksa->expiration <= now.sec) {
100 struct rsn_pmksa_cache_entry *entry = pmksa->pmksa;
101 pmksa->pmksa = entry->next;
102 wpa_printf(MSG_DEBUG, "RSN: expired PMKSA cache entry for "
104 pmksa_cache_free_entry(pmksa, entry, 0);
107 pmksa_cache_set_expiration(pmksa);
113 struct rsn_pmksa_cache *pmksa = eloop_ctx;
114 pmksa->sm->cur_pmksa = NULL;
115 eapol_sm_request_reauth(pmksa->sm->eapol);
119 static void pmksa_cache_set_expiration(struct rsn_pmksa_cache *pmksa)
125 eloop_cancel_timeout(pmksa_cache_expire, pmksa, NULL);
126 eloop_cancel_timeout(pmksa_cache_reauth, pmksa, NULL);
127 if (pmksa->pmksa == NULL)
130 sec = pmksa->pmksa->expiration - now.sec;
133 eloop_register_timeout(sec + 1, 0, pmksa_cache_expire, pmksa, NULL);
135 entry = pmksa->sm->cur_pmksa ? pmksa->sm->cur_pmksa :
136 pmksa_cache_get(pmksa, pmksa->sm->bssid, NULL);
138 sec = pmksa->pmksa->reauth_time - now.sec;
141 eloop_register_timeout(sec, 0, pmksa_cache_reauth, pmksa,
148 * pmksa_cache_add - Add a PMKSA cache entry
149 * @pmksa: Pointer to PMKSA cache data from pmksa_cache_init()
156 * Returns: Pointer to the added PMKSA cache entry or %NULL on error
158 * This function create a PMKSA entry for a new PMK and adds it to the PMKSA
164 pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
170 if (pmksa->sm->proto != WPA_PROTO_RSN || pmk_len > PMK_LEN)
181 entry->expiration = now.sec + pmksa->sm->dot11RSNAConfigPMKLifetime;
182 entry->reauth_time = now.sec + pmksa->sm->dot11RSNAConfigPMKLifetime *
183 pmksa->sm->dot11RSNAConfigPMKReauthThreshold / 100;
190 pos = pmksa->pmksa;
199 "PMKSA entry");
204 pmksa->pmksa = pos->next;
207 if (pos == pmksa->sm->cur_pmksa) {
208 /* We are about to replace the current PMKSA
209 * cache entry. This happens when the PMKSA
213 * PMKSA cache entry will not be used in the
217 "PMKSA entry");
218 pmksa->sm->cur_pmksa = NULL;
220 wpa_printf(MSG_DEBUG, "RSN: Replace PMKSA entry for "
222 pmksa_cache_free_entry(pmksa, pos, 1);
229 if (pmksa->pmksa_count >= pmksa_cache_max_entries && pmksa->pmksa) {
231 pos = pmksa->pmksa;
232 pmksa->pmksa = pos->next;
233 wpa_printf(MSG_DEBUG, "RSN: removed the oldest PMKSA cache "
236 wpa_sm_remove_pmkid(pmksa->sm, pos->aa, pos->pmkid);
237 pmksa_cache_free_entry(pmksa, pos, 0);
241 pos = pmksa->pmksa;
250 entry->next = pmksa->pmksa;
251 pmksa->pmksa = entry;
252 pmksa_cache_set_expiration(pmksa);
257 pmksa->pmksa_count++;
258 wpa_printf(MSG_DEBUG, "RSN: added PMKSA cache entry for " MACSTR,
260 wpa_sm_add_pmkid(pmksa->sm, entry->aa, entry->pmkid);
267 * pmksa_cache_deinit - Free all entries in PMKSA cache
268 * @pmksa: Pointer to PMKSA cache data from pmksa_cache_init()
270 void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa)
274 if (pmksa == NULL)
277 entry = pmksa->pmksa;
278 pmksa->pmksa = NULL;
284 pmksa_cache_set_expiration(pmksa);
285 os_free(pmksa);
290 * pmksa_cache_get - Fetch a PMKSA cache entry
291 * @pmksa: Pointer to PMKSA cache data from pmksa_cache_init()
294 * Returns: Pointer to PMKSA cache entry or %NULL if no match was found
296 struct rsn_pmksa_cache_entry * pmksa_cache_get(struct rsn_pmksa_cache *pmksa,
299 struct rsn_pmksa_cache_entry *entry = pmksa->pmksa;
312 * pmksa_cache_notify_reconfig - Reconfiguration notification for PMKSA cache
313 * @pmksa: Pointer to PMKSA cache data from pmksa_cache_init()
317 void pmksa_cache_notify_reconfig(struct rsn_pmksa_cache *pmksa)
319 struct rsn_pmksa_cache_entry *entry = pmksa->pmksa;
328 pmksa_cache_clone_entry(struct rsn_pmksa_cache *pmksa,
334 new_entry = pmksa_cache_add(pmksa, old_entry->pmk, old_entry->pmk_len,
335 aa, pmksa->sm->own_addr,
349 * pmksa_cache_get_opportunistic - Try to get an opportunistic PMKSA entry
350 * @pmksa: Pointer to PMKSA cache data from pmksa_cache_init()
353 * Returns: Pointer to a new PMKSA cache entry or %NULL if not available
355 * Try to create a new PMKSA cache entry opportunistically by guessing that the
357 * already an entry in PMKSA cache.
360 pmksa_cache_get_opportunistic(struct rsn_pmksa_cache *pmksa, void *network_ctx,
363 struct rsn_pmksa_cache_entry *entry = pmksa->pmksa;
369 entry = pmksa_cache_clone_entry(pmksa, entry, aa);
372 "opportunistic PMKSA cache entry "
384 * pmksa_cache_get_current - Get the current used PMKSA entry
386 * Returns: Pointer to the current PMKSA cache entry or %NULL if not available
397 * pmksa_cache_clear_current - Clear the current PMKSA entry selection
409 * pmksa_cache_set_current - Set the current PMKSA entry selection
411 * @pmkid: PMKID for selecting PMKSA or %NULL if not used
412 * @bssid: BSSID for PMKSA or %NULL if not used
414 * @try_opportunistic: Whether to allow opportunistic PMKSA caching
415 * Returns: 0 if PMKSA was found or -1 if no matching entry was found
421 struct rsn_pmksa_cache *pmksa = sm->pmksa;
424 sm->cur_pmksa = pmksa_cache_get(pmksa, NULL, pmkid);
426 sm->cur_pmksa = pmksa_cache_get(pmksa, bssid, NULL);
428 sm->cur_pmksa = pmksa_cache_get_opportunistic(pmksa,
441 * pmksa_cache_list - Dump text list of entries in PMKSA cache
448 * current PMKSA cache contents for the ctrl_iface PMKSA command.
465 entry = sm->pmksa->pmksa;
488 * pmksa_cache_init - Initialize PMKSA cache
489 * @free_cb: Callback function to be called when a PMKSA cache entry is freed
492 * Returns: Pointer to PMKSA cache data or %NULL on failure
499 struct rsn_pmksa_cache *pmksa;
501 pmksa = os_zalloc(sizeof(*pmksa));
502 if (pmksa) {
503 pmksa->free_cb = free_cb;
504 pmksa->ctx = ctx;
505 pmksa->sm = sm;
508 return pmksa;