Lines Matching refs:entry

31 	void (*free_cb)(struct rsn_pmksa_cache_entry *entry, void *ctx);
39 static void _pmksa_cache_free_entry(struct rsn_pmksa_cache_entry *entry)
41 os_free(entry->vlan_desc);
42 os_free(entry->identity);
43 wpabuf_free(entry->cui);
45 radius_free_class(&entry->radius_class);
47 bin_clear_free(entry, sizeof(*entry));
52 struct rsn_pmksa_cache_entry *entry)
58 pmksa->free_cb(entry, pmksa->ctx);
61 hash = PMKID_HASH(entry->pmkid);
65 if (pos == entry) {
67 prev->hnext = entry->hnext;
69 pmksa->pmkid[hash] = entry->hnext;
76 /* unlink from entry list */
80 if (pos == entry) {
82 prev->next = entry->next;
84 pmksa->pmksa = entry->next;
91 _pmksa_cache_free_entry(entry);
102 wpa_printf(MSG_DEBUG, "RSN: Flush PMKSA cache entry for "
116 wpa_printf(MSG_DEBUG, "RSN: expired PMKSA cache entry for "
141 static void pmksa_cache_from_eapol_data(struct rsn_pmksa_cache_entry *entry,
150 entry->identity = os_malloc(eapol->identity_len);
151 if (entry->identity) {
152 entry->identity_len = eapol->identity_len;
153 os_memcpy(entry->identity, eapol->identity,
159 entry->cui = wpabuf_dup(eapol->radius_cui);
162 radius_copy_class(&entry->radius_class, &eapol->radius_class);
165 entry->eap_type_authsrv = eapol->eap_type_authsrv;
169 entry->vlan_desc = os_zalloc(sizeof(struct vlan_description));
170 if (entry->vlan_desc)
171 *entry->vlan_desc = *vlan_desc;
173 entry->vlan_desc = NULL;
176 entry->acct_multi_session_id = eapol->acct_multi_session_id;
181 struct rsn_pmksa_cache_entry *entry,
184 if (entry == NULL || eapol == NULL)
187 if (entry->identity) {
189 eapol->identity = os_malloc(entry->identity_len);
191 eapol->identity_len = entry->identity_len;
192 os_memcpy(eapol->identity, entry->identity,
193 entry->identity_len);
199 if (entry->cui) {
201 eapol->radius_cui = wpabuf_dup(entry->cui);
206 radius_copy_class(&eapol->radius_class, &entry->radius_class);
213 eapol->eap_type_authsrv = entry->eap_type_authsrv;
215 ap_sta_set_vlan(hapd, eapol->sta, entry->vlan_desc);
218 eapol->acct_multi_session_id = entry->acct_multi_session_id;
223 struct rsn_pmksa_cache_entry *entry)
228 /* Add the new entry; order by expiration time */
232 if (pos->expiration > entry->expiration)
238 entry->next = pmksa->pmksa;
239 pmksa->pmksa = entry;
241 entry->next = prev->next;
242 prev->next = entry;
245 hash = PMKID_HASH(entry->pmkid);
246 entry->hnext = pmksa->pmkid[hash];
247 pmksa->pmkid[hash] = entry;
252 wpa_printf(MSG_DEBUG, "RSN: added PMKSA cache entry for " MACSTR,
253 MAC2STR(entry->spa));
254 wpa_hexdump(MSG_DEBUG, "RSN: added PMKID", entry->pmkid, PMKID_LEN);
259 * pmksa_cache_auth_add - Add a PMKSA cache entry
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
274 * cache. If an old entry is already in the cache for the same Supplicant,
275 * this entry will be replaced with the new entry. PMKID will be calculated
285 struct rsn_pmksa_cache_entry *entry;
287 entry = pmksa_cache_auth_create_entry(pmk, pmk_len, pmkid, kck, kck_len,
291 if (pmksa_cache_auth_add_entry(pmksa, entry) < 0)
294 return entry;
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.
320 struct rsn_pmksa_cache_entry *entry;
329 entry = os_zalloc(sizeof(*entry));
330 if (entry == NULL)
332 os_memcpy(entry->pmk, pmk, pmk_len);
333 entry->pmk_len = pmk_len;
335 os_memcpy(entry->pmkid, pmkid, PMKID_LEN);
337 rsn_pmkid_suite_b_192(kck, kck_len, aa, spa, entry->pmkid);
339 rsn_pmkid_suite_b(kck, kck_len, aa, spa, entry->pmkid);
341 rsn_pmkid(pmk, pmk_len, aa, spa, entry->pmkid, akmp);
343 entry->expiration = now.sec;
345 entry->expiration += session_timeout;
347 entry->expiration += dot11RSNAConfigPMKLifetime;
348 entry->akmp = akmp;
349 os_memcpy(entry->spa, spa, ETH_ALEN);
350 pmksa_cache_from_eapol_data(entry, eapol);
352 return entry;
357 * pmksa_cache_auth_add_entry - Add a PMKSA cache entry
359 * @entry: Pointer to PMKSA cache entry
361 * This function adds PMKSA cache entry to the PMKSA cache. If an old entry is
362 * already in the cache for the same Supplicant, this entry will be replaced
363 * with the new entry. PMKID will be calculated based on the PMK.
366 struct rsn_pmksa_cache_entry *entry)
370 if (entry == NULL)
373 /* Replace an old entry for the same STA (if found) with the new entry
375 pos = pmksa_cache_auth_get(pmksa, entry->spa, NULL);
380 /* Remove the oldest entry to make room for the new entry */
382 "entry (for " MACSTR ") to make room for new one",
387 pmksa_cache_link_entry(pmksa, entry);
398 struct rsn_pmksa_cache_entry *entry;
400 entry = os_zalloc(sizeof(*entry));
401 if (entry == NULL)
403 os_memcpy(entry->pmkid, pmkid, PMKID_LEN);
404 os_memcpy(entry->pmk, old_entry->pmk, old_entry->pmk_len);
405 entry->pmk_len = old_entry->pmk_len;
406 entry->expiration = old_entry->expiration;
407 entry->akmp = old_entry->akmp;
408 os_memcpy(entry->spa, old_entry->spa, ETH_ALEN);
409 entry->opportunistic = 1;
411 entry->identity = os_malloc(old_entry->identity_len);
412 if (entry->identity) {
413 entry->identity_len = old_entry->identity_len;
414 os_memcpy(entry->identity, old_entry->identity,
419 entry->cui = wpabuf_dup(old_entry->cui);
421 radius_copy_class(&entry->radius_class, &old_entry->radius_class);
423 entry->eap_type_authsrv = old_entry->eap_type_authsrv;
425 entry->vlan_desc = os_zalloc(sizeof(struct vlan_description));
426 if (entry->vlan_desc)
427 *entry->vlan_desc = *old_entry->vlan_desc;
429 entry->vlan_desc = NULL;
431 entry->opportunistic = 1;
433 pmksa_cache_link_entry(pmksa, entry);
435 return entry;
445 struct rsn_pmksa_cache_entry *entry, *prev;
451 entry = pmksa->pmksa;
452 while (entry) {
453 prev = entry;
454 entry = entry->next;
467 * pmksa_cache_auth_get - Fetch a PMKSA cache entry
471 * Returns: Pointer to PMKSA cache entry or %NULL if no match was found
477 struct rsn_pmksa_cache_entry *entry;
480 for (entry = pmksa->pmkid[PMKID_HASH(pmkid)]; entry;
481 entry = entry->hnext) {
483 os_memcmp(entry->spa, spa, ETH_ALEN) == 0) &&
484 os_memcmp(entry->pmkid, pmkid, PMKID_LEN) == 0)
485 return entry;
488 for (entry = pmksa->pmksa; entry; entry = entry->next) {
490 os_memcmp(entry->spa, spa, ETH_ALEN) == 0)
491 return entry;
500 * pmksa_cache_get_okc - Fetch a PMKSA cache entry using OKC
505 * Returns: Pointer to PMKSA cache entry or %NULL if no match was found
513 struct rsn_pmksa_cache_entry *entry;
516 for (entry = pmksa->pmksa; entry; entry = entry->next) {
517 if (os_memcmp(entry->spa, spa, ETH_ALEN) != 0)
519 rsn_pmkid(entry->pmk, entry->pmk_len, aa, spa, new_pmkid,
520 entry->akmp);
522 return entry;
530 * @free_cb: Callback function to be called when a PMKSA cache entry is freed
535 pmksa_cache_auth_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
550 static int das_attr_match(struct rsn_pmksa_cache_entry *entry,
556 if (os_memcmp(attr->sta_addr, entry->spa, ETH_ALEN) != 0)
567 (unsigned long long) entry->acct_multi_session_id);
574 if (!entry->cui ||
575 attr->cui_len != wpabuf_len(entry->cui) ||
576 os_memcmp(attr->cui, wpabuf_head(entry->cui),
583 if (!entry->identity ||
584 attr->user_name_len != entry->identity_len ||
585 os_memcmp(attr->user_name, entry->identity,
599 struct rsn_pmksa_cache_entry *entry, *prev;
604 entry = pmksa->pmksa;
605 while (entry) {
606 if (das_attr_match(entry, attr)) {
608 prev = entry;
609 entry = entry->next;
613 entry = entry->next;
634 struct rsn_pmksa_cache_entry *entry;
644 entry = pmksa->pmksa;
645 while (entry) {
647 i, MAC2STR(entry->spa));
651 pos += wpa_snprintf_hex(pos, buf + len - pos, entry->pmkid,
654 (int) (entry->expiration - now.sec),
655 entry->opportunistic);
659 entry = entry->next;
685 struct rsn_pmksa_cache_entry *entry;
697 for (entry = pmksa->pmksa; entry; entry = entry->next) {
698 if (addr && os_memcmp(entry->spa, addr, ETH_ALEN) != 0)
702 MAC2STR(entry->spa));
707 pos += wpa_snprintf_hex(pos, end - pos, entry->pmkid,
715 pos += wpa_snprintf_hex(pos, end - pos, entry->pmk,
716 entry->pmk_len);
719 (int) (entry->expiration - now.sec));