Lines Matching refs:wps
34 struct wps_context *wps);
43 static void hostapd_wps_nfc_clear(struct wps_context *wps);
128 p->wps = 1; in hostapd_wps_new_psk_cb()
222 if (hapd != data->current_hapd && hapd->wps != NULL) in wps_stop_registrar()
223 wps_registrar_complete(hapd->wps->registrar, data->uuid_e, in wps_stop_registrar()
284 if (!wpa_psk->wps) in hostapd_wps_lookup_pskfile_cb()
466 if (hapd->wps == NULL) in hapd_wps_cred_cb()
500 os_memcpy(hapd->wps->ssid, cred->ssid, cred->ssid_len); in hapd_wps_cred_cb()
501 hapd->wps->ssid_len = cred->ssid_len; in hapd_wps_cred_cb()
502 hapd->wps->encr_types = cred->encr_type; in hapd_wps_cred_cb()
503 hapd->wps->encr_types_rsn = cred->encr_type; in hapd_wps_cred_cb()
504 hapd->wps->encr_types_wpa = cred->encr_type; in hapd_wps_cred_cb()
505 hapd->wps->auth_types = cred->auth_type; in hapd_wps_cred_cb()
506 hapd->wps->ap_encr_type = cred->encr_type; in hapd_wps_cred_cb()
507 hapd->wps->ap_auth_type = cred->auth_type; in hapd_wps_cred_cb()
509 os_free(hapd->wps->network_key); in hapd_wps_cred_cb()
510 hapd->wps->network_key = NULL; in hapd_wps_cred_cb()
511 hapd->wps->network_key_len = 0; in hapd_wps_cred_cb()
518 if (hapd->wps->network_key == NULL || in hapd_wps_cred_cb()
519 hapd->wps->network_key_len < cred->key_len) { in hapd_wps_cred_cb()
520 hapd->wps->network_key_len = 0; in hapd_wps_cred_cb()
521 os_free(hapd->wps->network_key); in hapd_wps_cred_cb()
522 hapd->wps->network_key = os_malloc(cred->key_len); in hapd_wps_cred_cb()
523 if (hapd->wps->network_key == NULL) in hapd_wps_cred_cb()
526 hapd->wps->network_key_len = cred->key_len; in hapd_wps_cred_cb()
527 os_memcpy(hapd->wps->network_key, cred->key, cred->key_len); in hapd_wps_cred_cb()
529 hapd->wps->wps_state = WPS_STATE_CONFIGURED; in hapd_wps_cred_cb()
733 hapd->wps->ap_setup_locked = 0; in hostapd_wps_reenable_ap_pin()
734 wps_registrar_update_ie(hapd->wps->registrar); in hostapd_wps_reenable_ap_pin()
742 if (!data->enrollee || hapd->conf->ap_pin == NULL || hapd->wps == NULL) in wps_pwd_auth_fail()
759 hapd->wps->ap_setup_locked = 1; in wps_pwd_auth_fail()
761 wps_registrar_update_ie(hapd->wps->registrar); in wps_pwd_auth_fail()
805 if (hapd->conf->ap_pin == NULL || hapd->wps == NULL) in wps_ap_pin_success()
981 if (hapd->wps && !hapd->conf->wps_independent && in get_uuid_cb()
982 !is_nil_uuid(hapd->wps->uuid)) { in get_uuid_cb()
983 *uuid = hapd->wps->uuid; in get_uuid_cb()
1026 struct wps_context *wps) in hostapd_wps_set_vendor_ext() argument
1031 wpabuf_free(wps->dev.vendor_ext[i]); in hostapd_wps_set_vendor_ext()
1032 wps->dev.vendor_ext[i] = NULL; in hostapd_wps_set_vendor_ext()
1037 wps->dev.vendor_ext[i] = in hostapd_wps_set_vendor_ext()
1039 if (wps->dev.vendor_ext[i] == NULL) { in hostapd_wps_set_vendor_ext()
1041 wpabuf_free(wps->dev.vendor_ext[i]); in hostapd_wps_set_vendor_ext()
1051 struct wps_context *wps) in hostapd_wps_set_application_ext() argument
1053 wpabuf_free(wps->dev.application_ext); in hostapd_wps_set_application_ext()
1056 wps->dev.application_ext = NULL; in hostapd_wps_set_application_ext()
1060 wps->dev.application_ext = wpabuf_dup(hapd->conf->wps_application_ext); in hostapd_wps_set_application_ext()
1061 return wps->dev.application_ext ? 0 : -1; in hostapd_wps_set_application_ext()
1065 static void hostapd_free_wps(struct wps_context *wps) in hostapd_free_wps() argument
1070 wpabuf_free(wps->dev.vendor_ext[i]); in hostapd_free_wps()
1071 wps_device_data_free(&wps->dev); in hostapd_free_wps()
1072 os_free(wps->network_key); in hostapd_free_wps()
1073 hostapd_wps_nfc_clear(wps); in hostapd_free_wps()
1074 wpabuf_free(wps->dh_pubkey); in hostapd_free_wps()
1075 wpabuf_free(wps->dh_privkey); in hostapd_free_wps()
1076 os_free(wps); in hostapd_free_wps()
1083 struct wps_context *wps; in hostapd_init_wps() local
1092 wps = os_zalloc(sizeof(*wps)); in hostapd_init_wps()
1093 if (wps == NULL) in hostapd_init_wps()
1096 wps->cred_cb = hostapd_wps_cred_cb; in hostapd_init_wps()
1097 wps->event_cb = hostapd_wps_event_cb; in hostapd_init_wps()
1098 wps->rf_band_cb = hostapd_wps_rf_band_cb; in hostapd_init_wps()
1099 wps->cb_ctx = hapd; in hostapd_init_wps()
1102 wps->wps_state = hapd->conf->wps_state; in hostapd_init_wps()
1103 wps->ap_setup_locked = hapd->conf->ap_setup_locked; in hostapd_init_wps()
1108 os_memcpy(wps->uuid, uuid, UUID_LEN); in hostapd_init_wps()
1110 "interface", wps->uuid, UUID_LEN); in hostapd_init_wps()
1112 uuid_gen_mac_addr(hapd->own_addr, wps->uuid); in hostapd_init_wps()
1114 "address", wps->uuid, UUID_LEN); in hostapd_init_wps()
1117 os_memcpy(wps->uuid, hapd->conf->uuid, UUID_LEN); in hostapd_init_wps()
1119 wps->uuid, UUID_LEN); in hostapd_init_wps()
1121 wps->ssid_len = hapd->conf->ssid.ssid_len; in hostapd_init_wps()
1122 os_memcpy(wps->ssid, hapd->conf->ssid.ssid, wps->ssid_len); in hostapd_init_wps()
1123 wps->ap = 1; in hostapd_init_wps()
1124 os_memcpy(wps->dev.mac_addr, hapd->own_addr, ETH_ALEN); in hostapd_init_wps()
1125 wps->dev.device_name = hapd->conf->device_name ? in hostapd_init_wps()
1127 wps->dev.manufacturer = hapd->conf->manufacturer ? in hostapd_init_wps()
1129 wps->dev.model_name = hapd->conf->model_name ? in hostapd_init_wps()
1131 wps->dev.model_number = hapd->conf->model_number ? in hostapd_init_wps()
1133 wps->dev.serial_number = hapd->conf->serial_number ? in hostapd_init_wps()
1135 wps->config_methods = in hostapd_init_wps()
1137 if ((wps->config_methods & in hostapd_init_wps()
1142 wps->config_methods |= WPS_CONFIG_VIRT_DISPLAY; in hostapd_init_wps()
1144 if ((wps->config_methods & in hostapd_init_wps()
1149 wps->config_methods |= WPS_CONFIG_VIRT_PUSHBUTTON; in hostapd_init_wps()
1151 os_memcpy(wps->dev.pri_dev_type, hapd->conf->device_type, in hostapd_init_wps()
1154 if (hostapd_wps_set_vendor_ext(hapd, wps) < 0 || in hostapd_init_wps()
1155 hostapd_wps_set_application_ext(hapd, wps) < 0) in hostapd_init_wps()
1158 wps->dev.os_version = WPA_GET_BE32(hapd->conf->os_version); in hostapd_init_wps()
1161 wps->dev.rf_bands = conf->wps_rf_bands; in hostapd_init_wps()
1163 wps->dev.rf_bands = in hostapd_init_wps()
1172 wps->auth_types |= WPS_AUTH_WPA2PSK; in hostapd_init_wps()
1174 wps->auth_types |= WPS_AUTH_WPA2; in hostapd_init_wps()
1179 wps->encr_types |= WPS_ENCR_AES; in hostapd_init_wps()
1180 wps->encr_types_rsn |= WPS_ENCR_AES; in hostapd_init_wps()
1187 wps->encr_types |= WPS_ENCR_TKIP; in hostapd_init_wps()
1188 wps->encr_types_rsn |= WPS_ENCR_TKIP; in hostapd_init_wps()
1202 wps->auth_types |= WPS_AUTH_WPAPSK; in hostapd_init_wps()
1204 wps->auth_types |= WPS_AUTH_WPA; in hostapd_init_wps()
1207 wps->encr_types |= WPS_ENCR_AES; in hostapd_init_wps()
1208 wps->encr_types_wpa |= WPS_ENCR_AES; in hostapd_init_wps()
1211 wps->encr_types |= WPS_ENCR_TKIP; in hostapd_init_wps()
1212 wps->encr_types_wpa |= WPS_ENCR_TKIP; in hostapd_init_wps()
1218 wps->encr_types |= WPS_ENCR_NONE; in hostapd_init_wps()
1219 wps->auth_types |= WPS_AUTH_OPEN; in hostapd_init_wps()
1225 wps->network_key = (u8 *) os_strdup(conf->ssid.wpa_passphrase); in hostapd_init_wps()
1226 wps->network_key_len = os_strlen(conf->ssid.wpa_passphrase); in hostapd_init_wps()
1228 wps->network_key = os_malloc(2 * PMK_LEN + 1); in hostapd_init_wps()
1229 if (wps->network_key == NULL) in hostapd_init_wps()
1231 wpa_snprintf_hex((char *) wps->network_key, 2 * PMK_LEN + 1, in hostapd_init_wps()
1233 wps->network_key_len = 2 * PMK_LEN; in hostapd_init_wps()
1236 wps->network_key = os_malloc(conf->ssid.wep.len[0]); in hostapd_init_wps()
1237 if (wps->network_key == NULL) in hostapd_init_wps()
1239 os_memcpy(wps->network_key, conf->ssid.wep.key[0], in hostapd_init_wps()
1241 wps->network_key_len = conf->ssid.wep.len[0]; in hostapd_init_wps()
1246 os_memcpy(wps->psk, conf->ssid.wpa_psk->psk, PMK_LEN); in hostapd_init_wps()
1247 wps->psk_set = 1; in hostapd_init_wps()
1250 wps->ap_auth_type = wps->auth_types; in hostapd_init_wps()
1251 wps->ap_encr_type = wps->encr_types; in hostapd_init_wps()
1255 wps->auth_types = WPS_AUTH_WPA2PSK; in hostapd_init_wps()
1256 wps->encr_types = WPS_ENCR_AES; in hostapd_init_wps()
1257 wps->encr_types_rsn = WPS_ENCR_AES; in hostapd_init_wps()
1258 wps->encr_types_wpa = WPS_ENCR_AES; in hostapd_init_wps()
1260 wps->auth_types = WPS_AUTH_WPA2PSK | WPS_AUTH_WPAPSK; in hostapd_init_wps()
1261 wps->encr_types = WPS_ENCR_AES | WPS_ENCR_TKIP; in hostapd_init_wps()
1262 wps->encr_types_rsn = WPS_ENCR_AES | WPS_ENCR_TKIP; in hostapd_init_wps()
1263 wps->encr_types_wpa = WPS_ENCR_AES | WPS_ENCR_TKIP; in hostapd_init_wps()
1292 wps->ap_settings = conf->ap_settings; in hostapd_init_wps()
1293 wps->ap_settings_len = conf->ap_settings_len; in hostapd_init_wps()
1308 if ((wps->dev.rf_bands & (WPS_RF_50GHZ | WPS_RF_24GHZ)) == in hostapd_init_wps()
1315 wps->registrar = wps_registrar_init(wps, &cfg); in hostapd_init_wps()
1316 if (wps->registrar == NULL) { in hostapd_init_wps()
1322 wps->friendly_name = hapd->conf->friendly_name; in hostapd_init_wps()
1323 wps->manufacturer_url = hapd->conf->manufacturer_url; in hostapd_init_wps()
1324 wps->model_description = hapd->conf->model_description; in hostapd_init_wps()
1325 wps->model_url = hapd->conf->model_url; in hostapd_init_wps()
1326 wps->upc = hapd->conf->upc; in hostapd_init_wps()
1331 hapd->wps = wps; in hostapd_init_wps()
1338 hostapd_free_wps(wps); in hostapd_init_wps()
1345 struct wps_context *wps = hapd->wps; in hostapd_init_wps_complete() local
1347 if (wps == NULL) in hostapd_init_wps_complete()
1351 if (hostapd_wps_upnp_init(hapd, wps) < 0) { in hostapd_init_wps_complete()
1353 wps_registrar_deinit(wps->registrar); in hostapd_init_wps_complete()
1354 hostapd_free_wps(wps); in hostapd_init_wps_complete()
1355 hapd->wps = NULL; in hostapd_init_wps_complete()
1364 static void hostapd_wps_nfc_clear(struct wps_context *wps) in hostapd_wps_nfc_clear() argument
1367 wpa_printf(MSG_DEBUG, "WPS: Clear NFC Tag context %p", wps); in hostapd_wps_nfc_clear()
1368 wps->ap_nfc_dev_pw_id = 0; in hostapd_wps_nfc_clear()
1369 wpabuf_free(wps->ap_nfc_dh_pubkey); in hostapd_wps_nfc_clear()
1370 wps->ap_nfc_dh_pubkey = NULL; in hostapd_wps_nfc_clear()
1371 wpabuf_free(wps->ap_nfc_dh_privkey); in hostapd_wps_nfc_clear()
1372 wps->ap_nfc_dh_privkey = NULL; in hostapd_wps_nfc_clear()
1373 wpabuf_free(wps->ap_nfc_dev_pw); in hostapd_wps_nfc_clear()
1374 wps->ap_nfc_dev_pw = NULL; in hostapd_wps_nfc_clear()
1426 if (hapd->wps == NULL) { in hostapd_deinit_wps()
1433 wps_registrar_deinit(hapd->wps->registrar); in hostapd_deinit_wps()
1434 wps_free_pending_msgs(hapd->wps->upnp_msgs); in hostapd_deinit_wps()
1435 hostapd_free_wps(hapd->wps); in hostapd_deinit_wps()
1436 hapd->wps = NULL; in hostapd_deinit_wps()
1443 struct wps_context *wps = hapd->wps; in hostapd_update_wps() local
1446 if (!wps) in hostapd_update_wps()
1450 wps->friendly_name = conf->friendly_name; in hostapd_update_wps()
1451 wps->manufacturer_url = conf->manufacturer_url; in hostapd_update_wps()
1452 wps->model_description = conf->model_description; in hostapd_update_wps()
1453 wps->model_url = conf->model_url; in hostapd_update_wps()
1454 wps->upc = conf->upc; in hostapd_update_wps()
1457 os_memcpy(wps->ssid, conf->ssid.ssid, conf->ssid.ssid_len); in hostapd_update_wps()
1458 wps->ssid_len = conf->ssid.ssid_len; in hostapd_update_wps()
1461 os_free(wps->network_key); in hostapd_update_wps()
1462 wps->network_key = NULL; in hostapd_update_wps()
1463 wps->network_key_len = 0; in hostapd_update_wps()
1464 wps->psk_set = 0; in hostapd_update_wps()
1468 wps->network_key = (u8 *) os_strdup(conf->ssid.wpa_passphrase); in hostapd_update_wps()
1469 if (!wps->network_key) in hostapd_update_wps()
1471 wps->network_key_len = os_strlen(conf->ssid.wpa_passphrase); in hostapd_update_wps()
1473 wps->network_key = os_malloc(2 * PMK_LEN + 1); in hostapd_update_wps()
1474 if (!wps->network_key) in hostapd_update_wps()
1476 wpa_snprintf_hex((char *) wps->network_key, 2 * PMK_LEN + 1, in hostapd_update_wps()
1478 wps->network_key_len = 2 * PMK_LEN; in hostapd_update_wps()
1481 wps->network_key = os_malloc(conf->ssid.wep.len[0]); in hostapd_update_wps()
1482 if (!wps->network_key) in hostapd_update_wps()
1484 os_memcpy(wps->network_key, conf->ssid.wep.key[0], in hostapd_update_wps()
1486 wps->network_key_len = conf->ssid.wep.len[0]; in hostapd_update_wps()
1491 os_memcpy(wps->psk, conf->ssid.wpa_psk->psk, PMK_LEN); in hostapd_update_wps()
1492 wps->psk_set = 1; in hostapd_update_wps()
1495 hostapd_wps_update_multi_ap(hapd, wps->registrar); in hostapd_update_wps()
1497 hostapd_wps_set_vendor_ext(hapd, wps); in hostapd_update_wps()
1498 hostapd_wps_set_application_ext(hapd, wps); in hostapd_update_wps()
1501 wps_registrar_update_ie(wps->registrar); in hostapd_update_wps()
1522 if (hapd->wps == NULL) in wps_add_pin()
1524 ret = wps_registrar_add_pin(hapd->wps->registrar, data->addr, in wps_add_pin()
1568 if (hapd->wps) { in wps_button_pushed()
1570 return wps_registrar_button_pushed(hapd->wps->registrar, in wps_button_pushed()
1601 if (hapd->wps) { in wps_cancel()
1603 wps_registrar_wps_cancel(hapd->wps->registrar); in wps_cancel()
1634 if (hapd->wps == NULL) in hostapd_wps_probe_req_rx()
1665 wps_registrar_probe_req_rx(hapd->wps->registrar, addr, wps_ie, in hostapd_wps_probe_req_rx()
1747 p->next = hapd->wps->upnp_msgs; in hostapd_rx_req_put_wlan_response()
1748 hapd->wps->upnp_msgs = p; in hostapd_rx_req_put_wlan_response()
1755 struct wps_context *wps) in hostapd_wps_upnp_init() argument
1769 hapd->wps_upnp = upnp_wps_device_init(ctx, wps, hapd, in hostapd_wps_upnp_init()
1773 wps->wps_upnp = hapd->wps_upnp; in hostapd_wps_upnp_init()
1790 if (hapd->wps == NULL) in hostapd_wps_get_mib_sta()
1792 return wps_registrar_get_info(hapd->wps->registrar, addr, buf, buflen); in hostapd_wps_get_mib_sta()
1811 if (hapd->wps->ap_setup_locked) { in hostapd_wps_ap_pin_enable()
1813 hapd->wps->ap_setup_locked = 0; in hostapd_wps_ap_pin_enable()
1814 wps_registrar_update_ie(hapd->wps->registrar); in hostapd_wps_ap_pin_enable()
1852 if (!hapd->wps) in wps_ap_pin_set()
1901 if (hapd->wps) in wps_update_ie()
1902 wps_registrar_update_ie(hapd->wps->registrar); in wps_update_ie()
1960 return wps_registrar_config_ap(hapd->wps->registrar, &cred); in hostapd_wps_config_ap()
1978 if (hapd->wps == NULL) in wps_add_nfc_password_token()
1980 ret = wps_registrar_add_nfc_password_token(hapd->wps->registrar, in wps_add_nfc_password_token()
2004 const struct wpabuf *wps) in hostapd_wps_nfc_tag_process() argument
2008 wpa_hexdump_buf(MSG_DEBUG, "WPS: Received NFC tag payload", wps); in hostapd_wps_nfc_tag_process()
2010 if (wps_parse_msg(wps, &attr)) { in hostapd_wps_nfc_tag_process()
2026 const struct wpabuf *wps = data; in hostapd_wps_nfc_tag_read() local
2040 wps = tmp; in hostapd_wps_nfc_tag_read()
2043 ret = hostapd_wps_nfc_tag_process(hapd, wps); in hostapd_wps_nfc_tag_read()
2054 if (hapd->wps == NULL) in hostapd_wps_nfc_config_token()
2057 ret = wps_get_oob_cred(hapd->wps, hostapd_wps_rf_band_cb(hapd), in hostapd_wps_nfc_config_token()
2076 if (hapd->wps == NULL) in hostapd_wps_nfc_hs_cr()
2080 struct wps_context *wps = hapd->wps; in hostapd_wps_nfc_hs_cr() local
2084 hostapd_wps_nfc_clear(wps); in hostapd_wps_nfc_hs_cr()
2085 wps->ap_nfc_dev_pw_id = DEV_PW_NFC_CONNECTION_HANDOVER; in hostapd_wps_nfc_hs_cr()
2086 wps->ap_nfc_dh_pubkey = in hostapd_wps_nfc_hs_cr()
2088 wps->ap_nfc_dh_privkey = in hostapd_wps_nfc_hs_cr()
2090 if (!wps->ap_nfc_dh_pubkey || !wps->ap_nfc_dh_privkey) { in hostapd_wps_nfc_hs_cr()
2091 hostapd_wps_nfc_clear(wps); in hostapd_wps_nfc_hs_cr()
2096 ret = wps_build_nfc_handover_sel(hapd->wps, in hostapd_wps_nfc_hs_cr()
2117 struct wpabuf *wps; in hostapd_wps_nfc_report_handover() local
2129 wps = ndef_parse_wifi(req); in hostapd_wps_nfc_report_handover()
2130 if (wps == NULL) in hostapd_wps_nfc_report_handover()
2134 wpa_hexdump_buf(MSG_DEBUG, "WPS: NFC payload", wps); in hostapd_wps_nfc_report_handover()
2135 if (wpabuf_len(wps) < 2) { in hostapd_wps_nfc_report_handover()
2140 pos = wpabuf_head(wps); in hostapd_wps_nfc_report_handover()
2142 if (wsc_len > wpabuf_len(wps) - 2) { in hostapd_wps_nfc_report_handover()
2152 if (wsc_len < wpabuf_len(wps) - 2) { in hostapd_wps_nfc_report_handover()
2155 pos + wsc_len, wpabuf_len(wps) - 2 - wsc_len); in hostapd_wps_nfc_report_handover()
2196 ret = wps_registrar_add_nfc_pw_token(hapd->wps->registrar, in hostapd_wps_nfc_report_handover()
2202 wpabuf_free(wps); in hostapd_wps_nfc_report_handover()
2225 struct wps_context *wps = hapd->wps; in hostapd_wps_nfc_token_enable() local
2228 if (wps == NULL) in hostapd_wps_nfc_token_enable()
2237 hostapd_wps_nfc_clear(wps); in hostapd_wps_nfc_token_enable()
2240 hapd->conf->wps_nfc_dev_pw_id, hapd->conf->iface, wps); in hostapd_wps_nfc_token_enable()
2241 wps->ap_nfc_dev_pw_id = hapd->conf->wps_nfc_dev_pw_id; in hostapd_wps_nfc_token_enable()
2242 wps->ap_nfc_dh_pubkey = wpabuf_dup(hapd->conf->wps_nfc_dh_pubkey); in hostapd_wps_nfc_token_enable()
2243 wps->ap_nfc_dh_privkey = wpabuf_dup(hapd->conf->wps_nfc_dh_privkey); in hostapd_wps_nfc_token_enable()
2245 wps->ap_nfc_dev_pw = wpabuf_alloc( in hostapd_wps_nfc_token_enable()
2247 if (wps->ap_nfc_dev_pw) { in hostapd_wps_nfc_token_enable()
2249 (char *) wpabuf_put(wps->ap_nfc_dev_pw, in hostapd_wps_nfc_token_enable()
2255 if (!wps->ap_nfc_dh_pubkey || !wps->ap_nfc_dh_privkey || in hostapd_wps_nfc_token_enable()
2256 !wps->ap_nfc_dev_pw) { in hostapd_wps_nfc_token_enable()
2257 hostapd_wps_nfc_clear(wps); in hostapd_wps_nfc_token_enable()
2269 hostapd_wps_nfc_clear(hapd->wps); in hostapd_wps_nfc_token_disable()