Lines Matching refs:sm

41  * @sm: Pointer to WPA state machine data from wpa_sm_init()
43 void pmksa_candidate_free(struct wpa_sm *sm)
47 if (sm == NULL)
50 entry = sm->pmksa_candidates;
51 sm->pmksa_candidates = NULL;
65 struct wpa_sm *sm = ctx;
70 if (sm->preauth_eapol == NULL ||
71 os_memcmp(sm->preauth_bssid, "\x00\x00\x00\x00\x00\x00",
73 os_memcmp(sm->preauth_bssid, src_addr, ETH_ALEN) != 0) {
80 eapol_sm_rx_eapol(sm->preauth_eapol, src_addr, buf, len);
87 struct wpa_sm *sm = ctx;
105 sm->pmk_len = pmk_len;
106 pmksa_cache_add(sm->pmksa, pmk, pmk_len,
107 sm->preauth_bssid, sm->own_addr,
108 sm->cur_ssid);
110 wpa_msg(sm->ctx->ctx, MSG_INFO, "RSN: failed to get "
117 wpa_msg(sm->ctx->ctx, MSG_INFO, "RSN: pre-authentication with " MACSTR
118 " %s", MAC2STR(sm->preauth_bssid),
121 rsn_preauth_deinit(sm);
122 rsn_preauth_candidate_process(sm);
128 struct wpa_sm *sm = eloop_ctx;
130 wpa_msg(sm->ctx->ctx, MSG_INFO, "RSN: pre-authentication with " MACSTR
131 " timed out", MAC2STR(sm->preauth_bssid));
132 rsn_preauth_deinit(sm);
133 rsn_preauth_candidate_process(sm);
140 struct wpa_sm *sm = ctx;
148 if (sm->l2_preauth == NULL)
151 msg = wpa_sm_alloc_eapol(sm, type, buf, len, &msglen, NULL);
156 res = l2_packet_send(sm->l2_preauth, sm->preauth_bssid,
165 * @sm: Pointer to WPA state machine data from wpa_sm_init()
177 int rsn_preauth_init(struct wpa_sm *sm, const u8 *dst, struct wpa_ssid *config)
182 if (sm->preauth_eapol)
185 wpa_msg(sm->ctx->ctx, MSG_DEBUG, "RSN: starting pre-authentication "
188 sm->l2_preauth = l2_packet_init(sm->ifname, sm->own_addr,
190 rsn_preauth_receive, sm, 0);
191 if (sm->l2_preauth == NULL) {
197 if (sm->bridge_ifname) {
198 sm->l2_preauth_br = l2_packet_init(sm->bridge_ifname,
199 sm->own_addr,
201 rsn_preauth_receive, sm, 0);
202 if (sm->l2_preauth_br == NULL) {
215 ctx->ctx = sm->ctx->ctx;
216 ctx->msg_ctx = sm->ctx->ctx;
219 ctx->cb_ctx = sm;
220 ctx->scard_ctx = sm->scard_ctx;
222 ctx->eapol_send_ctx = sm;
223 ctx->set_config_blob = sm->ctx->set_config_blob;
224 ctx->get_config_blob = sm->ctx->get_config_blob;
226 sm->preauth_eapol = eapol_sm_init(ctx);
227 if (sm->preauth_eapol == NULL) {
236 eapol_conf.fast_reauth = sm->fast_reauth;
239 eapol_sm_notify_config(sm->preauth_eapol, config, &eapol_conf);
246 eapol_sm_configure(sm->preauth_eapol, -1, -1, 5, 6);
247 os_memcpy(sm->preauth_bssid, dst, ETH_ALEN);
249 eapol_sm_notify_portValid(sm->preauth_eapol, TRUE);
251 eapol_sm_notify_portEnabled(sm->preauth_eapol, TRUE);
253 eloop_register_timeout(sm->dot11RSNAConfigSATimeout, 0,
254 rsn_preauth_timeout, sm, NULL);
262 * @sm: Pointer to WPA state machine data from wpa_sm_init()
267 void rsn_preauth_deinit(struct wpa_sm *sm)
269 if (sm == NULL || !sm->preauth_eapol)
272 eloop_cancel_timeout(rsn_preauth_timeout, sm, NULL);
273 eapol_sm_deinit(sm->preauth_eapol);
274 sm->preauth_eapol = NULL;
275 os_memset(sm->preauth_bssid, 0, ETH_ALEN);
277 l2_packet_deinit(sm->l2_preauth);
278 sm->l2_preauth = NULL;
279 if (sm->l2_preauth_br) {
280 l2_packet_deinit(sm->l2_preauth_br);
281 sm->l2_preauth_br = NULL;
288 * @sm: Pointer to WPA state machine data from wpa_sm_init()
294 void rsn_preauth_candidate_process(struct wpa_sm *sm)
298 if (sm->pmksa_candidates == NULL)
303 wpa_msg(sm->ctx->ctx, MSG_DEBUG, "RSN: processing PMKSA candidate "
305 if (sm->preauth_eapol ||
306 sm->proto != WPA_PROTO_RSN ||
307 wpa_sm_get_state(sm) != WPA_COMPLETED ||
308 sm->key_mgmt != WPA_KEY_MGMT_IEEE8021X) {
309 wpa_msg(sm->ctx->ctx, MSG_DEBUG, "RSN: not in suitable state "
314 while (sm->pmksa_candidates) {
316 candidate = sm->pmksa_candidates;
317 p = pmksa_cache_get(sm->pmksa, candidate->bssid, NULL);
318 if (os_memcmp(sm->bssid, candidate->bssid, ETH_ALEN) != 0 &&
320 wpa_msg(sm->ctx->ctx, MSG_DEBUG, "RSN: PMKSA "
324 sm->pmksa_candidates = candidate->next;
325 rsn_preauth_init(sm, candidate->bssid, sm->cur_ssid);
329 wpa_msg(sm->ctx->ctx, MSG_DEBUG, "RSN: PMKSA candidate "
335 wpa_sm_add_pmkid(sm, candidate->bssid, p->pmkid);
338 sm->pmksa_candidates = candidate->next;
341 wpa_msg(sm->ctx->ctx, MSG_DEBUG, "RSN: no more pending PMKSA "
348 * @sm: Pointer to WPA state machine data from wpa_sm_init()
357 void pmksa_candidate_add(struct wpa_sm *sm, const u8 *bssid,
362 if (sm->cur_ssid && sm->cur_ssid->proactive_key_caching)
363 pmksa_cache_get_opportunistic(sm->pmksa, sm->cur_ssid, bssid);
374 cand = sm->pmksa_candidates;
380 sm->pmksa_candidates = cand->next;
401 pos = sm->pmksa_candidates;
412 sm->pmksa_candidates = cand;
414 wpa_msg(sm->ctx->ctx, MSG_DEBUG, "RSN: added PMKSA cache "
416 rsn_preauth_candidate_process(sm);
424 * @sm: Pointer to WPA state machine data from wpa_sm_init()
431 void rsn_preauth_scan_results(struct wpa_sm *sm,
439 if (sm->cur_ssid == NULL)
446 pmksa_candidate_free(sm);
450 if (r->ssid_len != sm->cur_ssid->ssid_len ||
451 os_memcmp(r->ssid, sm->cur_ssid->ssid,
455 if (os_memcmp(r->bssid, sm->bssid, ETH_ALEN) == 0)
462 pmksa = pmksa_cache_get(sm->pmksa, r->bssid, NULL);
472 pmksa_candidate_add(sm, r->bssid,
482 * @sm: Pointer to WPA state machine data from wpa_sm_init()
492 int rsn_preauth_get_status(struct wpa_sm *sm, char *buf, size_t buflen,
498 if (sm->preauth_eapol) {
504 res = eapol_sm_get_status(sm->preauth_eapol,
517 * @sm: Pointer to WPA state machine data from wpa_sm_init()
519 int rsn_preauth_in_progress(struct wpa_sm *sm)
521 return sm->preauth_eapol != NULL;