mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-01-18 02:44:03 -05:00
Allow wildcard SSID to be used with WPA-PSK if bssid is set
This allows the AP to be selected based on the BSSID when WPA-PSK is used with a passphrase. The PSK will be derived from the passphrase after the SSID has been learned from scan results.
This commit is contained in:
parent
a52eba0f44
commit
7d232e23e2
@ -562,6 +562,10 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
|
|||||||
}
|
}
|
||||||
#endif /* CONFIG_WPS */
|
#endif /* CONFIG_WPS */
|
||||||
|
|
||||||
|
if (ssid->bssid_set && ssid->ssid_len == 0 &&
|
||||||
|
os_memcmp(bss->bssid, ssid->bssid, ETH_ALEN) == 0)
|
||||||
|
check_ssid = 0;
|
||||||
|
|
||||||
if (check_ssid &&
|
if (check_ssid &&
|
||||||
(ssid_len != ssid->ssid_len ||
|
(ssid_len != ssid->ssid_len ||
|
||||||
os_memcmp(ssid_, ssid->ssid, ssid_len) != 0)) {
|
os_memcmp(ssid_, ssid->ssid, ssid_len) != 0)) {
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "crypto/random.h"
|
#include "crypto/random.h"
|
||||||
|
#include "crypto/sha1.h"
|
||||||
#include "eapol_supp/eapol_supp_sm.h"
|
#include "eapol_supp/eapol_supp_sm.h"
|
||||||
#include "eap_peer/eap.h"
|
#include "eap_peer/eap.h"
|
||||||
#include "eap_server/eap_methods.h"
|
#include "eap_server/eap_methods.h"
|
||||||
@ -1059,8 +1060,20 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
|
|||||||
|
|
||||||
if (ssid->key_mgmt &
|
if (ssid->key_mgmt &
|
||||||
(WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_FT_PSK | WPA_KEY_MGMT_PSK_SHA256))
|
(WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_FT_PSK | WPA_KEY_MGMT_PSK_SHA256))
|
||||||
|
{
|
||||||
wpa_sm_set_pmk(wpa_s->wpa, ssid->psk, PMK_LEN);
|
wpa_sm_set_pmk(wpa_s->wpa, ssid->psk, PMK_LEN);
|
||||||
else
|
#ifndef CONFIG_NO_PBKDF2
|
||||||
|
if (bss && ssid->bssid_set && ssid->ssid_len == 0 &&
|
||||||
|
ssid->passphrase) {
|
||||||
|
u8 psk[PMK_LEN];
|
||||||
|
pbkdf2_sha1(ssid->passphrase, (char *) bss->ssid,
|
||||||
|
bss->ssid_len, 4096, psk, PMK_LEN);
|
||||||
|
wpa_hexdump_key(MSG_MSGDUMP, "PSK (from passphrase)",
|
||||||
|
psk, PMK_LEN);
|
||||||
|
wpa_sm_set_pmk(wpa_s->wpa, psk, PMK_LEN);
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_NO_PBKDF2 */
|
||||||
|
} else
|
||||||
wpa_sm_set_pmk_from_pmksa(wpa_s->wpa);
|
wpa_sm_set_pmk_from_pmksa(wpa_s->wpa);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1827,6 +1840,12 @@ struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s)
|
|||||||
os_memcmp(bssid, entry->bssid, ETH_ALEN) == 0))
|
os_memcmp(bssid, entry->bssid, ETH_ALEN) == 0))
|
||||||
return entry;
|
return entry;
|
||||||
#endif /* CONFIG_WPS */
|
#endif /* CONFIG_WPS */
|
||||||
|
|
||||||
|
if (!entry->disabled && entry->bssid_set &&
|
||||||
|
entry->ssid_len == 0 &&
|
||||||
|
os_memcmp(bssid, entry->bssid, ETH_ALEN) == 0)
|
||||||
|
return entry;
|
||||||
|
|
||||||
entry = entry->next;
|
entry = entry->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user