]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Prefer PSK format if Enrollee does not advertise Display
authorJouni Malinen <jouni.malinen@atheros.com>
Mon, 21 Dec 2009 10:58:02 +0000 (12:58 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 21 Dec 2009 10:58:02 +0000 (12:58 +0200)
Since an Enrollee that does not advertise display as one of the
Config Methods is unlikely to be able to show the ASCII passphrase
to the user, prefer PSK format with such an Enrollee to reduce key
derivation time. This can help with some low-powered devices that
would take long time to derive the PSK from the passphrase.

src/wps/wps_registrar.c

index 5a81c90f354a18fe46a96920b906aed3e0ead466..85b3b4d98db4b717c6f7c6d235854432fbb771e1 100644 (file)
@@ -1955,7 +1955,28 @@ static int wps_process_config_methods(struct wps_data *wps, const u8 *methods)
 
        m = WPA_GET_BE16(methods);
 
-       wpa_printf(MSG_DEBUG, "WPS: Enrollee Config Methods 0x%x", m);
+       wpa_printf(MSG_DEBUG, "WPS: Enrollee Config Methods 0x%x"
+                  "%s%s%s%s%s%s%s%s%s", m,
+                  m & WPS_CONFIG_USBA ? " [USBA]" : "",
+                  m & WPS_CONFIG_ETHERNET ? " [Ethernet]" : "",
+                  m & WPS_CONFIG_LABEL ? " [Label]" : "",
+                  m & WPS_CONFIG_DISPLAY ? " [Display]" : "",
+                  m & WPS_CONFIG_EXT_NFC_TOKEN ? " [Ext NFC Token]" : "",
+                  m & WPS_CONFIG_INT_NFC_TOKEN ? " [Int NFC Token]" : "",
+                  m & WPS_CONFIG_NFC_INTERFACE ? " [NFC]" : "",
+                  m & WPS_CONFIG_PUSHBUTTON ? " [PBC]" : "",
+                  m & WPS_CONFIG_KEYPAD ? " [Keypad]" : "");
+
+       if (!(m & WPS_CONFIG_DISPLAY) && !wps->use_psk_key) {
+               /*
+                * The Enrollee does not have a display so it is unlikely to be
+                * able to show the passphrase to a user and as such, could
+                * benefit from receiving PSK to reduce key derivation time.
+                */
+               wpa_printf(MSG_DEBUG, "WPS: Prefer PSK format key due to "
+                          "Enrollee not supporting display");
+               wps->use_psk_key = 1;
+       }
 
        return 0;
 }