qcacmn: Distinguish EAPOL-Key msg 4/4 from 2/4 based on Key Nonce

IEEE 802.11be adds the MAC Address KDE into the EAPOL-Key msg 4/4 when
MLO is used and as such, the previously used check for Key Data Length
value 0 is not sufficient for recognizing the EAPOL-Key msg 4/4 anymore.
Also check for an all zero Key Nonce value since that field is supposed
to be zero in EAPOL-Key msg 4/4 and it has to be a random value in
EAPOL-Key msg 2/4.

Change-Id: Iafb2f0e59a3fd52fa47317f8f3daff3f115271d1
CRs-Fixed: 3380806
This commit is contained in:
Amit Mehta
2023-01-09 05:26:19 -08:00
committed by Madan Koyyalamudi
parent 7cbbd39379
commit 1db627cc73
2 changed files with 6 additions and 4 deletions

View File

@@ -1524,7 +1524,7 @@ __qdf_nbuf_data_get_dhcp_subtype(uint8_t *data)
* --------------------------------------
*
* Then, we can differentiate M1 from M3, M2 from M4 by below methods:
* M2/M4: by keyDataLength being AES_BLOCK_SIZE for FILS and 0 otherwise.
* M2/M4: by keyDataLength or Nonce value being 0 for M4.
* M1/M3: by the mic/encrKeyData bit in the keyinfo field.
*
* Return: subtype of the EAPOL packet.
@@ -1534,12 +1534,14 @@ __qdf_nbuf_data_get_eapol_key(uint8_t *data)
{
uint16_t key_info, key_data_length;
enum qdf_proto_subtype subtype;
uint64_t *key_nonce;
key_info = qdf_ntohs((uint16_t)(*(uint16_t *)
(data + EAPOL_KEY_INFO_OFFSET)));
key_data_length = qdf_ntohs((uint16_t)(*(uint16_t *)
(data + EAPOL_KEY_DATA_LENGTH_OFFSET)));
key_nonce = (uint64_t *)(data + EAPOL_WPA_KEY_NONCE_OFFSET);
if (key_info & EAPOL_WPA_KEY_INFO_ACK)
if (key_info &
@@ -1549,9 +1551,8 @@ __qdf_nbuf_data_get_eapol_key(uint8_t *data)
subtype = QDF_PROTO_EAPOL_M1;
else
if (key_data_length == 0 ||
(!(key_info & EAPOL_WPA_KEY_INFO_MIC) &&
(key_info & EAPOL_WPA_KEY_INFO_ENCR_KEY_DATA) &&
key_data_length == AES_BLOCK_SIZE))
!((*key_nonce) || (*(key_nonce + 1)) ||
(*(key_nonce + 2)) || (*(key_nonce + 3))))
subtype = QDF_PROTO_EAPOL_M4;
else
subtype = QDF_PROTO_EAPOL_M2;