aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/sme.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-11-02 16:07:49 (GMT)
committerJouni Malinen <j@w1.fi>2013-11-02 16:07:49 (GMT)
commit18ca7332480b648892fb88f0ad412a929364c126 (patch)
treea8ffa430a8344ec87a18aee77781bc949ff0ea36 /wpa_supplicant/sme.c
parentf5f59e4f570b4b0411e7ae1a0429b70a5e8a01fe (diff)
downloadhostap-18ca7332480b648892fb88f0ad412a929364c126.zip
hostap-18ca7332480b648892fb88f0ad412a929364c126.tar.gz
hostap-18ca7332480b648892fb88f0ad412a929364c126.tar.bz2
SAE: Fix group selection
Number of regressions had shown up in wpa_supplicant implementation of SAE group selection due to different integer array termination (-1 in hostapd, 0 in wpa_supplicant) being used for SAE groups. The default_groups list did not seem to use any explicit termination value. In addition, the sae_group_index was not cleared back to 0 properly whenever a new SAE session was started. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/sme.c')
-rw-r--r--wpa_supplicant/sme.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index 925d132..87c14ae 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -46,7 +46,7 @@ static int index_within_array(const int *array, int idx)
{
int i;
for (i = 0; i < idx; i++) {
- if (array[i] == -1)
+ if (array[i] <= 0)
return 0;
}
return 1;
@@ -56,9 +56,9 @@ static int index_within_array(const int *array, int idx)
static int sme_set_sae_group(struct wpa_supplicant *wpa_s)
{
int *groups = wpa_s->conf->sae_groups;
- int default_groups[] = { 19, 20, 21, 25, 26 };
+ int default_groups[] = { 19, 20, 21, 25, 26, 0 };
- if (!groups)
+ if (!groups || groups[0] <= 0)
groups = default_groups;
/* Configuration may have changed, so validate current index */
@@ -438,6 +438,7 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
#ifdef CONFIG_SAE
wpa_s->sme.sae.state = SAE_NOTHING;
wpa_s->sme.sae.send_confirm = 0;
+ wpa_s->sme.sae_group_index = 0;
#endif /* CONFIG_SAE */
sme_send_authentication(wpa_s, bss, ssid, 1);
}
@@ -482,15 +483,18 @@ static int sme_sae_auth(struct wpa_supplicant *wpa_s, u16 auth_transaction,
return -1;
if (auth_transaction == 1) {
+ int *groups = wpa_s->conf->sae_groups;
+
wpa_dbg(wpa_s, MSG_DEBUG, "SME SAE commit");
if (wpa_s->current_bss == NULL ||
wpa_s->current_ssid == NULL)
return -1;
if (wpa_s->sme.sae.state != SAE_COMMITTED)
return -1;
+ if (groups && groups[0] <= 0)
+ groups = NULL;
if (sae_parse_commit(&wpa_s->sme.sae, data, len, NULL, NULL,
- wpa_s->conf->sae_groups) !=
- WLAN_STATUS_SUCCESS)
+ groups) != WLAN_STATUS_SUCCESS)
return -1;
if (sae_process_commit(&wpa_s->sme.sae) < 0) {