passphrase/psk in wps cred handling in hostapd and wpa_supplicant

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there,

when performing a wps pbc session, credential either contains the psk
or the passphrase. I case of hostapd, this depends only on the config
(whether wpa_passphrase or wpa_psk is specified (later)). This
behavior correlates with comments found in the code, e.g. in wps.h,
near the definition of network_key.

However if AP is set up using wpa_supplicant, wps cred is always
passed containing the generated or specified psk. To my understanding,
this is caused by that the wpa_supplicant always passes psk if it is
set in wpa_supplicant_conf_ap() in ap.c. In wpa_supplicant psk is
generated every time passphrase is set/changed, so psk is always set.
I changed wpa_supplicant_conf_ap() so that passphrase gets passed if
set (see below). Can anybody confirm ? I have just read the code, I do
not know anything of the original intentions etc.

--- ap_orig.c   2019-06-26 12:09:49.778442128 +0200
+++ ap.c        2019-06-26 12:10:57.051258094 +0200
@@ -370,7 +370,10 @@
        else
                bss->wpa_key_mgmt = ssid->key_mgmt;
        bss->wpa_pairwise = ssid->pairwise_cipher;
-       if (ssid->psk_set) {
+       if (ssid->passphrase) {
+               bss->ssid.wpa_passphrase = os_strdup(ssid->passphrase);
+       }
+       else if (ssid->psk_set) {
                bin_clear_free(bss->ssid.wpa_psk, sizeof(*bss->ssid.wpa_psk));
                bss->ssid.wpa_psk = os_zalloc(sizeof(struct hostapd_wpa_psk));
                if (bss->ssid.wpa_psk == NULL)
@@ -378,8 +381,6 @@
                os_memcpy(bss->ssid.wpa_psk->psk, ssid->psk, PMK_LEN);
                bss->ssid.wpa_psk->group = 1;
                bss->ssid.wpa_psk_set = 1;
-       } else if (ssid->passphrase) {
-               bss->ssid.wpa_passphrase = os_strdup(ssid->passphrase);
        } else if (ssid->wep_key_len[0] || ssid->wep_key_len[1] ||
                   ssid->wep_key_len[2] || ssid->wep_key_len[3]) {
                struct hostapd_wep_keys *wep = &bss->ssid.wep;

Regards,
Viktor

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux