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

eapol: Add eapol_process_ptk_2_of_4

This commit is contained in:
Denis Kenzior 2014-12-27 22:32:07 -06:00
parent 996e32bf1d
commit dc3331a98d
2 changed files with 50 additions and 0 deletions

View File

@ -126,3 +126,51 @@ bool eapol_process_ptk_1_of_4(const uint8_t *data, size_t len,
return true;
}
bool eapol_process_ptk_2_of_4(const uint8_t *data, size_t len,
uint8_t out_snonce[])
{
struct eapol_key *ek;
uint16_t key_len;
if (!eapol_verify(data, len))
return false;
ek = (struct eapol_key *) data;
/* Verify according to 802.11, Section 11.6.6.2 */
if (!ek->key_type)
return false;
if (ek->smk_message)
return false;
if (ek->install)
return false;
if (ek->key_ack)
return false;
if (!ek->key_mic)
return false;
if (ek->secure)
return false;
if (ek->error)
return false;
if (ek->request)
return false;
if (ek->encrypted_key_data)
return false;
key_len = L_BE16_TO_CPU(ek->key_length);
if (key_len != 0)
return false;
memcpy(out_snonce, ek->key_nonce, sizeof(ek->key_nonce));
return true;
}

View File

@ -97,3 +97,5 @@ bool eapol_verify(const uint8_t *data, size_t len);
bool eapol_process_ptk_1_of_4(const uint8_t *data, size_t len,
uint8_t out_anonce[]);
bool eapol_process_ptk_2_of_4(const uint8_t *data, size_t len,
uint8_t out_snonce[]);