Lines Matching refs:hapd
33 static int hostapd_wps_upnp_init(struct hostapd_data *hapd,
35 static void hostapd_wps_upnp_deinit(struct hostapd_data *hapd);
61 struct hostapd_data *hapd = iface->bss[j];
64 if (hapd != data->calling_hapd &&
65 (hapd->conf->wps_independent ||
69 ret = data->func(hapd, data->ctx);
78 static int hostapd_wps_for_each(struct hostapd_data *hapd,
82 struct hostapd_iface *iface = hapd->iface;
86 data.calling_hapd = hapd;
99 struct hostapd_data *hapd = ctx;
101 struct hostapd_ssid *ssid = &hapd->conf->ssid;
129 if (hapd->new_psk_cb) {
130 hapd->new_psk_cb(hapd->new_psk_cb_ctx, mac_addr, p2p_dev_addr,
160 struct hostapd_data *hapd = ctx;
161 wpabuf_free(hapd->wps_beacon_ie);
162 hapd->wps_beacon_ie = beacon_ie;
163 wpabuf_free(hapd->wps_probe_resp_ie);
164 hapd->wps_probe_resp_ie = probe_resp_ie;
165 if (hapd->beacon_set_done)
166 ieee802_11_set_beacon(hapd);
167 return hostapd_set_ap_wps_ie(hapd);
174 struct hostapd_data *hapd = ctx;
189 wpa_msg(hapd->msg_ctx, MSG_INFO, "%s", txt);
191 if (hapd->conf->wps_pin_requests) {
194 f = fopen(hapd->conf->wps_pin_requests, "a");
217 static int wps_stop_registrar(struct hostapd_data *hapd, void *ctx)
220 if (hapd != data->current_hapd && hapd->wps != NULL)
221 wps_registrar_complete(hapd->wps->registrar, data->uuid_e,
231 struct hostapd_data *hapd = ctx;
236 wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_REG_SUCCESS MACSTR " %s",
238 if (hapd->wps_reg_success_cb)
239 hapd->wps_reg_success_cb(hapd->wps_reg_success_cb_ctx,
241 data.current_hapd = hapd;
245 hostapd_wps_for_each(hapd, wps_stop_registrar, &data);
256 struct hostapd_data *hapd = ctx;
263 wpa_msg_ctrl(hapd->msg_ctx, MSG_INFO, WPS_EVENT_ENROLLEE_SEEN MACSTR
291 void hostapd_wps_eap_completed(struct hostapd_data *hapd)
299 if (eloop_deplete_timeout(0, 0, wps_reload_config, hapd->iface, NULL) ==
305 static void hapd_new_ap_event(struct hostapd_data *hapd, const u8 *attr,
312 wpa_msg(hapd->msg_ctx, MSG_INFO,
319 static int hapd_wps_reconfig_in_memory(struct hostapd_data *hapd,
322 struct hostapd_bss_config *bss = hapd->conf;
351 if (hapd->iconf->hw_mode == HOSTAPD_MODE_IEEE80211AD)
394 eloop_register_timeout(0, 100000, wps_reload_config, hapd->iface,
401 static int hapd_wps_cred_cb(struct hostapd_data *hapd, void *ctx)
411 if (hapd->wps == NULL)
428 if ((hapd->conf->wps_cred_processing == 1 ||
429 hapd->conf->wps_cred_processing == 2) && cred->cred_attr) {
430 hapd_new_ap_event(hapd, cred->cred_attr, cred->cred_attr_len);
431 } else if (hapd->conf->wps_cred_processing == 1 ||
432 hapd->conf->wps_cred_processing == 2) {
436 hapd_new_ap_event(hapd, wpabuf_head_u8(attr),
440 wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_NEW_AP_SETTINGS);
442 if (hapd->conf->wps_cred_processing == 1)
445 os_memcpy(hapd->wps->ssid, cred->ssid, cred->ssid_len);
446 hapd->wps->ssid_len = cred->ssid_len;
447 hapd->wps->encr_types = cred->encr_type;
448 hapd->wps->encr_types_rsn = cred->encr_type;
449 hapd->wps->encr_types_wpa = cred->encr_type;
450 hapd->wps->auth_types = cred->auth_type;
451 hapd->wps->ap_encr_type = cred->encr_type;
452 hapd->wps->ap_auth_type = cred->auth_type;
454 os_free(hapd->wps->network_key);
455 hapd->wps->network_key = NULL;
456 hapd->wps->network_key_len = 0;
463 if (hapd->wps->network_key == NULL ||
464 hapd->wps->network_key_len < cred->key_len) {
465 hapd->wps->network_key_len = 0;
466 os_free(hapd->wps->network_key);
467 hapd->wps->network_key = os_malloc(cred->key_len);
468 if (hapd->wps->network_key == NULL)
471 hapd->wps->network_key_len = cred->key_len;
472 os_memcpy(hapd->wps->network_key, cred->key, cred->key_len);
474 hapd->wps->wps_state = WPS_STATE_CONFIGURED;
476 if (hapd->iface->config_fname == NULL)
477 return hapd_wps_reconfig_in_memory(hapd, cred);
478 len = os_strlen(hapd->iface->config_fname) + 5;
482 os_snprintf(tmp_fname, len, "%s-new", hapd->iface->config_fname);
484 oconf = fopen(hapd->iface->config_fname, "r");
544 if (hapd->iconf->hw_mode == HOSTAPD_MODE_IEEE80211AD)
608 if (rename(tmp_fname, hapd->iface->config_fname) < 0) {
620 eloop_register_timeout(0, 100000, wps_reload_config, hapd->iface,
631 struct hostapd_data *hapd = ctx;
632 return hostapd_wps_for_each(hapd, hapd_wps_cred_cb, (void *) cred);
638 struct hostapd_data *hapd = eloop_data;
640 if (hapd->conf->ap_setup_locked)
642 if (hapd->ap_pin_failures_consecutive >= 10)
646 wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_AP_SETUP_UNLOCKED);
647 hapd->wps->ap_setup_locked = 0;
648 wps_registrar_update_ie(hapd->wps->registrar);
652 static int wps_pwd_auth_fail(struct hostapd_data *hapd, void *ctx)
656 if (!data->enrollee || hapd->conf->ap_pin == NULL || hapd->wps == NULL)
664 hapd->ap_pin_failures++;
665 hapd->ap_pin_failures_consecutive++;
668 hapd->ap_pin_failures, hapd->ap_pin_failures_consecutive);
669 if (hapd->ap_pin_failures < 3)
672 wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_AP_SETUP_LOCKED);
673 hapd->wps->ap_setup_locked = 1;
675 wps_registrar_update_ie(hapd->wps->registrar);
677 if (!hapd->conf->ap_setup_locked &&
678 hapd->ap_pin_failures_consecutive >= 10) {
683 eloop_cancel_timeout(hostapd_wps_reenable_ap_pin, hapd, NULL);
685 } else if (!hapd->conf->ap_setup_locked) {
686 if (hapd->ap_pin_lockout_time == 0)
687 hapd->ap_pin_lockout_time = 60;
688 else if (hapd->ap_pin_lockout_time < 365 * 24 * 60 * 60 &&
689 (hapd->ap_pin_failures % 3) == 0)
690 hapd->ap_pin_lockout_time *= 2;
693 hapd->ap_pin_lockout_time);
694 eloop_cancel_timeout(hostapd_wps_reenable_ap_pin, hapd, NULL);
695 eloop_register_timeout(hapd->ap_pin_lockout_time, 0,
696 hostapd_wps_reenable_ap_pin, hapd,
704 static void hostapd_pwd_auth_fail(struct hostapd_data *hapd,
709 hapd->wps_stats.status = WPS_STATUS_FAILURE;
710 hapd->wps_stats.failure_reason = WPS_EI_AUTH_FAILURE;
711 os_memcpy(hapd->wps_stats.peer_addr, data->peer_macaddr, ETH_ALEN);
713 hostapd_wps_for_each(hapd, wps_pwd_auth_fail, data);
717 static int wps_ap_pin_success(struct hostapd_data *hapd, void *ctx)
719 if (hapd->conf->ap_pin == NULL || hapd->wps == NULL)
722 if (hapd->ap_pin_failures_consecutive == 0)
727 hapd->ap_pin_failures, hapd->ap_pin_failures_consecutive);
728 hapd->ap_pin_failures_consecutive = 0;
734 static void hostapd_wps_ap_pin_success(struct hostapd_data *hapd)
736 hostapd_wps_for_each(hapd, wps_ap_pin_success, NULL);
740 static void hostapd_wps_event_pbc_overlap(struct hostapd_data *hapd)
743 hapd->wps_stats.pbc_status = WPS_PBC_STATUS_OVERLAP;
747 static void hostapd_wps_event_pbc_timeout(struct hostapd_data *hapd)
750 hapd->wps_stats.pbc_status = WPS_PBC_STATUS_TIMEOUT;
754 static void hostapd_wps_event_pbc_active(struct hostapd_data *hapd)
757 hapd->wps_stats.pbc_status = WPS_PBC_STATUS_ACTIVE;
761 static void hostapd_wps_event_pbc_disable(struct hostapd_data *hapd)
764 hapd->wps_stats.pbc_status = WPS_PBC_STATUS_DISABLE;
768 static void hostapd_wps_event_success(struct hostapd_data *hapd,
772 hapd->wps_stats.pbc_status = WPS_PBC_STATUS_DISABLE;
773 hapd->wps_stats.status = WPS_STATUS_SUCCESS;
774 os_memcpy(hapd->wps_stats.peer_addr, success->peer_macaddr, ETH_ALEN);
778 static void hostapd_wps_event_fail(struct hostapd_data *hapd,
782 hapd->wps_stats.status = WPS_STATUS_FAILURE;
783 os_memcpy(hapd->wps_stats.peer_addr, fail->peer_macaddr, ETH_ALEN);
785 hapd->wps_stats.failure_reason = fail->error_indication;
789 wpa_msg(hapd->msg_ctx, MSG_INFO,
794 wpa_msg(hapd->msg_ctx, MSG_INFO,
804 struct hostapd_data *hapd = ctx;
808 wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_M2D);
811 hostapd_wps_event_fail(hapd, &data->fail);
814 hostapd_wps_event_success(hapd, &data->success);
815 wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_SUCCESS);
818 hostapd_pwd_auth_fail(hapd, &data->pwd_auth_fail);
821 hostapd_wps_event_pbc_overlap(hapd);
822 wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_OVERLAP);
825 hostapd_wps_event_pbc_timeout(hapd);
826 wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_TIMEOUT);
829 hostapd_wps_event_pbc_active(hapd);
830 wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_ACTIVE);
833 hostapd_wps_event_pbc_disable(hapd);
834 wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_DISABLE);
849 hostapd_wps_ap_pin_success(hapd);
852 if (hapd->wps_event_cb)
853 hapd->wps_event_cb(hapd->wps_event_cb_ctx, event, data);
859 struct hostapd_data *hapd = ctx;
861 return hapd->iconf->hw_mode == HOSTAPD_MODE_IEEE80211A ?
863 hapd->iconf->hw_mode == HOSTAPD_MODE_IEEE80211AD ?
868 static void hostapd_wps_clear_ies(struct hostapd_data *hapd, int deinit_only)
870 wpabuf_free(hapd->wps_beacon_ie);
871 hapd->wps_beacon_ie = NULL;
873 wpabuf_free(hapd->wps_probe_resp_ie);
874 hapd->wps_probe_resp_ie = NULL;
877 if (hapd->drv_priv)
878 hostapd_reset_ap_wps_ie(hapd);
882 hostapd_set_ap_wps_ie(hapd);
894 struct hostapd_data *hapd = iface->bss[j];
895 if (hapd->wps && !hapd->conf->wps_independent &&
896 !is_nil_uuid(hapd->wps->uuid)) {
897 *uuid = hapd->wps->uuid;
939 static int hostapd_wps_set_vendor_ext(struct hostapd_data *hapd,
948 if (hapd->conf->wps_vendor_ext[i] == NULL)
952 wpabuf_dup(hapd->conf->wps_vendor_ext[i]);
979 int hostapd_init_wps(struct hostapd_data *hapd,
986 hostapd_wps_clear_ies(hapd, 0);
997 wps->cb_ctx = hapd;
1000 wps->wps_state = hapd->conf->wps_state;
1001 wps->ap_setup_locked = hapd->conf->ap_setup_locked;
1002 if (is_nil_uuid(hapd->conf->uuid)) {
1004 uuid = get_own_uuid(hapd->iface);
1010 uuid_gen_mac_addr(hapd->own_addr, wps->uuid);
1015 os_memcpy(wps->uuid, hapd->conf->uuid, UUID_LEN);
1019 wps->ssid_len = hapd->conf->ssid.ssid_len;
1020 os_memcpy(wps->ssid, hapd->conf->ssid.ssid, wps->ssid_len);
1022 os_memcpy(wps->dev.mac_addr, hapd->own_addr, ETH_ALEN);
1023 wps->dev.device_name = hapd->conf->device_name ?
1024 os_strdup(hapd->conf->device_name) : NULL;
1025 wps->dev.manufacturer = hapd->conf->manufacturer ?
1026 os_strdup(hapd->conf->manufacturer) : NULL;
1027 wps->dev.model_name = hapd->conf->model_name ?
1028 os_strdup(hapd->conf->model_name) : NULL;
1029 wps->dev.model_number = hapd->conf->model_number ?
1030 os_strdup(hapd->conf->model_number) : NULL;
1031 wps->dev.serial_number = hapd->conf->serial_number ?
1032 os_strdup(hapd->conf->serial_number) : NULL;
1034 wps_config_methods_str2bin(hapd->conf->config_methods);
1049 os_memcpy(wps->dev.pri_dev_type, hapd->conf->device_type,
1052 if (hostapd_wps_set_vendor_ext(hapd, wps) < 0)
1055 wps->dev.os_version = WPA_GET_BE32(hapd->conf->os_version);
1061 hapd->iconf->hw_mode == HOSTAPD_MODE_IEEE80211A ?
1063 hapd->iconf->hw_mode == HOSTAPD_MODE_IEEE80211AD ?
1148 cfg.cb_ctx = hapd;
1152 cfg.disable_auto_conf = (hapd->conf->wps_cred_processing == 1) &&
1156 cfg.dualband = interface_count(hapd->iface) > 1;
1171 wps->friendly_name = hapd->conf->friendly_name;
1172 wps->manufacturer_url = hapd->conf->manufacturer_url;
1173 wps->model_description = hapd->conf->model_description;
1174 wps->model_url = hapd->conf->model_url;
1175 wps->upc = hapd->conf->upc;
1178 hostapd_register_probereq_cb(hapd, hostapd_wps_probe_req_rx, hapd);
1180 hapd->wps = wps;
1190 int hostapd_init_wps_complete(struct hostapd_data *hapd)
1192 struct wps_context *wps = hapd->wps;
1198 if (hostapd_wps_upnp_init(hapd, wps) < 0) {
1202 hapd->wps = NULL;
1226 void hostapd_deinit_wps(struct hostapd_data *hapd)
1228 eloop_cancel_timeout(hostapd_wps_reenable_ap_pin, hapd, NULL);
1229 eloop_cancel_timeout(hostapd_wps_ap_pin_timeout, hapd, NULL);
1230 eloop_cancel_timeout(wps_reload_config, hapd->iface, NULL);
1231 if (hapd->wps == NULL) {
1232 hostapd_wps_clear_ies(hapd, 1);
1236 hostapd_wps_upnp_deinit(hapd);
1238 wps_registrar_deinit(hapd->wps->registrar);
1239 wps_free_pending_msgs(hapd->wps->upnp_msgs);
1240 hostapd_free_wps(hapd->wps);
1241 hapd->wps = NULL;
1242 hostapd_wps_clear_ies(hapd, 1);
1246 void hostapd_update_wps(struct hostapd_data *hapd)
1248 if (hapd->wps == NULL)
1252 hapd->wps->friendly_name = hapd->conf->friendly_name;
1253 hapd->wps->manufacturer_url = hapd->conf->manufacturer_url;
1254 hapd->wps->model_description = hapd->conf->model_description;
1255 hapd->wps->model_url = hapd->conf->model_url;
1256 hapd->wps->upc = hapd->conf->upc;
1259 hostapd_wps_set_vendor_ext(hapd, hapd->wps);
1261 if (hapd->conf->wps_state)
1262 wps_registrar_update_ie(hapd->wps->registrar);
1264 hostapd_deinit_wps(hapd);
1278 static int wps_add_pin(struct hostapd_data *hapd, void *ctx)
1283 if (hapd->wps == NULL)
1285 ret = wps_registrar_add_pin(hapd->wps->registrar, data->addr,
1294 int hostapd_wps_add_pin(struct hostapd_data *hapd, const u8 *addr,
1314 if (hostapd_wps_for_each(hapd, wps_add_pin, &data) < 0)
1325 static int wps_button_pushed(struct hostapd_data *hapd, void *ctx)
1329 if (hapd->wps) {
1331 return wps_registrar_button_pushed(hapd->wps->registrar,
1339 int hostapd_wps_button_pushed(struct hostapd_data *hapd,
1347 ret = hostapd_wps_for_each(hapd, wps_button_pushed, &ctx);
1358 static int wps_cancel(struct hostapd_data *hapd, void *ctx)
1362 if (hapd->wps) {
1364 wps_registrar_wps_cancel(hapd->wps->registrar);
1365 ap_for_each_sta(hapd, ap_sta_wps_cancel, NULL);
1372 int hostapd_wps_cancel(struct hostapd_data *hapd)
1378 ret = hostapd_wps_for_each(hapd, wps_cancel, &ctx);
1390 struct hostapd_data *hapd = ctx;
1394 if (hapd->wps == NULL)
1404 (elems.ssid_len != hapd->conf->ssid.ssid_len ||
1405 os_memcmp(elems.ssid, hapd->conf->ssid.ssid, elems.ssid_len) !=
1425 wps_registrar_probe_req_rx(hapd->wps->registrar, addr, wps_ie,
1432 hapd->wps_upnp, addr,
1450 struct hostapd_data *hapd = priv;
1469 sta = ap_get_sta(hapd, mac_addr);
1479 for (sta = hapd->sta_list; sta; sta = sta->next) {
1507 p->next = hapd->wps->upnp_msgs;
1508 hapd->wps->upnp_msgs = p;
1514 static int hostapd_wps_upnp_init(struct hostapd_data *hapd,
1519 if (!hapd->conf->upnp_iface)
1526 if (hapd->conf->ap_pin)
1527 ctx->ap_pin = os_strdup(hapd->conf->ap_pin);
1529 hapd->wps_upnp = upnp_wps_device_init(ctx, wps, hapd,
1530 hapd->conf->upnp_iface);
1531 if (hapd->wps_upnp == NULL)
1533 wps->wps_upnp = hapd->wps_upnp;
1539 static void hostapd_wps_upnp_deinit(struct hostapd_data *hapd)
1541 upnp_wps_device_deinit(hapd->wps_upnp, hapd);
1547 int hostapd_wps_get_mib_sta(struct hostapd_data *hapd, const u8 *addr,
1550 if (hapd->wps == NULL)
1552 return wps_registrar_get_info(hapd->wps->registrar, addr, buf, buflen);
1558 struct hostapd_data *hapd = eloop_data;
1560 hostapd_wps_ap_pin_disable(hapd);
1561 wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_AP_PIN_DISABLED);
1565 static void hostapd_wps_ap_pin_enable(struct hostapd_data *hapd, int timeout)
1568 hapd->ap_pin_failures = 0;
1569 hapd->ap_pin_failures_consecutive = 0;
1570 hapd->conf->ap_setup_locked = 0;
1571 if (hapd->wps->ap_setup_locked) {
1572 wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_AP_SETUP_UNLOCKED);
1573 hapd->wps->ap_setup_locked = 0;
1574 wps_registrar_update_ie(hapd->wps->registrar);
1576 eloop_cancel_timeout(hostapd_wps_ap_pin_timeout, hapd, NULL);
1579 hostapd_wps_ap_pin_timeout, hapd, NULL);
1583 static int wps_ap_pin_disable(struct hostapd_data *hapd, void *ctx)
1585 os_free(hapd->conf->ap_pin);
1586 hapd->conf->ap_pin = NULL;
1588 upnp_wps_set_ap_pin(hapd->wps_upnp, NULL);
1590 eloop_cancel_timeout(hostapd_wps_ap_pin_timeout, hapd, NULL);
1595 void hostapd_wps_ap_pin_disable(struct hostapd_data *hapd)
1598 hostapd_wps_for_each(hapd, wps_ap_pin_disable, NULL);
1608 static int wps_ap_pin_set(struct hostapd_data *hapd, void *ctx)
1612 if (!hapd->wps)
1615 os_free(hapd->conf->ap_pin);
1616 hapd->conf->ap_pin = os_strdup(data->pin_txt);
1618 upnp_wps_set_ap_pin(hapd->wps_upnp, data->pin_txt);
1620 hostapd_wps_ap_pin_enable(hapd, data->timeout);
1625 const char * hostapd_wps_ap_pin_random(struct hostapd_data *hapd, int timeout)
1634 hostapd_wps_for_each(hapd, wps_ap_pin_set, &data);
1635 return hapd->conf->ap_pin;
1639 const char * hostapd_wps_ap_pin_get(struct hostapd_data *hapd)
1641 return hapd->conf->ap_pin;
1645 int hostapd_wps_ap_pin_set(struct hostapd_data *hapd, const char *pin,
1655 return hostapd_wps_for_each(hapd, wps_ap_pin_set, &data);
1659 static int wps_update_ie(struct hostapd_data *hapd, void *ctx)
1661 if (hapd->wps)
1662 wps_registrar_update_ie(hapd->wps->registrar);
1667 void hostapd_wps_update_ie(struct hostapd_data *hapd)
1669 hostapd_wps_for_each(hapd, wps_update_ie, NULL);
1673 int hostapd_wps_config_ap(struct hostapd_data *hapd, const char *ssid,
1716 return wps_registrar_config_ap(hapd->wps->registrar, &cred);
1729 static int wps_add_nfc_password_token(struct hostapd_data *hapd, void *ctx)
1734 if (hapd->wps == NULL)
1736 ret = wps_registrar_add_nfc_password_token(hapd->wps->registrar,
1745 static int hostapd_wps_add_nfc_password_token(struct hostapd_data *hapd,
1753 if (hostapd_wps_for_each(hapd, wps_add_nfc_password_token, &data) < 0)
1759 static int hostapd_wps_nfc_tag_process(struct hostapd_data *hapd,
1772 return hostapd_wps_add_nfc_password_token(hapd, &attr);
1779 int hostapd_wps_nfc_tag_read(struct hostapd_data *hapd,
1799 ret = hostapd_wps_nfc_tag_process(hapd, wps);
1805 struct wpabuf * hostapd_wps_nfc_config_token(struct hostapd_data *hapd,
1810 if (hapd->wps == NULL)
1813 ret = wps_get_oob_cred(hapd->wps, hostapd_wps_rf_band_cb(hapd),
1814 hapd->iconf->channel);
1828 struct wpabuf * hostapd_wps_nfc_hs_cr(struct hostapd_data *hapd, int ndef)
1832 if (hapd->wps == NULL)
1835 if (hapd->conf->wps_nfc_dh_pubkey == NULL) {
1836 struct wps_context *wps = hapd->wps;
1837 if (wps_nfc_gen_dh(&hapd->conf->wps_nfc_dh_pubkey,
1838 &hapd->conf->wps_nfc_dh_privkey) < 0)
1843 wpabuf_dup(hapd->conf->wps_nfc_dh_pubkey);
1845 wpabuf_dup(hapd->conf->wps_nfc_dh_privkey);
1852 ret = wps_build_nfc_handover_sel(hapd->wps,
1853 hapd->conf->wps_nfc_dh_pubkey,
1854 hapd->own_addr, hapd->iface->freq);
1869 int hostapd_wps_nfc_report_handover(struct hostapd_data *hapd,
1952 ret = wps_registrar_add_nfc_pw_token(hapd->wps->registrar,
1963 struct wpabuf * hostapd_wps_nfc_token_gen(struct hostapd_data *hapd, int ndef)
1965 if (hapd->conf->wps_nfc_pw_from_config) {
1967 hapd->conf->wps_nfc_dev_pw_id,
1968 hapd->conf->wps_nfc_dh_pubkey,
1969 hapd->conf->wps_nfc_dev_pw);
1972 return wps_nfc_token_gen(ndef, &hapd->conf->wps_nfc_dev_pw_id,
1973 &hapd->conf->wps_nfc_dh_pubkey,
1974 &hapd->conf->wps_nfc_dh_privkey,
1975 &hapd->conf->wps_nfc_dev_pw);
1979 int hostapd_wps_nfc_token_enable(struct hostapd_data *hapd)
1981 struct wps_context *wps = hapd->wps;
1987 if (!hapd->conf->wps_nfc_dh_pubkey ||
1988 !hapd->conf->wps_nfc_dh_privkey ||
1989 !hapd->conf->wps_nfc_dev_pw ||
1990 !hapd->conf->wps_nfc_dev_pw_id)
1996 hapd->conf->wps_nfc_dev_pw_id, hapd->conf->iface, wps);
1997 wps->ap_nfc_dev_pw_id = hapd->conf->wps_nfc_dev_pw_id;
1998 wps->ap_nfc_dh_pubkey = wpabuf_dup(hapd->conf->wps_nfc_dh_pubkey);
1999 wps->ap_nfc_dh_privkey = wpabuf_dup(hapd->conf->wps_nfc_dh_privkey);
2000 pw = hapd->conf->wps_nfc_dev_pw;
2021 void hostapd_wps_nfc_token_disable(struct hostapd_data *hapd)
2024 hapd->conf->iface);
2025 hostapd_wps_nfc_clear(hapd->wps);