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

eapol: set secure on message 2/4 properly

The second handshake message was hard coded with the secure bit as
zero but for rekeys the secure bit should be set to 1. Fix this by
changing the 2/4 builder to take a boolean which will set the bit
properly.

It should be noted that hostapd doesn't check this bit so EAPoL
worked just fine, but IWD's checks are more strict.
This commit is contained in:
James Prestwood 2023-01-11 12:15:35 -08:00 committed by Denis Kenzior
parent eda02fb929
commit 2429ab958d
2 changed files with 9 additions and 6 deletions

View File

@ -766,11 +766,12 @@ struct eapol_key *eapol_create_ptk_2_of_4(
size_t extra_len, size_t extra_len,
const uint8_t *extra_data, const uint8_t *extra_data,
bool is_wpa, bool is_wpa,
size_t mic_len) size_t mic_len,
bool secure)
{ {
return eapol_create_common(protocol, version, false, key_replay_counter, return eapol_create_common(protocol, version, secure,
snonce, extra_len, extra_data, 1, key_replay_counter, snonce, extra_len,
is_wpa, mic_len); extra_data, 1, is_wpa, mic_len);
} }
struct eapol_key *eapol_create_ptk_4_of_4( struct eapol_key *eapol_create_ptk_4_of_4(
@ -1326,7 +1327,8 @@ static void eapol_handle_ptk_1_of_4(struct eapol_sm *sm,
ek->key_descriptor_version, ek->key_descriptor_version,
L_BE64_TO_CPU(ek->key_replay_counter), L_BE64_TO_CPU(ek->key_replay_counter),
sm->handshake->snonce, ies_len, ies, sm->handshake->snonce, ies_len, ies,
sm->handshake->wpa_ie, sm->mic_len); sm->handshake->wpa_ie, sm->mic_len,
sm->rekey);
kck = handshake_state_get_kck(sm->handshake); kck = handshake_state_get_kck(sm->handshake);

View File

@ -83,7 +83,8 @@ struct eapol_key *eapol_create_ptk_2_of_4(
size_t extra_len, size_t extra_len,
const uint8_t *extra_data, const uint8_t *extra_data,
bool is_wpa, bool is_wpa,
size_t mic_len); size_t mic_len,
bool secure);
struct eapol_key *eapol_create_ptk_4_of_4( struct eapol_key *eapol_create_ptk_4_of_4(
enum eapol_protocol_version protocol, enum eapol_protocol_version protocol,