WPS: Allow NFC password token from AP to be used with wps_reg

The AP PIN on wps_reg command can now be replaced with special value
"nfc-pw" to use device password from a NFC password token from the AP.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2012-06-28 19:41:26 +03:00
parent e6ea2a451c
commit e484e927a6
2 changed files with 7 additions and 9 deletions

View file

@ -138,6 +138,7 @@ static void * eap_wsc_init(struct eap_sm *sm)
struct wps_credential new_ap_settings;
int res;
u8 dev_pw[WPS_OOB_DEVICE_PASSWORD_LEN];
int nfc = 0;
wps = sm->wps;
if (wps == NULL) {
@ -193,13 +194,18 @@ static void * eap_wsc_init(struct eap_sm *sm)
cfg.pin = dev_pw;
cfg.pin_len /= 2;
}
if (cfg.pin_len == 6 && os_strncmp(pos, "nfc-pw", 6) == 0) {
cfg.pin = NULL;
cfg.pin_len = 0;
nfc = 1;
}
} else {
pos = os_strstr(phase1, "pbc=1");
if (pos)
cfg.pbc = 1;
}
if (cfg.pin == NULL && !cfg.pbc) {
if (cfg.pin == NULL && !cfg.pbc && !nfc) {
wpa_printf(MSG_INFO, "EAP-WSC: PIN or PBC not set in phase1 "
"configuration data");
os_free(data);

View file

@ -1897,21 +1897,13 @@ static int wpas_wps_use_cred(struct wpa_supplicant *wpa_s,
}
#ifdef CONFIG_WPS_ER
static int wpas_wps_add_nfc_password_token(struct wpa_supplicant *wpa_s,
struct wps_parse_attr *attr)
{
if (wpa_s->wps_er == NULL) {
wpa_printf(MSG_DEBUG, "WPS: Ignore NFC password token while "
"ER functionality is disabled");
return -1;
}
return wps_registrar_add_nfc_password_token(
wpa_s->wps->registrar, attr->oob_dev_password,
attr->oob_dev_password_len);
}
#endif /* CONFIG_WPS_ER */
static int wpas_wps_nfc_tag_process(struct wpa_supplicant *wpa_s,