Lines Matching defs:sm

35  * @sm: Pointer to WPA state machine data from wpa_sm_init()
37 void pmksa_candidate_free(struct wpa_sm *sm)
41 if (sm == NULL)
44 dl_list_for_each_safe(entry, n, &sm->pmksa_candidates,
55 struct wpa_sm *sm = ctx;
60 if (sm->preauth_eapol == NULL ||
61 is_zero_ether_addr(sm->preauth_bssid) ||
62 os_memcmp(sm->preauth_bssid, src_addr, ETH_ALEN) != 0) {
69 eapol_sm_rx_eapol(sm->preauth_eapol, src_addr, buf, len);
77 struct wpa_sm *sm = ctx;
95 sm->pmk_len = pmk_len;
96 pmksa_cache_add(sm->pmksa, pmk, pmk_len, NULL,
98 sm->preauth_bssid, sm->own_addr,
99 sm->network_ctx,
102 wpa_msg(sm->ctx->msg_ctx, MSG_INFO,
109 wpa_msg(sm->ctx->msg_ctx, MSG_INFO, "RSN: pre-authentication with "
110 MACSTR " %s", MAC2STR(sm->preauth_bssid),
114 rsn_preauth_deinit(sm);
115 rsn_preauth_candidate_process(sm);
121 struct wpa_sm *sm = eloop_ctx;
123 wpa_msg(sm->ctx->msg_ctx, MSG_INFO, "RSN: pre-authentication with "
124 MACSTR " timed out", MAC2STR(sm->preauth_bssid));
125 rsn_preauth_deinit(sm);
126 rsn_preauth_candidate_process(sm);
133 struct wpa_sm *sm = ctx;
141 if (sm->l2_preauth == NULL)
144 msg = wpa_sm_alloc_eapol(sm, type, buf, len, &msglen, NULL);
149 res = l2_packet_send(sm->l2_preauth, sm->preauth_bssid,
158 * @sm: Pointer to WPA state machine data from wpa_sm_init()
170 int rsn_preauth_init(struct wpa_sm *sm, const u8 *dst,
177 if (sm->preauth_eapol)
180 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG,
183 sm->l2_preauth = l2_packet_init(sm->ifname, sm->own_addr,
185 rsn_preauth_receive, sm, 0);
186 if (sm->l2_preauth == NULL) {
192 if (sm->bridge_ifname) {
193 sm->l2_preauth_br = l2_packet_init(sm->bridge_ifname,
194 sm->own_addr,
196 rsn_preauth_receive, sm, 0);
197 if (sm->l2_preauth_br == NULL) {
212 ctx->ctx = sm->ctx->ctx;
213 ctx->msg_ctx = sm->ctx->ctx;
216 ctx->cb_ctx = sm;
217 ctx->scard_ctx = sm->scard_ctx;
219 ctx->eapol_send_ctx = sm;
220 ctx->set_config_blob = sm->ctx->set_config_blob;
221 ctx->get_config_blob = sm->ctx->get_config_blob;
223 sm->preauth_eapol = eapol_sm_init(ctx);
224 if (sm->preauth_eapol == NULL) {
234 eapol_conf.fast_reauth = sm->fast_reauth;
235 eapol_conf.workaround = sm->eap_workaround;
236 eapol_sm_notify_config(sm->preauth_eapol, eap_conf, &eapol_conf);
243 eapol_sm_configure(sm->preauth_eapol, -1, -1, 5, 6);
244 os_memcpy(sm->preauth_bssid, dst, ETH_ALEN);
246 eapol_sm_notify_portValid(sm->preauth_eapol, TRUE);
248 eapol_sm_notify_portEnabled(sm->preauth_eapol, TRUE);
250 eloop_register_timeout(sm->dot11RSNAConfigSATimeout, 0,
251 rsn_preauth_timeout, sm, NULL);
256 if (sm->l2_preauth_br) {
257 l2_packet_deinit(sm->l2_preauth_br);
258 sm->l2_preauth_br = NULL;
260 l2_packet_deinit(sm->l2_preauth);
261 sm->l2_preauth = NULL;
268 * @sm: Pointer to WPA state machine data from wpa_sm_init()
273 void rsn_preauth_deinit(struct wpa_sm *sm)
275 if (sm == NULL || !sm->preauth_eapol)
278 eloop_cancel_timeout(rsn_preauth_timeout, sm, NULL);
279 eapol_sm_deinit(sm->preauth_eapol);
280 sm->preauth_eapol = NULL;
281 os_memset(sm->preauth_bssid, 0, ETH_ALEN);
283 l2_packet_deinit(sm->l2_preauth);
284 sm->l2_preauth = NULL;
285 if (sm->l2_preauth_br) {
286 l2_packet_deinit(sm->l2_preauth_br);
287 sm->l2_preauth_br = NULL;
294 * @sm: Pointer to WPA state machine data from wpa_sm_init()
300 void rsn_preauth_candidate_process(struct wpa_sm *sm)
304 if (dl_list_empty(&sm->pmksa_candidates))
309 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: processing PMKSA candidate "
311 if (sm->preauth_eapol ||
312 sm->proto != WPA_PROTO_RSN ||
313 wpa_sm_get_state(sm) != WPA_COMPLETED ||
314 (sm->key_mgmt != WPA_KEY_MGMT_IEEE8021X &&
315 sm->key_mgmt != WPA_KEY_MGMT_IEEE8021X_SHA256 &&
316 sm->key_mgmt != WPA_KEY_MGMT_IEEE8021X_SUITE_B &&
317 sm->key_mgmt != WPA_KEY_MGMT_IEEE8021X_SUITE_B_192)) {
318 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: not in suitable "
323 dl_list_for_each_safe(candidate, n, &sm->pmksa_candidates,
326 p = pmksa_cache_get(sm->pmksa, candidate->bssid, NULL, NULL, 0);
327 if (os_memcmp(sm->bssid, candidate->bssid, ETH_ALEN) != 0 &&
329 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: PMKSA "
334 rsn_preauth_init(sm, candidate->bssid,
335 sm->eap_conf_ctx);
339 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: PMKSA candidate "
345 wpa_sm_add_pmkid(sm, NULL, candidate->bssid, p->pmkid,
352 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: no more pending PMKSA "
359 * @sm: Pointer to WPA state machine data from wpa_sm_init()
368 void pmksa_candidate_add(struct wpa_sm *sm, const u8 *bssid,
373 if (sm->network_ctx && sm->proactive_key_caching)
374 pmksa_cache_get_opportunistic(sm->pmksa, sm->network_ctx,
386 dl_list_for_each(pos, &sm->pmksa_candidates,
408 dl_list_for_each(pos, &sm->pmksa_candidates,
429 dl_list_add_tail(&sm->pmksa_candidates, &cand->list);
431 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: added PMKSA cache "
433 rsn_preauth_candidate_process(sm);
441 * @sm: Pointer to WPA state machine data from wpa_sm_init()
448 int rsn_preauth_scan_results(struct wpa_sm *sm)
450 if (sm->ssid_len == 0)
457 pmksa_candidate_free(sm);
465 * @sm: Pointer to WPA state machine data from wpa_sm_init()
470 void rsn_preauth_scan_result(struct wpa_sm *sm, const u8 *bssid,
476 if (ssid[1] != sm->ssid_len ||
477 os_memcmp(ssid + 2, sm->ssid, sm->ssid_len) != 0)
480 if (os_memcmp(bssid, sm->bssid, ETH_ALEN) == 0)
486 pmksa = pmksa_cache_get(sm->pmksa, bssid, NULL, NULL, 0);
492 pmksa_candidate_add(sm, bssid, PMKID_CANDIDATE_PRIO_SCAN,
500 * @sm: Pointer to WPA state machine data from wpa_sm_init()
510 int rsn_preauth_get_status(struct wpa_sm *sm, char *buf, size_t buflen,
516 if (sm->preauth_eapol) {
522 res = eapol_sm_get_status(sm->preauth_eapol,
535 * @sm: Pointer to WPA state machine data from wpa_sm_init()
537 int rsn_preauth_in_progress(struct wpa_sm *sm)
539 return sm->preauth_eapol != NULL;