eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 83212f9b23d5d7cac7c7d90f6cb46092e803fce8
parent 4209837c0d7d34a5743b2b59a4e67d1f7b39ad5a
Author: James Prestwood <james.prestwood@linux.intel.com>
Date:   Fri, 26 Apr 2019 11:31:54 -0700

eapol: change eapol_create_common to support FILS

FILS needs to allocate an extra 16 bytes of key data for the AES-SIV
vector. Instead of leaving it up to the caller to figure this out (as
was done with the GTK builder) eapol_create_common can allocate the
extra space since it knows the MIC length.

This also updates _create_gtk_2_of_2 as it no longer needs to create
an extra data array.

Diffstat:
Msrc/eapol.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/eapol.c b/src/eapol.c @@ -684,15 +684,18 @@ static struct eapol_key *eapol_create_common( bool is_wpa, size_t mic_len) { + size_t extra_key_len = (mic_len == 0) ? 16 : 0; size_t to_alloc = EAPOL_FRAME_LEN(mic_len); - struct eapol_key *out_frame = l_malloc(to_alloc + extra_len); + struct eapol_key *out_frame = l_malloc(to_alloc + extra_len + + extra_key_len); memset(out_frame, 0, to_alloc + extra_len); out_frame->header.protocol_version = protocol; out_frame->header.packet_type = 0x3; - out_frame->header.packet_len = L_CPU_TO_BE16(to_alloc + extra_len - 4); + out_frame->header.packet_len = L_CPU_TO_BE16(to_alloc + extra_len + + extra_key_len - 4); out_frame->descriptor_type = is_wpa ? EAPOL_DESCRIPTOR_TYPE_WPA : EAPOL_DESCRIPTOR_TYPE_80211; out_frame->key_descriptor_version = version; @@ -709,7 +712,7 @@ static struct eapol_key *eapol_create_common( out_frame->key_replay_counter = L_CPU_TO_BE64(key_replay_counter); memcpy(out_frame->key_nonce, snonce, sizeof(out_frame->key_nonce)); - l_put_be16(extra_len, out_frame->key_data + mic_len); + l_put_be16(extra_len + extra_key_len, out_frame->key_data + mic_len); if (extra_len) memcpy(EAPOL_KEY_DATA(out_frame, mic_len), extra_data, @@ -756,15 +759,12 @@ struct eapol_key *eapol_create_gtk_2_of_2( bool is_wpa, uint8_t wpa_key_id, size_t mic_len) { uint8_t snonce[32]; - uint8_t extra[16] = { 0 }; struct eapol_key *step2; memset(snonce, 0, sizeof(snonce)); step2 = eapol_create_common(protocol, version, true, key_replay_counter, snonce, - (mic_len) ? 0 : 16, - (mic_len) ? NULL : extra, - 0, is_wpa, mic_len); + 0, NULL, 0, is_wpa, mic_len); if (!step2) return step2;