Lines Matching refs:entry

30 	void (*free_cb)(struct rsn_pmksa_cache_entry *entry, void *ctx);
38 static void _pmksa_cache_free_entry(struct rsn_pmksa_cache_entry *entry)
40 if (entry == NULL)
42 os_free(entry->identity);
43 wpabuf_free(entry->cui);
45 radius_free_class(&entry->radius_class);
47 os_free(entry);
52 struct rsn_pmksa_cache_entry *entry)
57 pmksa->free_cb(entry, pmksa->ctx);
58 pos = pmksa->pmkid[PMKID_HASH(entry->pmkid)];
61 if (pos == entry) {
65 pmksa->pmkid[PMKID_HASH(entry->pmkid)] =
77 if (pos == entry) {
87 _pmksa_cache_free_entry(entry);
98 struct rsn_pmksa_cache_entry *entry = pmksa->pmksa;
99 pmksa->pmksa = entry->next;
100 wpa_printf(MSG_DEBUG, "RSN: expired PMKSA cache entry for "
101 MACSTR, MAC2STR(entry->spa));
102 pmksa_cache_free_entry(pmksa, entry);
125 static void pmksa_cache_from_eapol_data(struct rsn_pmksa_cache_entry *entry,
132 entry->identity = os_malloc(eapol->identity_len);
133 if (entry->identity) {
134 entry->identity_len = eapol->identity_len;
135 os_memcpy(entry->identity, eapol->identity,
141 entry->cui = wpabuf_dup(eapol->radius_cui);
144 radius_copy_class(&entry->radius_class, &eapol->radius_class);
147 entry->eap_type_authsrv = eapol->eap_type_authsrv;
148 entry->vlan_id = ((struct sta_info *) eapol->sta)->vlan_id;
152 void pmksa_cache_to_eapol_data(struct rsn_pmksa_cache_entry *entry,
155 if (entry == NULL || eapol == NULL)
158 if (entry->identity) {
160 eapol->identity = os_malloc(entry->identity_len);
162 eapol->identity_len = entry->identity_len;
163 os_memcpy(eapol->identity, entry->identity,
164 entry->identity_len);
170 if (entry->cui) {
172 eapol->radius_cui = wpabuf_dup(entry->cui);
177 radius_copy_class(&eapol->radius_class, &entry->radius_class);
184 eapol->eap_type_authsrv = entry->eap_type_authsrv;
185 ((struct sta_info *) eapol->sta)->vlan_id = entry->vlan_id;
190 struct rsn_pmksa_cache_entry *entry)
194 /* Add the new entry; order by expiration time */
198 if (pos->expiration > entry->expiration)
204 entry->next = pmksa->pmksa;
205 pmksa->pmksa = entry;
207 entry->next = prev->next;
208 prev->next = entry;
210 entry->hnext = pmksa->pmkid[PMKID_HASH(entry->pmkid)];
211 pmksa->pmkid[PMKID_HASH(entry->pmkid)] = entry;
214 wpa_printf(MSG_DEBUG, "RSN: added PMKSA cache entry for " MACSTR,
215 MAC2STR(entry->spa));
216 wpa_hexdump(MSG_DEBUG, "RSN: added PMKID", entry->pmkid, PMKID_LEN);
221 * pmksa_cache_auth_add - Add a PMKSA cache entry
230 * Returns: Pointer to the added PMKSA cache entry or %NULL on error
232 * This function create a PMKSA entry for a new PMK and adds it to the PMKSA
233 * cache. If an old entry is already in the cache for the same Supplicant,
234 * this entry will be replaced with the new entry. PMKID will be calculated
243 struct rsn_pmksa_cache_entry *entry, *pos;
249 entry = os_zalloc(sizeof(*entry));
250 if (entry == NULL)
252 os_memcpy(entry->pmk, pmk, pmk_len);
253 entry->pmk_len = pmk_len;
254 rsn_pmkid(pmk, pmk_len, aa, spa, entry->pmkid,
257 entry->expiration = now.sec;
259 entry->expiration += session_timeout;
261 entry->expiration += dot11RSNAConfigPMKLifetime;
262 entry->akmp = akmp;
263 os_memcpy(entry->spa, spa, ETH_ALEN);
264 pmksa_cache_from_eapol_data(entry, eapol);
266 /* Replace an old entry for the same STA (if found) with the new entry
273 /* Remove the oldest entry to make room for the new entry */
275 "entry (for " MACSTR ") to make room for new one",
280 pmksa_cache_link_entry(pmksa, entry);
282 return entry;
291 struct rsn_pmksa_cache_entry *entry;
293 entry = os_zalloc(sizeof(*entry));
294 if (entry == NULL)
296 os_memcpy(entry->pmkid, pmkid, PMKID_LEN);
297 os_memcpy(entry->pmk, old_entry->pmk, old_entry->pmk_len);
298 entry->pmk_len = old_entry->pmk_len;
299 entry->expiration = old_entry->expiration;
300 entry->akmp = old_entry->akmp;
301 os_memcpy(entry->spa, old_entry->spa, ETH_ALEN);
302 entry->opportunistic = 1;
304 entry->identity = os_malloc(old_entry->identity_len);
305 if (entry->identity) {
306 entry->identity_len = old_entry->identity_len;
307 os_memcpy(entry->identity, old_entry->identity,
312 entry->cui = wpabuf_dup(old_entry->cui);
314 radius_copy_class(&entry->radius_class, &old_entry->radius_class);
316 entry->eap_type_authsrv = old_entry->eap_type_authsrv;
317 entry->vlan_id = old_entry->vlan_id;
318 entry->opportunistic = 1;
320 pmksa_cache_link_entry(pmksa, entry);
322 return entry;
332 struct rsn_pmksa_cache_entry *entry, *prev;
338 entry = pmksa->pmksa;
339 while (entry) {
340 prev = entry;
341 entry = entry->next;
352 * pmksa_cache_auth_get - Fetch a PMKSA cache entry
356 * Returns: Pointer to PMKSA cache entry or %NULL if no match was found
362 struct rsn_pmksa_cache_entry *entry;
365 entry = pmksa->pmkid[PMKID_HASH(pmkid)];
367 entry = pmksa->pmksa;
368 while (entry) {
370 os_memcmp(entry->spa, spa, ETH_ALEN) == 0) &&
372 os_memcmp(entry->pmkid, pmkid, PMKID_LEN) == 0))
373 return entry;
374 entry = pmkid ? entry->hnext : entry->next;
381 * pmksa_cache_get_okc - Fetch a PMKSA cache entry using OKC
386 * Returns: Pointer to PMKSA cache entry or %NULL if no match was found
394 struct rsn_pmksa_cache_entry *entry;
397 entry = pmksa->pmksa;
398 while (entry) {
399 if (os_memcmp(entry->spa, spa, ETH_ALEN) != 0)
401 rsn_pmkid(entry->pmk, entry->pmk_len, aa, spa, new_pmkid,
402 wpa_key_mgmt_sha256(entry->akmp));
404 return entry;
405 entry = entry->next;
413 * @free_cb: Callback function to be called when a PMKSA cache entry is freed
418 pmksa_cache_auth_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,