Lines Matching refs:reg
224 static int wps_set_ie(struct wps_registrar *reg);
230 static void wps_registrar_remove_pin(struct wps_registrar *reg,
233 static void wps_registrar_add_authorized_mac(struct wps_registrar *reg, in wps_registrar_add_authorized_mac() argument
240 if (os_memcmp(reg->authorized_macs[i], addr, ETH_ALEN) == 0) { in wps_registrar_add_authorized_mac()
246 os_memcpy(reg->authorized_macs[i], reg->authorized_macs[i - 1], in wps_registrar_add_authorized_mac()
248 os_memcpy(reg->authorized_macs[0], addr, ETH_ALEN); in wps_registrar_add_authorized_mac()
250 (u8 *) reg->authorized_macs, sizeof(reg->authorized_macs)); in wps_registrar_add_authorized_mac()
254 static void wps_registrar_remove_authorized_mac(struct wps_registrar *reg, in wps_registrar_remove_authorized_mac() argument
261 if (os_memcmp(reg->authorized_macs, addr, ETH_ALEN) == 0) in wps_registrar_remove_authorized_mac()
270 os_memcpy(reg->authorized_macs[i], reg->authorized_macs[i + 1], in wps_registrar_remove_authorized_mac()
272 os_memset(reg->authorized_macs[WPS_MAX_AUTHORIZED_MACS - 1], 0, in wps_registrar_remove_authorized_mac()
275 (u8 *) reg->authorized_macs, sizeof(reg->authorized_macs)); in wps_registrar_remove_authorized_mac()
292 static struct wps_registrar_device * wps_device_get(struct wps_registrar *reg, in wps_device_get() argument
297 for (dev = reg->devices; dev; dev = dev->next) { in wps_device_get()
324 int wps_device_store(struct wps_registrar *reg, in wps_device_store() argument
329 d = wps_device_get(reg, dev->mac_addr); in wps_device_store()
334 d->next = reg->devices; in wps_device_store()
335 reg->devices = d; in wps_device_store()
345 static void wps_registrar_add_pbc_session(struct wps_registrar *reg, in wps_registrar_add_pbc_session() argument
353 pbc = reg->pbc_sessions; in wps_registrar_add_pbc_session()
360 reg->pbc_sessions = pbc->next; in wps_registrar_add_pbc_session()
376 pbc->next = reg->pbc_sessions; in wps_registrar_add_pbc_session()
377 reg->pbc_sessions = pbc; in wps_registrar_add_pbc_session()
397 static void wps_registrar_remove_pbc_session(struct wps_registrar *reg, in wps_registrar_remove_pbc_session() argument
403 pbc = reg->pbc_sessions; in wps_registrar_remove_pbc_session()
406 (p2p_dev_addr && !is_zero_ether_addr(reg->p2p_dev_addr) && in wps_registrar_remove_pbc_session()
407 os_memcmp(reg->p2p_dev_addr, p2p_dev_addr, ETH_ALEN) == in wps_registrar_remove_pbc_session()
412 reg->pbc_sessions = pbc->next; in wps_registrar_remove_pbc_session()
428 int wps_registrar_pbc_overlap(struct wps_registrar *reg, in wps_registrar_pbc_overlap() argument
447 for (pbc = reg->pbc_sessions; pbc; pbc = pbc->next) { in wps_registrar_pbc_overlap()
526 static int wps_build_selected_registrar(struct wps_registrar *reg, in wps_build_selected_registrar() argument
529 if (!reg->sel_reg_union) in wps_build_selected_registrar()
539 static int wps_build_sel_reg_dev_password_id(struct wps_registrar *reg, in wps_build_sel_reg_dev_password_id() argument
542 u16 id = reg->pbc ? DEV_PW_PUSHBUTTON : DEV_PW_DEFAULT; in wps_build_sel_reg_dev_password_id()
543 if (!reg->sel_reg_union) in wps_build_sel_reg_dev_password_id()
545 if (reg->sel_reg_dev_password_id_override >= 0) in wps_build_sel_reg_dev_password_id()
546 id = reg->sel_reg_dev_password_id_override; in wps_build_sel_reg_dev_password_id()
555 static int wps_build_sel_pbc_reg_uuid_e(struct wps_registrar *reg, in wps_build_sel_pbc_reg_uuid_e() argument
558 u16 id = reg->pbc ? DEV_PW_PUSHBUTTON : DEV_PW_DEFAULT; in wps_build_sel_pbc_reg_uuid_e()
559 if (!reg->sel_reg_union) in wps_build_sel_pbc_reg_uuid_e()
561 if (reg->sel_reg_dev_password_id_override >= 0) in wps_build_sel_pbc_reg_uuid_e()
562 id = reg->sel_reg_dev_password_id_override; in wps_build_sel_pbc_reg_uuid_e()
563 if (id != DEV_PW_PUSHBUTTON || !reg->dualband) in wps_build_sel_pbc_reg_uuid_e()
565 return wps_build_uuid_e(msg, reg->wps->uuid); in wps_build_sel_pbc_reg_uuid_e()
592 static int wps_build_sel_reg_config_methods(struct wps_registrar *reg, in wps_build_sel_reg_config_methods() argument
596 if (!reg->sel_reg_union) in wps_build_sel_reg_config_methods()
598 methods = reg->wps->config_methods; in wps_build_sel_reg_config_methods()
602 if (reg->pbc) in wps_build_sel_reg_config_methods()
603 wps_set_pushbutton(&methods, reg->wps->config_methods); in wps_build_sel_reg_config_methods()
604 if (reg->sel_reg_config_methods_override >= 0) in wps_build_sel_reg_config_methods()
605 methods = reg->sel_reg_config_methods_override; in wps_build_sel_reg_config_methods()
615 static int wps_build_probe_config_methods(struct wps_registrar *reg, in wps_build_probe_config_methods() argument
623 methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON; in wps_build_probe_config_methods()
634 static int wps_build_config_methods_r(struct wps_registrar *reg, in wps_build_config_methods_r() argument
637 return wps_build_config_methods(msg, reg->wps->config_methods); in wps_build_config_methods_r()
641 const u8 * wps_authorized_macs(struct wps_registrar *reg, size_t *count) in wps_authorized_macs() argument
646 if (is_zero_ether_addr(reg->authorized_macs_union[*count])) in wps_authorized_macs()
651 return (const u8 *) reg->authorized_macs_union; in wps_authorized_macs()
671 struct wps_registrar *reg = os_zalloc(sizeof(*reg)); in wps_registrar_init() local
672 if (reg == NULL) in wps_registrar_init()
675 dl_list_init(®->pins); in wps_registrar_init()
677 dl_list_init(®->nfc_pw_tokens); in wps_registrar_init()
679 reg->wps = wps; in wps_registrar_init()
680 reg->new_psk_cb = cfg->new_psk_cb; in wps_registrar_init()
681 reg->set_ie_cb = cfg->set_ie_cb; in wps_registrar_init()
682 reg->pin_needed_cb = cfg->pin_needed_cb; in wps_registrar_init()
683 reg->reg_success_cb = cfg->reg_success_cb; in wps_registrar_init()
684 reg->set_sel_reg_cb = cfg->set_sel_reg_cb; in wps_registrar_init()
685 reg->enrollee_seen_cb = cfg->enrollee_seen_cb; in wps_registrar_init()
686 reg->lookup_pskfile_cb = cfg->lookup_pskfile_cb; in wps_registrar_init()
687 reg->cb_ctx = cfg->cb_ctx; in wps_registrar_init()
688 reg->skip_cred_build = cfg->skip_cred_build; in wps_registrar_init()
690 reg->extra_cred = wpabuf_alloc_copy(cfg->extra_cred, in wps_registrar_init()
692 if (reg->extra_cred == NULL) { in wps_registrar_init()
693 os_free(reg); in wps_registrar_init()
697 reg->disable_auto_conf = cfg->disable_auto_conf; in wps_registrar_init()
698 reg->sel_reg_dev_password_id_override = -1; in wps_registrar_init()
699 reg->sel_reg_config_methods_override = -1; in wps_registrar_init()
700 reg->dualband = cfg->dualband; in wps_registrar_init()
701 reg->force_per_enrollee_psk = cfg->force_per_enrollee_psk; in wps_registrar_init()
705 os_memcpy(reg->multi_ap_backhaul_ssid, in wps_registrar_init()
708 reg->multi_ap_backhaul_ssid_len = in wps_registrar_init()
712 reg->multi_ap_backhaul_network_key = in wps_registrar_init()
715 if (reg->multi_ap_backhaul_network_key) in wps_registrar_init()
716 reg->multi_ap_backhaul_network_key_len = in wps_registrar_init()
721 if (wps_set_ie(reg)) { in wps_registrar_init()
722 wps_registrar_deinit(reg); in wps_registrar_init()
726 return reg; in wps_registrar_init()
730 void wps_registrar_flush(struct wps_registrar *reg) in wps_registrar_flush() argument
732 if (reg == NULL) in wps_registrar_flush()
734 wps_free_pins(®->pins); in wps_registrar_flush()
735 wps_free_nfc_pw_tokens(®->nfc_pw_tokens, 0); in wps_registrar_flush()
736 wps_free_pbc_sessions(reg->pbc_sessions); in wps_registrar_flush()
737 reg->pbc_sessions = NULL; in wps_registrar_flush()
738 wps_free_devices(reg->devices); in wps_registrar_flush()
739 reg->devices = NULL; in wps_registrar_flush()
741 reg->pbc_ignore_start.sec = 0; in wps_registrar_flush()
750 void wps_registrar_deinit(struct wps_registrar *reg) in wps_registrar_deinit() argument
752 if (reg == NULL) in wps_registrar_deinit()
754 eloop_cancel_timeout(wps_registrar_pbc_timeout, reg, NULL); in wps_registrar_deinit()
755 eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL); in wps_registrar_deinit()
756 wps_registrar_flush(reg); in wps_registrar_deinit()
757 wpabuf_clear_free(reg->extra_cred); in wps_registrar_deinit()
758 bin_clear_free(reg->multi_ap_backhaul_network_key, in wps_registrar_deinit()
759 reg->multi_ap_backhaul_network_key_len); in wps_registrar_deinit()
760 os_free(reg); in wps_registrar_deinit()
764 static void wps_registrar_invalidate_unused(struct wps_registrar *reg) in wps_registrar_invalidate_unused() argument
768 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) { in wps_registrar_invalidate_unused()
772 wps_registrar_remove_pin(reg, pin); in wps_registrar_invalidate_unused()
789 int wps_registrar_add_pin(struct wps_registrar *reg, const u8 *addr, in wps_registrar_add_pin() argument
818 wps_registrar_invalidate_unused(reg); in wps_registrar_add_pin()
820 dl_list_add(®->pins, &p->list); in wps_registrar_add_pin()
826 reg->selected_registrar = 1; in wps_registrar_add_pin()
827 reg->pbc = 0; in wps_registrar_add_pin()
829 wps_registrar_add_authorized_mac(reg, addr); in wps_registrar_add_pin()
832 reg, (u8 *) "\xff\xff\xff\xff\xff\xff"); in wps_registrar_add_pin()
833 wps_registrar_selected_registrar_changed(reg, 0); in wps_registrar_add_pin()
834 eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL); in wps_registrar_add_pin()
837 reg, NULL); in wps_registrar_add_pin()
843 static void wps_registrar_remove_pin(struct wps_registrar *reg, in wps_registrar_remove_pin() argument
853 wps_registrar_remove_authorized_mac(reg, addr); in wps_registrar_remove_pin()
858 static void wps_registrar_expire_pins(struct wps_registrar *reg) in wps_registrar_expire_pins() argument
864 dl_list_for_each_safe(pin, prev, ®->pins, struct wps_uuid_pin, list) in wps_registrar_expire_pins()
870 wps_registrar_remove_pin(reg, pin); in wps_registrar_expire_pins()
883 static int wps_registrar_invalidate_wildcard_pin(struct wps_registrar *reg, in wps_registrar_invalidate_wildcard_pin() argument
889 dl_list_for_each_safe(pin, prev, ®->pins, struct wps_uuid_pin, list) in wps_registrar_invalidate_wildcard_pin()
898 wps_registrar_remove_pin(reg, pin); in wps_registrar_invalidate_wildcard_pin()
913 int wps_registrar_invalidate_pin(struct wps_registrar *reg, const u8 *uuid) in wps_registrar_invalidate_pin() argument
917 dl_list_for_each_safe(pin, prev, ®->pins, struct wps_uuid_pin, list) in wps_registrar_invalidate_pin()
922 wps_registrar_remove_pin(reg, pin); in wps_registrar_invalidate_pin()
931 static const u8 * wps_registrar_get_pin(struct wps_registrar *reg, in wps_registrar_get_pin() argument
937 wps_registrar_expire_pins(reg); in wps_registrar_get_pin()
939 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) { in wps_registrar_get_pin()
950 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) { in wps_registrar_get_pin()
993 int wps_registrar_unlock_pin(struct wps_registrar *reg, const u8 *uuid) in wps_registrar_unlock_pin() argument
997 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) { in wps_registrar_unlock_pin()
1002 return wps_registrar_invalidate_pin(reg, uuid); in wps_registrar_unlock_pin()
1013 static void wps_registrar_stop_pbc(struct wps_registrar *reg) in wps_registrar_stop_pbc() argument
1015 reg->selected_registrar = 0; in wps_registrar_stop_pbc()
1016 reg->pbc = 0; in wps_registrar_stop_pbc()
1017 os_memset(reg->p2p_dev_addr, 0, ETH_ALEN); in wps_registrar_stop_pbc()
1018 wps_registrar_remove_authorized_mac(reg, in wps_registrar_stop_pbc()
1020 wps_registrar_selected_registrar_changed(reg, 0); in wps_registrar_stop_pbc()
1026 struct wps_registrar *reg = eloop_ctx; in wps_registrar_pbc_timeout() local
1029 wps_pbc_timeout_event(reg->wps); in wps_registrar_pbc_timeout()
1030 wps_registrar_stop_pbc(reg); in wps_registrar_pbc_timeout()
1048 int wps_registrar_button_pushed(struct wps_registrar *reg, in wps_registrar_button_pushed() argument
1052 wps_registrar_pbc_overlap(reg, NULL, NULL)) { in wps_registrar_button_pushed()
1055 wps_pbc_overlap_event(reg->wps); in wps_registrar_button_pushed()
1059 reg->force_pbc_overlap = 0; in wps_registrar_button_pushed()
1060 reg->selected_registrar = 1; in wps_registrar_button_pushed()
1061 reg->pbc = 1; in wps_registrar_button_pushed()
1063 os_memcpy(reg->p2p_dev_addr, p2p_dev_addr, ETH_ALEN); in wps_registrar_button_pushed()
1065 os_memset(reg->p2p_dev_addr, 0, ETH_ALEN); in wps_registrar_button_pushed()
1066 wps_registrar_add_authorized_mac(reg, in wps_registrar_button_pushed()
1068 wps_registrar_selected_registrar_changed(reg, 0); in wps_registrar_button_pushed()
1070 wps_pbc_active_event(reg->wps); in wps_registrar_button_pushed()
1071 eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL); in wps_registrar_button_pushed()
1072 eloop_cancel_timeout(wps_registrar_pbc_timeout, reg, NULL); in wps_registrar_button_pushed()
1074 reg, NULL); in wps_registrar_button_pushed()
1079 static void wps_registrar_pbc_completed(struct wps_registrar *reg) in wps_registrar_pbc_completed() argument
1082 eloop_cancel_timeout(wps_registrar_pbc_timeout, reg, NULL); in wps_registrar_pbc_completed()
1083 wps_registrar_stop_pbc(reg); in wps_registrar_pbc_completed()
1084 wps_pbc_disable_event(reg->wps); in wps_registrar_pbc_completed()
1088 static void wps_registrar_pin_completed(struct wps_registrar *reg) in wps_registrar_pin_completed() argument
1091 eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL); in wps_registrar_pin_completed()
1092 reg->selected_registrar = 0; in wps_registrar_pin_completed()
1093 wps_registrar_selected_registrar_changed(reg, 0); in wps_registrar_pin_completed()
1121 int wps_registrar_wps_cancel(struct wps_registrar *reg) in wps_registrar_wps_cancel() argument
1123 if (reg->pbc) { in wps_registrar_wps_cancel()
1125 wps_registrar_pbc_timeout(reg, NULL); in wps_registrar_wps_cancel()
1126 eloop_cancel_timeout(wps_registrar_pbc_timeout, reg, NULL); in wps_registrar_wps_cancel()
1128 } else if (reg->selected_registrar) { in wps_registrar_wps_cancel()
1131 wps_registrar_pin_completed(reg); in wps_registrar_wps_cancel()
1132 wps_registrar_invalidate_wildcard_pin(reg, NULL, 0); in wps_registrar_wps_cancel()
1149 void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr, in wps_registrar_probe_req_rx() argument
1175 if (reg->enrollee_seen_cb && attr.uuid_e && in wps_registrar_probe_req_rx()
1185 reg->enrollee_seen_cb(reg->cb_ctx, addr, attr.uuid_e, in wps_registrar_probe_req_rx()
1207 if (reg->pbc_ignore_start.sec && in wps_registrar_probe_req_rx()
1208 os_memcmp(attr.uuid_e, reg->pbc_ignore_uuid, WPS_UUID_LEN) == 0) { in wps_registrar_probe_req_rx()
1211 os_reltime_sub(&now, ®->pbc_ignore_start, &dur); in wps_registrar_probe_req_rx()
1218 reg->pbc_ignore_start.sec = 0; in wps_registrar_probe_req_rx()
1223 wps_registrar_add_pbc_session(reg, addr, attr.uuid_e); in wps_registrar_probe_req_rx()
1224 if (wps_registrar_pbc_overlap(reg, addr, attr.uuid_e)) { in wps_registrar_probe_req_rx()
1226 reg->force_pbc_overlap = 1; in wps_registrar_probe_req_rx()
1227 wps_pbc_overlap_event(reg->wps); in wps_registrar_probe_req_rx()
1245 int wps_cb_new_psk(struct wps_registrar *reg, const u8 *mac_addr, in wps_cb_new_psk() argument
1248 if (reg->new_psk_cb == NULL) in wps_cb_new_psk()
1251 return reg->new_psk_cb(reg->cb_ctx, mac_addr, p2p_dev_addr, psk, in wps_cb_new_psk()
1256 static void wps_cb_pin_needed(struct wps_registrar *reg, const u8 *uuid_e, in wps_cb_pin_needed() argument
1259 if (reg->pin_needed_cb == NULL) in wps_cb_pin_needed()
1262 reg->pin_needed_cb(reg->cb_ctx, uuid_e, dev); in wps_cb_pin_needed()
1266 static void wps_cb_reg_success(struct wps_registrar *reg, const u8 *mac_addr, in wps_cb_reg_success() argument
1270 if (reg->reg_success_cb == NULL) in wps_cb_reg_success()
1273 reg->reg_success_cb(reg->cb_ctx, mac_addr, uuid_e, dev_pw, dev_pw_len); in wps_cb_reg_success()
1277 static int wps_cb_set_ie(struct wps_registrar *reg, struct wpabuf *beacon_ie, in wps_cb_set_ie() argument
1280 return reg->set_ie_cb(reg->cb_ctx, beacon_ie, probe_resp_ie); in wps_cb_set_ie()
1284 static void wps_cb_set_sel_reg(struct wps_registrar *reg) in wps_cb_set_sel_reg() argument
1287 if (reg->set_sel_reg_cb == NULL) in wps_cb_set_sel_reg()
1290 if (reg->selected_registrar) { in wps_cb_set_sel_reg()
1291 methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON; in wps_cb_set_sel_reg()
1294 if (reg->pbc) in wps_cb_set_sel_reg()
1295 wps_set_pushbutton(&methods, reg->wps->config_methods); in wps_cb_set_sel_reg()
1300 reg->selected_registrar, reg->wps->config_methods, in wps_cb_set_sel_reg()
1301 reg->pbc, methods); in wps_cb_set_sel_reg()
1303 reg->set_sel_reg_cb(reg->cb_ctx, reg->selected_registrar, in wps_cb_set_sel_reg()
1304 reg->pbc ? DEV_PW_PUSHBUTTON : DEV_PW_DEFAULT, in wps_cb_set_sel_reg()
1310 static int wps_cp_lookup_pskfile(struct wps_registrar *reg, const u8 *mac_addr, in wps_cp_lookup_pskfile() argument
1313 if (!reg->lookup_pskfile_cb) in wps_cp_lookup_pskfile()
1315 return reg->lookup_pskfile_cb(reg->cb_ctx, mac_addr, psk); in wps_cp_lookup_pskfile()
1319 static int wps_set_ie(struct wps_registrar *reg) in wps_set_ie() argument
1328 if (reg->set_ie_cb == NULL) in wps_set_ie()
1332 if (reg->wps->dev.vendor_ext[i]) { in wps_set_ie()
1334 vendor_len += wpabuf_len(reg->wps->dev.vendor_ext[i]); in wps_set_ie()
1343 auth_macs = wps_authorized_macs(reg, &count); in wps_set_ie()
1348 wps_build_wps_state(reg->wps, beacon) || in wps_set_ie()
1349 wps_build_ap_setup_locked(reg->wps, beacon) || in wps_set_ie()
1350 wps_build_selected_registrar(reg, beacon) || in wps_set_ie()
1351 wps_build_sel_reg_dev_password_id(reg, beacon) || in wps_set_ie()
1352 wps_build_sel_reg_config_methods(reg, beacon) || in wps_set_ie()
1353 wps_build_sel_pbc_reg_uuid_e(reg, beacon) || in wps_set_ie()
1354 (reg->dualband && wps_build_rf_bands(®->wps->dev, beacon, 0)) || in wps_set_ie()
1356 wps_build_vendor_ext(®->wps->dev, beacon) || in wps_set_ie()
1357 wps_build_application_ext(®->wps->dev, beacon)) in wps_set_ie()
1361 if (wps_build_dev_name(®->wps->dev, beacon) || in wps_set_ie()
1362 wps_build_primary_dev_type(®->wps->dev, beacon)) in wps_set_ie()
1369 wps_build_wps_state(reg->wps, probe) || in wps_set_ie()
1370 wps_build_ap_setup_locked(reg->wps, probe) || in wps_set_ie()
1371 wps_build_selected_registrar(reg, probe) || in wps_set_ie()
1372 wps_build_sel_reg_dev_password_id(reg, probe) || in wps_set_ie()
1373 wps_build_sel_reg_config_methods(reg, probe) || in wps_set_ie()
1374 wps_build_resp_type(probe, reg->wps->ap ? WPS_RESP_AP : in wps_set_ie()
1376 wps_build_uuid_e(probe, reg->wps->uuid) || in wps_set_ie()
1377 wps_build_device_attrs(®->wps->dev, probe) || in wps_set_ie()
1378 wps_build_probe_config_methods(reg, probe) || in wps_set_ie()
1379 (reg->dualband && wps_build_rf_bands(®->wps->dev, probe, 0)) || in wps_set_ie()
1381 wps_build_vendor_ext(®->wps->dev, probe) || in wps_set_ie()
1382 wps_build_application_ext(®->wps->dev, probe)) in wps_set_ie()
1391 return wps_cb_set_ie(reg, beacon, probe); in wps_set_ie()
1639 struct wps_registrar *reg = wps->wps->registrar; in wps_build_cred() local
1656 reg->multi_ap_backhaul_ssid_len) { in wps_build_cred()
1658 os_memcpy(wps->cred.ssid, reg->multi_ap_backhaul_ssid, in wps_build_cred()
1659 reg->multi_ap_backhaul_ssid_len); in wps_build_cred()
1660 wps->cred.ssid_len = reg->multi_ap_backhaul_ssid_len; in wps_build_cred()
1668 if (reg->multi_ap_backhaul_network_key) { in wps_build_cred()
1670 reg->multi_ap_backhaul_network_key, in wps_build_cred()
1671 reg->multi_ap_backhaul_network_key_len); in wps_build_cred()
1673 reg->multi_ap_backhaul_network_key_len; in wps_build_cred()
1763 } else if (wps_cp_lookup_pskfile(reg, wps->mac_addr_e, &pskfile_psk)) { in wps_build_cred()
2622 struct wps_registrar *reg = wps->wps->registrar; in wps_registrar_p2p_dev_addr_match() local
2624 if (is_zero_ether_addr(reg->p2p_dev_addr)) in wps_registrar_p2p_dev_addr_match()
2627 if (os_memcmp(reg->p2p_dev_addr, wps->p2p_dev_addr, ETH_ALEN) != 0) { in wps_registrar_p2p_dev_addr_match()
2631 MAC2STR(reg->p2p_dev_addr), in wps_registrar_p2p_dev_addr_match()
2643 struct wps_registrar *reg = wps->wps->registrar; in wps_registrar_skip_overlap() local
2645 if (is_zero_ether_addr(reg->p2p_dev_addr)) in wps_registrar_skip_overlap()
2648 if (os_memcmp(reg->p2p_dev_addr, wps->p2p_dev_addr, ETH_ALEN) == 0) { in wps_registrar_skip_overlap()
3483 int wps_registrar_update_ie(struct wps_registrar *reg) in wps_registrar_update_ie() argument
3485 return wps_set_ie(reg); in wps_registrar_update_ie()
3492 struct wps_registrar *reg = eloop_ctx; in wps_registrar_set_selected_timeout() local
3496 reg->selected_registrar = 0; in wps_registrar_set_selected_timeout()
3497 reg->pbc = 0; in wps_registrar_set_selected_timeout()
3498 wps_registrar_expire_pins(reg); in wps_registrar_set_selected_timeout()
3499 wps_registrar_selected_registrar_changed(reg, 0); in wps_registrar_set_selected_timeout()
3500 wps_selected_registrar_timeout_event(reg->wps); in wps_registrar_set_selected_timeout()
3505 static void wps_registrar_sel_reg_add(struct wps_registrar *reg, in wps_registrar_sel_reg_add() argument
3512 reg->sel_reg_union = 1; in wps_registrar_sel_reg_add()
3513 if (reg->sel_reg_dev_password_id_override != DEV_PW_PUSHBUTTON) in wps_registrar_sel_reg_add()
3514 reg->sel_reg_dev_password_id_override = s->dev_password_id; in wps_registrar_sel_reg_add()
3515 if (reg->sel_reg_config_methods_override == -1) in wps_registrar_sel_reg_add()
3516 reg->sel_reg_config_methods_override = 0; in wps_registrar_sel_reg_add()
3517 reg->sel_reg_config_methods_override |= s->config_methods; in wps_registrar_sel_reg_add()
3519 if (is_zero_ether_addr(reg->authorized_macs_union[i])) in wps_registrar_sel_reg_add()
3527 os_memcpy(reg->authorized_macs_union[i], in wps_registrar_sel_reg_add()
3532 (u8 *) reg->authorized_macs_union, in wps_registrar_sel_reg_add()
3533 sizeof(reg->authorized_macs_union)); in wps_registrar_sel_reg_add()
3538 static void wps_registrar_sel_reg_union(struct wps_registrar *reg) in wps_registrar_sel_reg_union() argument
3543 if (reg->wps->wps_upnp == NULL) in wps_registrar_sel_reg_union()
3546 dl_list_for_each(s, ®->wps->wps_upnp->subscriptions, in wps_registrar_sel_reg_union()
3556 wps_registrar_sel_reg_add(reg, s); in wps_registrar_sel_reg_union()
3572 void wps_registrar_selected_registrar_changed(struct wps_registrar *reg, in wps_registrar_selected_registrar_changed() argument
3577 reg->sel_reg_union = reg->selected_registrar; in wps_registrar_selected_registrar_changed()
3578 reg->sel_reg_dev_password_id_override = -1; in wps_registrar_selected_registrar_changed()
3579 reg->sel_reg_config_methods_override = -1; in wps_registrar_selected_registrar_changed()
3580 os_memcpy(reg->authorized_macs_union, reg->authorized_macs, in wps_registrar_selected_registrar_changed()
3583 (u8 *) reg->authorized_macs_union, in wps_registrar_selected_registrar_changed()
3584 sizeof(reg->authorized_macs_union)); in wps_registrar_selected_registrar_changed()
3585 if (reg->selected_registrar) { in wps_registrar_selected_registrar_changed()
3588 methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON; in wps_registrar_selected_registrar_changed()
3591 if (reg->pbc) { in wps_registrar_selected_registrar_changed()
3592 reg->sel_reg_dev_password_id_override = in wps_registrar_selected_registrar_changed()
3594 wps_set_pushbutton(&methods, reg->wps->config_methods); in wps_registrar_selected_registrar_changed()
3596 reg->sel_reg_dev_password_id_override = dev_pw_id; in wps_registrar_selected_registrar_changed()
3598 "(pbc=%d)", reg->pbc); in wps_registrar_selected_registrar_changed()
3599 reg->sel_reg_config_methods_override = methods; in wps_registrar_selected_registrar_changed()
3603 wps_registrar_sel_reg_union(reg); in wps_registrar_selected_registrar_changed()
3605 wps_set_ie(reg); in wps_registrar_selected_registrar_changed()
3606 wps_cb_set_sel_reg(reg); in wps_registrar_selected_registrar_changed()
3610 int wps_registrar_get_info(struct wps_registrar *reg, const u8 *addr, in wps_registrar_get_info() argument
3618 d = wps_device_get(reg, addr); in wps_registrar_get_info()
3648 int wps_registrar_config_ap(struct wps_registrar *reg, in wps_registrar_config_ap() argument
3679 if (reg->wps->cred_cb) in wps_registrar_config_ap()
3680 return reg->wps->cred_cb(reg->wps->cb_ctx, cred); in wps_registrar_config_ap()
3686 int wps_registrar_update_multi_ap(struct wps_registrar *reg, in wps_registrar_update_multi_ap() argument
3693 os_memcpy(reg->multi_ap_backhaul_ssid, in wps_registrar_update_multi_ap()
3695 reg->multi_ap_backhaul_ssid_len = multi_ap_backhaul_ssid_len; in wps_registrar_update_multi_ap()
3698 os_free(reg->multi_ap_backhaul_network_key); in wps_registrar_update_multi_ap()
3699 reg->multi_ap_backhaul_network_key = NULL; in wps_registrar_update_multi_ap()
3700 reg->multi_ap_backhaul_network_key_len = 0; in wps_registrar_update_multi_ap()
3702 reg->multi_ap_backhaul_network_key = in wps_registrar_update_multi_ap()
3705 if (!reg->multi_ap_backhaul_network_key) in wps_registrar_update_multi_ap()
3707 reg->multi_ap_backhaul_network_key_len = in wps_registrar_update_multi_ap()
3717 int wps_registrar_add_nfc_pw_token(struct wps_registrar *reg, in wps_registrar_add_nfc_pw_token() argument
3734 wps_free_nfc_pw_tokens(®->nfc_pw_tokens, pw_id); in wps_registrar_add_nfc_pw_token()
3753 dl_list_add(®->nfc_pw_tokens, &token->list); in wps_registrar_add_nfc_pw_token()
3755 reg->selected_registrar = 1; in wps_registrar_add_nfc_pw_token()
3756 reg->pbc = 0; in wps_registrar_add_nfc_pw_token()
3757 wps_registrar_add_authorized_mac(reg, in wps_registrar_add_nfc_pw_token()
3759 wps_registrar_selected_registrar_changed(reg, pw_id); in wps_registrar_add_nfc_pw_token()
3760 eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL); in wps_registrar_add_nfc_pw_token()
3763 reg, NULL); in wps_registrar_add_nfc_pw_token()
3772 int wps_registrar_add_nfc_password_token(struct wps_registrar *reg, in wps_registrar_add_nfc_password_token() argument
3798 return wps_registrar_add_nfc_pw_token(reg, hash, id, dev_pw, in wps_registrar_add_nfc_password_token()
3803 void wps_registrar_remove_nfc_pw_token(struct wps_registrar *reg, in wps_registrar_remove_nfc_pw_token() argument
3806 wps_registrar_remove_authorized_mac(reg, in wps_registrar_remove_nfc_pw_token()
3808 wps_registrar_selected_registrar_changed(reg, 0); in wps_registrar_remove_nfc_pw_token()