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 os_free(entry->identity);
41 wpabuf_free(entry->cui);
43 radius_free_class(&entry->radius_class);
45 bin_clear_free(entry, sizeof(*entry));
50 struct rsn_pmksa_cache_entry *entry)
56 pmksa->free_cb(entry, pmksa->ctx);
59 hash = PMKID_HASH(entry->pmkid);
63 if (pos == entry) {
65 prev->hnext = entry->hnext;
67 pmksa->pmkid[hash] = entry->hnext;
74 /* unlink from entry list */
78 if (pos == entry) {
80 prev->next = entry->next;
82 pmksa->pmksa = entry->next;
89 _pmksa_cache_free_entry(entry);
100 wpa_printf(MSG_DEBUG, "RSN: expired PMKSA cache entry for "
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)
195 /* Add the new entry; order by expiration time */
199 if (pos->expiration > entry->expiration)
205 entry->next = pmksa->pmksa;
206 pmksa->pmksa = entry;
208 entry->next = prev->next;
209 prev->next = entry;
212 hash = PMKID_HASH(entry->pmkid);
213 entry->hnext = pmksa->pmkid[hash];
214 pmksa->pmkid[hash] = entry;
219 wpa_printf(MSG_DEBUG, "RSN: added PMKSA cache entry for " MACSTR,
220 MAC2STR(entry->spa));
221 wpa_hexdump(MSG_DEBUG, "RSN: added PMKID", entry->pmkid, PMKID_LEN);
226 * pmksa_cache_auth_add - Add a PMKSA cache entry
235 * Returns: Pointer to the added PMKSA cache entry or %NULL on error
237 * This function create a PMKSA entry for a new PMK and adds it to the PMKSA
238 * cache. If an old entry is already in the cache for the same Supplicant,
239 * this entry will be replaced with the new entry. PMKID will be calculated
248 struct rsn_pmksa_cache_entry *entry, *pos;
254 entry = os_zalloc(sizeof(*entry));
255 if (entry == NULL)
257 os_memcpy(entry->pmk, pmk, pmk_len);
258 entry->pmk_len = pmk_len;
259 rsn_pmkid(pmk, pmk_len, aa, spa, entry->pmkid,
262 entry->expiration = now.sec;
264 entry->expiration += session_timeout;
266 entry->expiration += dot11RSNAConfigPMKLifetime;
267 entry->akmp = akmp;
268 os_memcpy(entry->spa, spa, ETH_ALEN);
269 pmksa_cache_from_eapol_data(entry, eapol);
271 /* Replace an old entry for the same STA (if found) with the new entry
278 /* Remove the oldest entry to make room for the new entry */
280 "entry (for " MACSTR ") to make room for new one",
285 pmksa_cache_link_entry(pmksa, entry);
287 return entry;
296 struct rsn_pmksa_cache_entry *entry;
298 entry = os_zalloc(sizeof(*entry));
299 if (entry == NULL)
301 os_memcpy(entry->pmkid, pmkid, PMKID_LEN);
302 os_memcpy(entry->pmk, old_entry->pmk, old_entry->pmk_len);
303 entry->pmk_len = old_entry->pmk_len;
304 entry->expiration = old_entry->expiration;
305 entry->akmp = old_entry->akmp;
306 os_memcpy(entry->spa, old_entry->spa, ETH_ALEN);
307 entry->opportunistic = 1;
309 entry->identity = os_malloc(old_entry->identity_len);
310 if (entry->identity) {
311 entry->identity_len = old_entry->identity_len;
312 os_memcpy(entry->identity, old_entry->identity,
317 entry->cui = wpabuf_dup(old_entry->cui);
319 radius_copy_class(&entry->radius_class, &old_entry->radius_class);
321 entry->eap_type_authsrv = old_entry->eap_type_authsrv;
322 entry->vlan_id = old_entry->vlan_id;
323 entry->opportunistic = 1;
325 pmksa_cache_link_entry(pmksa, entry);
327 return entry;
337 struct rsn_pmksa_cache_entry *entry, *prev;
343 entry = pmksa->pmksa;
344 while (entry) {
345 prev = entry;
346 entry = entry->next;
359 * pmksa_cache_auth_get - Fetch a PMKSA cache entry
363 * Returns: Pointer to PMKSA cache entry or %NULL if no match was found
369 struct rsn_pmksa_cache_entry *entry;
372 for (entry = pmksa->pmkid[PMKID_HASH(pmkid)]; entry;
373 entry = entry->hnext) {
375 os_memcmp(entry->spa, spa, ETH_ALEN) == 0) &&
376 os_memcmp(entry->pmkid, pmkid, PMKID_LEN) == 0)
377 return entry;
380 for (entry = pmksa->pmksa; entry; entry = entry->next) {
382 os_memcmp(entry->spa, spa, ETH_ALEN) == 0)
383 return entry;
392 * pmksa_cache_get_okc - Fetch a PMKSA cache entry using OKC
397 * Returns: Pointer to PMKSA cache entry or %NULL if no match was found
405 struct rsn_pmksa_cache_entry *entry;
408 for (entry = pmksa->pmksa; entry; entry = entry->next) {
409 if (os_memcmp(entry->spa, spa, ETH_ALEN) != 0)
411 rsn_pmkid(entry->pmk, entry->pmk_len, aa, spa, new_pmkid,
412 wpa_key_mgmt_sha256(entry->akmp));
414 return entry;
422 * @free_cb: Callback function to be called when a PMKSA cache entry is freed
427 pmksa_cache_auth_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,