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

eapol: allow eapol_decrypt_key_data to work with FILS

FILS falls under the 'AKM defined' key descriptor, and uses AES-SIV.
This commit is contained in:
James Prestwood 2019-04-17 15:16:42 -07:00 committed by Denis Kenzior
parent 368d6714b9
commit a6640f1b7a

View File

@ -227,16 +227,27 @@ uint8_t *eapol_decrypt_key_data(enum ie_rsn_akm_suite akm, const uint8_t *kek,
expected_len = key_data_len; expected_len = key_data_len;
break; break;
case EAPOL_KEY_DESCRIPTOR_VERSION_AKM_DEFINED: case EAPOL_KEY_DESCRIPTOR_VERSION_AKM_DEFINED:
/* switch (akm) {
* TODO: for now, only SAE/OWE (group 19) is supported under the case IE_RSN_AKM_SUITE_FILS_SHA256:
* AKM_DEFINED key descriptor version. Once 8021x suites are case IE_RSN_AKM_SUITE_FILS_SHA384:
* added for this type this will need to be expanded to handle if (key_data_len < 16)
* the AKM types in its own switch. return NULL;
*/
if (!IE_AKM_IS_SAE(akm) && akm != IE_RSN_AKM_SUITE_OWE)
return NULL;
/* Fall through */ expected_len = key_data_len - 16;
break;
case IE_RSN_AKM_SUITE_SAE_SHA256:
case IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256:
case IE_RSN_AKM_SUITE_OWE:
if (key_data_len < 24 || key_data_len % 8)
return NULL;
expected_len = key_data_len - 8;
break;
default:
return NULL;
}
break;
case EAPOL_KEY_DESCRIPTOR_VERSION_HMAC_SHA1_AES: case EAPOL_KEY_DESCRIPTOR_VERSION_HMAC_SHA1_AES:
case EAPOL_KEY_DESCRIPTOR_VERSION_AES_128_CMAC_AES: case EAPOL_KEY_DESCRIPTOR_VERSION_AES_128_CMAC_AES:
if (key_data_len < 24 || key_data_len % 8) if (key_data_len < 24 || key_data_len % 8)
@ -286,13 +297,38 @@ uint8_t *eapol_decrypt_key_data(enum ie_rsn_akm_suite akm, const uint8_t *kek,
goto error; goto error;
} }
if (!aes_unwrap(kek, kek_len, key_data,
key_data_len, buf))
goto error;
break; break;
case IE_RSN_AKM_SUITE_FILS_SHA256:
case IE_RSN_AKM_SUITE_FILS_SHA384:
{
struct iovec ad[1];
ad[0].iov_base = (void *)frame;
ad[0].iov_len = key_data - (const uint8_t *)frame;
if (akm == IE_RSN_AKM_SUITE_FILS_SHA256)
kek_len = 32;
else
kek_len = 48;
if (!aes_siv_decrypt(kek, kek_len, key_data,
key_data_len, ad, 1, buf))
goto error;
break;
}
default: default:
kek_len = 16; kek_len = 16;
}
if (!aes_unwrap(kek, kek_len, key_data, key_data_len, buf)) if (!aes_unwrap(kek, kek_len, key_data,
goto error; key_data_len, buf))
goto error;
break;
}
break; break;
} }