]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Allow NFC password token from AP to be used with wps_reg
authorJouni Malinen <j@w1.fi>
Thu, 28 Jun 2012 16:41:26 +0000 (19:41 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 28 Jun 2012 16:41:26 +0000 (19:41 +0300)
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>

src/eap_peer/eap_wsc.c
wpa_supplicant/wps_supplicant.c

index 2c948a0461b7fa0a3c393187337130c337947b79..d007a57082b53136c34103996d2e0624f8418eb2 100644 (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);
index 95739f4f903710e0fc83297ee98137d403d61d73..393c3955df2aaa945f9b12e428ec0f530a3159b4 100644 (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,