3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

ap: Fix handshake state gtk not being set

handshake_state_set_authenticator_ie must be called to set group_cipher
in struct handshake_shake before handshake_set_gtk_state, otherwise
handshake_set_gtk_state is unable to determine the key length to set
handshake state gtk.

Fixes: 4bc20a0979 ("ap: Start EAP-WSC authentication with WSC enrollees")
This commit is contained in:
Jonathan Liu 2020-11-15 01:21:45 +11:00 committed by Denis Kenzior
parent bb876953ac
commit 5e9f1a6806

View File

@ -702,7 +702,8 @@ static uint32_t ap_send_mgmt_frame(struct ap_state *ap,
callback, user_data, NULL, NULL); callback, user_data, NULL, NULL);
} }
static void ap_start_handshake(struct sta_state *sta, bool use_eapol_start) static void ap_start_handshake(struct sta_state *sta, bool use_eapol_start,
const uint8_t *gtk_rsc)
{ {
struct ap_state *ap = sta->ap; struct ap_state *ap = sta->ap;
const uint8_t *own_addr = netdev_get_address(ap->netdev); const uint8_t *own_addr = netdev_get_address(ap->netdev);
@ -722,6 +723,10 @@ static void ap_start_handshake(struct sta_state *sta, bool use_eapol_start)
ie_build_rsne(&rsn, bss_rsne); ie_build_rsne(&rsn, bss_rsne);
handshake_state_set_authenticator_ie(sta->hs, bss_rsne); handshake_state_set_authenticator_ie(sta->hs, bss_rsne);
if (gtk_rsc)
handshake_state_set_gtk(sta->hs, sta->ap->gtk,
sta->ap->gtk_index, gtk_rsc);
sta->sm = eapol_sm_new(sta->hs); sta->sm = eapol_sm_new(sta->hs);
if (!sta->sm) { if (!sta->sm) {
ap_stop_handshake(sta); ap_stop_handshake(sta);
@ -774,12 +779,7 @@ static void ap_start_rsna(struct sta_state *sta, const uint8_t *gtk_rsc)
handshake_state_set_event_func(sta->hs, ap_handshake_event, sta); handshake_state_set_event_func(sta->hs, ap_handshake_event, sta);
handshake_state_set_supplicant_ie(sta->hs, sta->assoc_rsne); handshake_state_set_supplicant_ie(sta->hs, sta->assoc_rsne);
handshake_state_set_pmk(sta->hs, sta->ap->config->psk, 32); handshake_state_set_pmk(sta->hs, sta->ap->config->psk, 32);
ap_start_handshake(sta, false, gtk_rsc);
if (gtk_rsc)
handshake_state_set_gtk(sta->hs, sta->ap->gtk,
sta->ap->gtk_index, gtk_rsc);
ap_start_handshake(sta, false);
} }
static void ap_gtk_query_cb(struct l_genl_msg *msg, void *user_data) static void ap_gtk_query_cb(struct l_genl_msg *msg, void *user_data)
@ -924,7 +924,7 @@ static void ap_start_eap_wsc(struct sta_state *sta)
handshake_state_set_event_func(sta->hs, ap_wsc_handshake_event, sta); handshake_state_set_event_func(sta->hs, ap_wsc_handshake_event, sta);
handshake_state_set_8021x_config(sta->hs, sta->wsc_settings); handshake_state_set_8021x_config(sta->hs, sta->wsc_settings);
ap_start_handshake(sta, wait_for_eapol_start); ap_start_handshake(sta, wait_for_eapol_start, NULL);
} }
static struct l_genl_msg *ap_build_cmd_del_key(struct ap_state *ap) static struct l_genl_msg *ap_build_cmd_del_key(struct ap_state *ap)