Lines Matching refs:pmksa
2 * hostapd - PMKSA cache for IEEE 802.11i RSN
28 struct rsn_pmksa_cache_entry *pmksa;
36 static void pmksa_cache_set_expiration(struct rsn_pmksa_cache *pmksa);
51 void pmksa_cache_free_entry(struct rsn_pmksa_cache *pmksa,
57 pmksa->pmksa_count--;
58 pmksa->free_cb(entry, pmksa->ctx);
62 pos = pmksa->pmkid[hash];
69 pmksa->pmkid[hash] = entry->hnext;
77 pos = pmksa->pmksa;
84 pmksa->pmksa = entry->next;
96 * pmksa_cache_auth_flush - Flush all PMKSA cache entries
97 * @pmksa: Pointer to PMKSA cache data from pmksa_cache_auth_init()
99 void pmksa_cache_auth_flush(struct rsn_pmksa_cache *pmksa)
101 while (pmksa->pmksa) {
102 wpa_printf(MSG_DEBUG, "RSN: Flush PMKSA cache entry for "
103 MACSTR, MAC2STR(pmksa->pmksa->spa));
104 pmksa_cache_free_entry(pmksa, pmksa->pmksa);
111 struct rsn_pmksa_cache *pmksa = eloop_ctx;
115 while (pmksa->pmksa && pmksa->pmksa->expiration <= now.sec) {
116 wpa_printf(MSG_DEBUG, "RSN: expired PMKSA cache entry for "
117 MACSTR, MAC2STR(pmksa->pmksa->spa));
118 pmksa_cache_free_entry(pmksa, pmksa->pmksa);
121 pmksa_cache_set_expiration(pmksa);
125 static void pmksa_cache_set_expiration(struct rsn_pmksa_cache *pmksa)
130 eloop_cancel_timeout(pmksa_cache_expire, pmksa, NULL);
131 if (pmksa->pmksa == NULL)
134 sec = pmksa->pmksa->expiration - now.sec;
137 eloop_register_timeout(sec + 1, 0, pmksa_cache_expire, pmksa, NULL);
195 wpa_hexdump_ascii(MSG_DEBUG, "STA identity from PMKSA",
210 "PMKSA", (unsigned long) eapol->radius_class.count);
222 static void pmksa_cache_link_entry(struct rsn_pmksa_cache *pmksa,
229 pos = pmksa->pmksa;
238 entry->next = pmksa->pmksa;
239 pmksa->pmksa = entry;
246 entry->hnext = pmksa->pmkid[hash];
247 pmksa->pmkid[hash] = entry;
249 pmksa->pmksa_count++;
251 pmksa_cache_set_expiration(pmksa);
252 wpa_printf(MSG_DEBUG, "RSN: added PMKSA cache entry for " MACSTR,
259 * pmksa_cache_auth_add - Add a PMKSA cache entry
260 * @pmksa: Pointer to PMKSA cache data from pmksa_cache_auth_init()
271 * Returns: Pointer to the added PMKSA cache entry or %NULL on error
273 * This function create a PMKSA entry for a new PMK and adds it to the PMKSA
279 pmksa_cache_auth_add(struct rsn_pmksa_cache *pmksa,
291 if (pmksa_cache_auth_add_entry(pmksa, entry) < 0)
299 * pmksa_cache_auth_create_entry - Create a PMKSA cache entry
310 * Returns: Pointer to the added PMKSA cache entry or %NULL on error
312 * This function creates a PMKSA entry.
358 * pmksa_cache_auth_add_entry - Add a PMKSA cache entry
359 * @pmksa: Pointer to PMKSA cache data from pmksa_cache_auth_init()
360 * @entry: Pointer to PMKSA cache entry
362 * This function adds PMKSA cache entry to the PMKSA cache. If an old entry is
366 int pmksa_cache_auth_add_entry(struct rsn_pmksa_cache *pmksa,
376 pos = pmksa_cache_auth_get(pmksa, entry->spa, NULL);
378 pmksa_cache_free_entry(pmksa, pos);
380 if (pmksa->pmksa_count >= pmksa_cache_max_entries && pmksa->pmksa) {
382 wpa_printf(MSG_DEBUG, "RSN: removed the oldest PMKSA cache "
384 MAC2STR(pmksa->pmksa->spa));
385 pmksa_cache_free_entry(pmksa, pmksa->pmksa);
388 pmksa_cache_link_entry(pmksa, entry);
395 pmksa_cache_add_okc(struct rsn_pmksa_cache *pmksa,
434 pmksa_cache_link_entry(pmksa, entry);
441 * pmksa_cache_auth_deinit - Free all entries in PMKSA cache
442 * @pmksa: Pointer to PMKSA cache data from pmksa_cache_auth_init()
444 void pmksa_cache_auth_deinit(struct rsn_pmksa_cache *pmksa)
449 if (pmksa == NULL)
452 entry = pmksa->pmksa;
458 eloop_cancel_timeout(pmksa_cache_expire, pmksa, NULL);
459 pmksa->pmksa_count = 0;
460 pmksa->pmksa = NULL;
462 pmksa->pmkid[i] = NULL;
463 os_free(pmksa);
468 * pmksa_cache_auth_get - Fetch a PMKSA cache entry
469 * @pmksa: Pointer to PMKSA cache data from pmksa_cache_auth_init()
472 * Returns: Pointer to PMKSA cache entry or %NULL if no match was found
475 pmksa_cache_auth_get(struct rsn_pmksa_cache *pmksa,
481 for (entry = pmksa->pmkid[PMKID_HASH(pmkid)]; entry;
489 for (entry = pmksa->pmksa; entry; entry = entry->next) {
501 * pmksa_cache_get_okc - Fetch a PMKSA cache entry using OKC
502 * @pmksa: Pointer to PMKSA cache data from pmksa_cache_auth_init()
506 * Returns: Pointer to PMKSA cache entry or %NULL if no match was found
511 struct rsn_pmksa_cache *pmksa, const u8 *aa, const u8 *spa,
517 for (entry = pmksa->pmksa; entry; entry = entry->next) {
530 * pmksa_cache_auth_init - Initialize PMKSA cache
531 * @free_cb: Callback function to be called when a PMKSA cache entry is freed
533 * Returns: Pointer to PMKSA cache data or %NULL on failure
539 struct rsn_pmksa_cache *pmksa;
541 pmksa = os_zalloc(sizeof(*pmksa));
542 if (pmksa) {
543 pmksa->free_cb = free_cb;
544 pmksa->ctx = ctx;
547 return pmksa;
596 int pmksa_cache_auth_radius_das_disconnect(struct rsn_pmksa_cache *pmksa,
605 entry = pmksa->pmksa;
611 pmksa_cache_free_entry(pmksa, prev);
622 * pmksa_cache_auth_list - Dump text list of entries in PMKSA cache
623 * @pmksaPMKSA cache data from pmksa_cache_auth_init()
629 * current PMKSA cache contents for the ctrl_iface PMKSA command.
631 int pmksa_cache_auth_list(struct rsn_pmksa_cache *pmksa, char *buf, size_t len)
645 entry = pmksa->pmksa;
670 * pmksa_cache_auth_list_mesh - Dump text list of entries in PMKSA cache
671 * @pmksa: Pointer to PMKSA cache data from pmksa_cache_auth_init()
678 * current PMKSA cache contents for the ctrl_iface PMKSA_GET command to store
681 int pmksa_cache_auth_list_mesh(struct rsn_pmksa_cache *pmksa, const u8 *addr,
698 for (entry = pmksa->pmksa; entry; entry = entry->next) {