Lines Matching refs:entry

36 	void (*free_cb)(struct rsn_pmksa_cache_entry *entry, void *ctx);
44 static void _pmksa_cache_free_entry(struct rsn_pmksa_cache_entry *entry)
46 if (entry == NULL)
48 os_free(entry->identity);
50 radius_free_class(&entry->radius_class);
52 os_free(entry);
57 struct rsn_pmksa_cache_entry *entry)
62 pmksa->free_cb(entry, pmksa->ctx);
63 pos = pmksa->pmkid[PMKID_HASH(entry->pmkid)];
66 if (pos == entry) {
70 pmksa->pmkid[PMKID_HASH(entry->pmkid)] =
82 if (pos == entry) {
92 _pmksa_cache_free_entry(entry);
103 struct rsn_pmksa_cache_entry *entry = pmksa->pmksa;
104 pmksa->pmksa = entry->next;
105 wpa_printf(MSG_DEBUG, "RSN: expired PMKSA cache entry for "
106 MACSTR, MAC2STR(entry->spa));
107 pmksa_cache_free_entry(pmksa, entry);
130 static void pmksa_cache_from_eapol_data(struct rsn_pmksa_cache_entry *entry,
137 entry->identity = os_malloc(eapol->identity_len);
138 if (entry->identity) {
139 entry->identity_len = eapol->identity_len;
140 os_memcpy(entry->identity, eapol->identity,
146 radius_copy_class(&entry->radius_class, &eapol->radius_class);
149 entry->eap_type_authsrv = eapol->eap_type_authsrv;
150 entry->vlan_id = ((struct sta_info *) eapol->sta)->vlan_id;
154 void pmksa_cache_to_eapol_data(struct rsn_pmksa_cache_entry *entry,
157 if (entry == NULL || eapol == NULL)
160 if (entry->identity) {
162 eapol->identity = os_malloc(entry->identity_len);
164 eapol->identity_len = entry->identity_len;
165 os_memcpy(eapol->identity, entry->identity,
166 entry->identity_len);
174 radius_copy_class(&eapol->radius_class, &entry->radius_class);
181 eapol->eap_type_authsrv = entry->eap_type_authsrv;
182 ((struct sta_info *) eapol->sta)->vlan_id = entry->vlan_id;
187 struct rsn_pmksa_cache_entry *entry)
191 /* Add the new entry; order by expiration time */
195 if (pos->expiration > entry->expiration)
201 entry->next = pmksa->pmksa;
202 pmksa->pmksa = entry;
204 entry->next = prev->next;
205 prev->next = entry;
207 entry->hnext = pmksa->pmkid[PMKID_HASH(entry->pmkid)];
208 pmksa->pmkid[PMKID_HASH(entry->pmkid)] = entry;
211 wpa_printf(MSG_DEBUG, "RSN: added PMKSA cache entry for " MACSTR,
212 MAC2STR(entry->spa));
213 wpa_hexdump(MSG_DEBUG, "RSN: added PMKID", entry->pmkid, PMKID_LEN);
218 * pmksa_cache_auth_add - Add a PMKSA cache entry
227 * Returns: Pointer to the added PMKSA cache entry or %NULL on error
229 * This function create a PMKSA entry for a new PMK and adds it to the PMKSA
230 * cache. If an old entry is already in the cache for the same Supplicant,
231 * this entry will be replaced with the new entry. PMKID will be calculated
240 struct rsn_pmksa_cache_entry *entry, *pos;
246 entry = os_zalloc(sizeof(*entry));
247 if (entry == NULL)
249 os_memcpy(entry->pmk, pmk, pmk_len);
250 entry->pmk_len = pmk_len;
251 rsn_pmkid(pmk, pmk_len, aa, spa, entry->pmkid,
254 entry->expiration = now.sec;
256 entry->expiration += session_timeout;
258 entry->expiration += dot11RSNAConfigPMKLifetime;
259 entry->akmp = akmp;
260 os_memcpy(entry->spa, spa, ETH_ALEN);
261 pmksa_cache_from_eapol_data(entry, eapol);
263 /* Replace an old entry for the same STA (if found) with the new entry
270 /* Remove the oldest entry to make room for the new entry */
272 "entry (for " MACSTR ") to make room for new one",
277 pmksa_cache_link_entry(pmksa, entry);
279 return entry;
288 struct rsn_pmksa_cache_entry *entry;
290 entry = os_zalloc(sizeof(*entry));
291 if (entry == NULL)
293 os_memcpy(entry->pmkid, pmkid, PMKID_LEN);
294 os_memcpy(entry->pmk, old_entry->pmk, old_entry->pmk_len);
295 entry->pmk_len = old_entry->pmk_len;
296 entry->expiration = old_entry->expiration;
297 entry->akmp = old_entry->akmp;
298 os_memcpy(entry->spa, old_entry->spa, ETH_ALEN);
299 entry->opportunistic = 1;
301 entry->identity = os_malloc(old_entry->identity_len);
302 if (entry->identity) {
303 entry->identity_len = old_entry->identity_len;
304 os_memcpy(entry->identity, old_entry->identity,
309 radius_copy_class(&entry->radius_class, &old_entry->radius_class);
311 entry->eap_type_authsrv = old_entry->eap_type_authsrv;
312 entry->vlan_id = old_entry->vlan_id;
313 entry->opportunistic = 1;
315 pmksa_cache_link_entry(pmksa, entry);
317 return entry;
327 struct rsn_pmksa_cache_entry *entry, *prev;
333 entry = pmksa->pmksa;
334 while (entry) {
335 prev = entry;
336 entry = entry->next;
347 * pmksa_cache_auth_get - Fetch a PMKSA cache entry
351 * Returns: Pointer to PMKSA cache entry or %NULL if no match was found
357 struct rsn_pmksa_cache_entry *entry;
360 entry = pmksa->pmkid[PMKID_HASH(pmkid)];
362 entry = pmksa->pmksa;
363 while (entry) {
365 os_memcmp(entry->spa, spa, ETH_ALEN) == 0) &&
367 os_memcmp(entry->pmkid, pmkid, PMKID_LEN) == 0))
368 return entry;
369 entry = pmkid ? entry->hnext : entry->next;
376 * pmksa_cache_get_okc - Fetch a PMKSA cache entry using OKC
381 * Returns: Pointer to PMKSA cache entry or %NULL if no match was found
389 struct rsn_pmksa_cache_entry *entry;
392 entry = pmksa->pmksa;
393 while (entry) {
394 if (os_memcmp(entry->spa, spa, ETH_ALEN) != 0)
396 rsn_pmkid(entry->pmk, entry->pmk_len, aa, spa, new_pmkid,
397 wpa_key_mgmt_sha256(entry->akmp));
399 return entry;
400 entry = entry->next;
408 * @free_cb: Callback function to be called when a PMKSA cache entry is freed
413 pmksa_cache_auth_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,