Lines Matching refs:pmksa
32 struct rsn_pmksa_cache_entry *pmksa; /* PMKSA cache */ member
69 static void pmksa_cache_set_expiration(struct rsn_pmksa_cache *pmksa);
78 static void pmksa_cache_free_entry(struct rsn_pmksa_cache *pmksa, in pmksa_cache_free_entry() argument
82 pmksa->pmksa_count--; in pmksa_cache_free_entry()
83 pmksa->free_cb(entry, pmksa->ctx, replace); in pmksa_cache_free_entry()
90 struct rsn_pmksa_cache *pmksa = eloop_ctx; in pmksa_cache_expire() local
94 while (pmksa->pmksa && pmksa->pmksa->expiration <= now.sec) { in pmksa_cache_expire()
95 struct rsn_pmksa_cache_entry *entry = pmksa->pmksa; in pmksa_cache_expire()
96 pmksa->pmksa = entry->next; in pmksa_cache_expire()
99 pmksa_cache_free_entry(pmksa, entry, 0); in pmksa_cache_expire()
102 pmksa_cache_set_expiration(pmksa); in pmksa_cache_expire()
108 struct rsn_pmksa_cache *pmksa = eloop_ctx; in pmksa_cache_reauth() local
109 pmksa->sm->cur_pmksa = NULL; in pmksa_cache_reauth()
110 eapol_sm_request_reauth(pmksa->sm->eapol); in pmksa_cache_reauth()
114 static void pmksa_cache_set_expiration(struct rsn_pmksa_cache *pmksa) in pmksa_cache_set_expiration() argument
120 eloop_cancel_timeout(pmksa_cache_expire, pmksa, NULL); in pmksa_cache_set_expiration()
121 eloop_cancel_timeout(pmksa_cache_reauth, pmksa, NULL); in pmksa_cache_set_expiration()
122 if (pmksa->pmksa == NULL) in pmksa_cache_set_expiration()
125 sec = pmksa->pmksa->expiration - now.sec; in pmksa_cache_set_expiration()
128 eloop_register_timeout(sec + 1, 0, pmksa_cache_expire, pmksa, NULL); in pmksa_cache_set_expiration()
130 entry = pmksa->sm->cur_pmksa ? pmksa->sm->cur_pmksa : in pmksa_cache_set_expiration()
131 pmksa_cache_get(pmksa, pmksa->sm->bssid, NULL); in pmksa_cache_set_expiration()
133 sec = pmksa->pmksa->reauth_time - now.sec; in pmksa_cache_set_expiration()
136 eloop_register_timeout(sec, 0, pmksa_cache_reauth, pmksa, in pmksa_cache_set_expiration()
158 pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len, in pmksa_cache_add() argument
164 if (pmksa->sm->proto != WPA_PROTO_RSN || pmk_len > PMK_LEN) in pmksa_cache_add()
174 entry->expiration = now.sec + pmksa->sm->dot11RSNAConfigPMKLifetime; in pmksa_cache_add()
175 entry->reauth_time = now.sec + pmksa->sm->dot11RSNAConfigPMKLifetime * in pmksa_cache_add()
176 pmksa->sm->dot11RSNAConfigPMKReauthThreshold / 100; in pmksa_cache_add()
183 pos = pmksa->pmksa; in pmksa_cache_add()
197 pmksa->pmksa = pos->next; in pmksa_cache_add()
200 if (pos == pmksa->sm->cur_pmksa) { in pmksa_cache_add()
211 pmksa->sm->cur_pmksa = NULL; in pmksa_cache_add()
215 pmksa_cache_free_entry(pmksa, pos, 1); in pmksa_cache_add()
222 if (pmksa->pmksa_count >= pmksa_cache_max_entries && pmksa->pmksa) { in pmksa_cache_add()
224 pos = pmksa->pmksa; in pmksa_cache_add()
225 pmksa->pmksa = pos->next; in pmksa_cache_add()
229 wpa_sm_remove_pmkid(pmksa->sm, pos->aa, pos->pmkid); in pmksa_cache_add()
230 pmksa_cache_free_entry(pmksa, pos, 0); in pmksa_cache_add()
234 pos = pmksa->pmksa; in pmksa_cache_add()
243 entry->next = pmksa->pmksa; in pmksa_cache_add()
244 pmksa->pmksa = entry; in pmksa_cache_add()
245 pmksa_cache_set_expiration(pmksa); in pmksa_cache_add()
250 pmksa->pmksa_count++; in pmksa_cache_add()
253 wpa_sm_add_pmkid(pmksa->sm, entry->aa, entry->pmkid); in pmksa_cache_add()
263 void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa) in pmksa_cache_deinit() argument
267 if (pmksa == NULL) in pmksa_cache_deinit()
270 entry = pmksa->pmksa; in pmksa_cache_deinit()
271 pmksa->pmksa = NULL; in pmksa_cache_deinit()
277 pmksa_cache_set_expiration(pmksa); in pmksa_cache_deinit()
278 os_free(pmksa); in pmksa_cache_deinit()
289 struct rsn_pmksa_cache_entry * pmksa_cache_get(struct rsn_pmksa_cache *pmksa, in pmksa_cache_get() argument
292 struct rsn_pmksa_cache_entry *entry = pmksa->pmksa; in pmksa_cache_get()
310 void pmksa_cache_notify_reconfig(struct rsn_pmksa_cache *pmksa) in pmksa_cache_notify_reconfig() argument
312 struct rsn_pmksa_cache_entry *entry = pmksa->pmksa; in pmksa_cache_notify_reconfig()
321 pmksa_cache_clone_entry(struct rsn_pmksa_cache *pmksa, in pmksa_cache_clone_entry() argument
327 new_entry = pmksa_cache_add(pmksa, old_entry->pmk, old_entry->pmk_len, in pmksa_cache_clone_entry()
328 aa, pmksa->sm->own_addr, old_entry->ssid); in pmksa_cache_clone_entry()
352 pmksa_cache_get_opportunistic(struct rsn_pmksa_cache *pmksa, in pmksa_cache_get_opportunistic() argument
355 struct rsn_pmksa_cache_entry *entry = pmksa->pmksa; in pmksa_cache_get_opportunistic()
361 entry = pmksa_cache_clone_entry(pmksa, entry, aa); in pmksa_cache_get_opportunistic()
413 struct rsn_pmksa_cache *pmksa = sm->pmksa; in pmksa_cache_set_current() local
416 sm->cur_pmksa = pmksa_cache_get(pmksa, NULL, pmkid); in pmksa_cache_set_current()
418 sm->cur_pmksa = pmksa_cache_get(pmksa, bssid, NULL); in pmksa_cache_set_current()
420 sm->cur_pmksa = pmksa_cache_get_opportunistic(pmksa, ssid, in pmksa_cache_set_current()
456 entry = sm->pmksa->pmksa; in pmksa_cache_list()
490 struct rsn_pmksa_cache *pmksa; in pmksa_cache_init() local
492 pmksa = os_zalloc(sizeof(*pmksa)); in pmksa_cache_init()
493 if (pmksa) { in pmksa_cache_init()
494 pmksa->free_cb = free_cb; in pmksa_cache_init()
495 pmksa->ctx = ctx; in pmksa_cache_init()
496 pmksa->sm = sm; in pmksa_cache_init()
499 return pmksa; in pmksa_cache_init()