P2P NFC: Enable own NFC Tag on GO Registrar
When "P2P_SET nfc_tag 1" is used to enable the own NFC Tag for P2P, also enable it for any running GO interface. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
abe44e3ca2
commit
dd87677115
2 changed files with 42 additions and 0 deletions
|
@ -1373,6 +1373,12 @@ static int wps_get_dev_password(struct wps_data *wps)
|
||||||
"Password Token");
|
"Password Token");
|
||||||
pin = wps->nfc_pw_token->dev_pw;
|
pin = wps->nfc_pw_token->dev_pw;
|
||||||
pin_len = wps->nfc_pw_token->dev_pw_len;
|
pin_len = wps->nfc_pw_token->dev_pw_len;
|
||||||
|
} else if (wps->dev_pw_id >= 0x10 &&
|
||||||
|
wps->wps->ap_nfc_dev_pw_id == wps->dev_pw_id &&
|
||||||
|
wps->wps->ap_nfc_dev_pw) {
|
||||||
|
wpa_printf(MSG_DEBUG, "WPS: Use OOB Device Password from own NFC Password Token");
|
||||||
|
pin = wpabuf_head(wps->wps->ap_nfc_dev_pw);
|
||||||
|
pin_len = wpabuf_len(wps->wps->ap_nfc_dev_pw);
|
||||||
#endif /* CONFIG_WPS_NFC */
|
#endif /* CONFIG_WPS_NFC */
|
||||||
} else {
|
} else {
|
||||||
pin = wps_registrar_get_pin(wps->wps->registrar, wps->uuid_e,
|
pin = wps_registrar_get_pin(wps->wps->registrar, wps->uuid_e,
|
||||||
|
@ -2608,6 +2614,10 @@ static enum wps_process_res wps_process_m1(struct wps_data *wps,
|
||||||
wpa_printf(MSG_DEBUG, "WPS: Found matching NFC "
|
wpa_printf(MSG_DEBUG, "WPS: Found matching NFC "
|
||||||
"Password Token (no peer PK hash)");
|
"Password Token (no peer PK hash)");
|
||||||
wps->nfc_pw_token = token;
|
wps->nfc_pw_token = token;
|
||||||
|
} else if (wps->dev_pw_id >= 0x10 &&
|
||||||
|
wps->wps->ap_nfc_dev_pw_id == wps->dev_pw_id &&
|
||||||
|
wps->wps->ap_nfc_dev_pw) {
|
||||||
|
wpa_printf(MSG_DEBUG, "WPS: Found match with own NFC Password Token");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_WPS_NFC */
|
#endif /* CONFIG_WPS_NFC */
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "ap/ap_config.h"
|
#include "ap/ap_config.h"
|
||||||
#include "ap/sta_info.h"
|
#include "ap/sta_info.h"
|
||||||
#include "ap/ap_drv_ops.h"
|
#include "ap/ap_drv_ops.h"
|
||||||
|
#include "ap/wps_hostapd.h"
|
||||||
#include "ap/p2p_hostapd.h"
|
#include "ap/p2p_hostapd.h"
|
||||||
#include "eapol_supp/eapol_supp_sm.h"
|
#include "eapol_supp/eapol_supp_sm.h"
|
||||||
#include "rsn_supp/wpa.h"
|
#include "rsn_supp/wpa.h"
|
||||||
|
@ -7432,11 +7433,19 @@ int wpas_p2p_nfc_tag_enabled(struct wpa_supplicant *wpa_s, int enabled)
|
||||||
{
|
{
|
||||||
const u8 *if_addr;
|
const u8 *if_addr;
|
||||||
int go_intent = wpa_s->conf->p2p_go_intent;
|
int go_intent = wpa_s->conf->p2p_go_intent;
|
||||||
|
struct wpa_supplicant *iface;
|
||||||
|
|
||||||
if (wpa_s->global->p2p == NULL)
|
if (wpa_s->global->p2p == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
|
wpa_printf(MSG_DEBUG, "P2P: Disable use of own NFC Tag");
|
||||||
|
for (iface = wpa_s->global->ifaces; iface; iface = iface->next)
|
||||||
|
{
|
||||||
|
if (!iface->ap_iface)
|
||||||
|
continue;
|
||||||
|
hostapd_wps_nfc_token_disable(iface->ap_iface->bss[0]);
|
||||||
|
}
|
||||||
p2p_set_authorized_oob_dev_pw_id(wpa_s->global->p2p, 0,
|
p2p_set_authorized_oob_dev_pw_id(wpa_s->global->p2p, 0,
|
||||||
0, NULL);
|
0, NULL);
|
||||||
if (wpa_s->p2p_nfc_tag_enabled)
|
if (wpa_s->p2p_nfc_tag_enabled)
|
||||||
|
@ -7457,6 +7466,8 @@ int wpas_p2p_nfc_tag_enabled(struct wpa_supplicant *wpa_s, int enabled)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wpa_printf(MSG_DEBUG, "P2P: Enable use of own NFC Tag");
|
||||||
|
|
||||||
wpa_s->p2p_oob_dev_pw_id = wpa_s->conf->wps_nfc_dev_pw_id;
|
wpa_s->p2p_oob_dev_pw_id = wpa_s->conf->wps_nfc_dev_pw_id;
|
||||||
wpabuf_free(wpa_s->p2p_oob_dev_pw);
|
wpabuf_free(wpa_s->p2p_oob_dev_pw);
|
||||||
wpa_s->p2p_oob_dev_pw = wpabuf_dup(wpa_s->conf->wps_nfc_dev_pw);
|
wpa_s->p2p_oob_dev_pw = wpabuf_dup(wpa_s->conf->wps_nfc_dev_pw);
|
||||||
|
@ -7484,6 +7495,27 @@ int wpas_p2p_nfc_tag_enabled(struct wpa_supplicant *wpa_s, int enabled)
|
||||||
|
|
||||||
wpa_s->p2p_nfc_tag_enabled = enabled;
|
wpa_s->p2p_nfc_tag_enabled = enabled;
|
||||||
|
|
||||||
|
for (iface = wpa_s->global->ifaces; iface; iface = iface->next) {
|
||||||
|
struct hostapd_data *hapd;
|
||||||
|
if (iface->ap_iface == NULL)
|
||||||
|
continue;
|
||||||
|
hapd = iface->ap_iface->bss[0];
|
||||||
|
wpabuf_free(hapd->conf->wps_nfc_dh_pubkey);
|
||||||
|
hapd->conf->wps_nfc_dh_pubkey =
|
||||||
|
wpabuf_dup(wpa_s->conf->wps_nfc_dh_pubkey);
|
||||||
|
wpabuf_free(hapd->conf->wps_nfc_dh_privkey);
|
||||||
|
hapd->conf->wps_nfc_dh_privkey =
|
||||||
|
wpabuf_dup(wpa_s->conf->wps_nfc_dh_privkey);
|
||||||
|
wpabuf_free(hapd->conf->wps_nfc_dev_pw);
|
||||||
|
hapd->conf->wps_nfc_dev_pw =
|
||||||
|
wpabuf_dup(wpa_s->conf->wps_nfc_dev_pw);
|
||||||
|
hapd->conf->wps_nfc_dev_pw_id = wpa_s->conf->wps_nfc_dev_pw_id;
|
||||||
|
|
||||||
|
if (hostapd_wps_nfc_token_enable(iface->ap_iface->bss[0]) < 0) {
|
||||||
|
wpa_dbg(iface, MSG_DEBUG,
|
||||||
|
"P2P: Failed to enable NFC Tag for GO");
|
||||||
|
}
|
||||||
|
}
|
||||||
p2p_set_authorized_oob_dev_pw_id(
|
p2p_set_authorized_oob_dev_pw_id(
|
||||||
wpa_s->global->p2p, wpa_s->conf->wps_nfc_dev_pw_id, go_intent,
|
wpa_s->global->p2p, wpa_s->conf->wps_nfc_dev_pw_id, go_intent,
|
||||||
if_addr);
|
if_addr);
|
||||||
|
|
Loading…
Reference in a new issue