From e6ea2a451c8a0fcc60690b4114d21b0e09218c11 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 28 Jun 2012 17:34:46 +0300 Subject: [PATCH] WPS ER: Add support for using NFC password token from an Enrollee WPS_NFC_TAG_READ ctrl_iface command can now be used to add NFC password tokens to ER. Signed-hostap: Jouni Malinen --- wpa_supplicant/wps_supplicant.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c index ae0e1d170..95739f4f9 100644 --- a/wpa_supplicant/wps_supplicant.c +++ b/wpa_supplicant/wps_supplicant.c @@ -1897,6 +1897,23 @@ 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, const struct wpabuf *wps) { @@ -1912,6 +1929,11 @@ static int wpas_wps_nfc_tag_process(struct wpa_supplicant *wpa_s, if (attr.num_cred) return wpas_wps_use_cred(wpa_s, &attr); +#ifdef CONFIG_WPS_ER + if (attr.oob_dev_password) + return wpas_wps_add_nfc_password_token(wpa_s, &attr); +#endif /* CONFIG_WPS_ER */ + wpa_printf(MSG_DEBUG, "WPS: Ignore unrecognized NFC tag"); return -1; }