eapol: Add eapol_verify_ptk_4_of_4

This commit is contained in:
Denis Kenzior 2015-02-13 18:38:10 -06:00
parent f63b8b2ec9
commit 85e54c66fe
2 changed files with 49 additions and 0 deletions

View File

@ -253,6 +253,53 @@ const struct eapol_key *eapol_verify_ptk_3_of_4(const uint8_t *frame,
return ek;
}
const struct eapol_key *eapol_verify_ptk_4_of_4(const uint8_t *frame,
size_t len)
{
const struct eapol_key *ek;
uint16_t key_len;
ek = eapol_key_validate(frame, len);
if (!ek)
return NULL;
/* Verify according to 802.11, Section 11.6.6.5 */
if (!ek->key_type)
return NULL;
if (ek->smk_message)
return NULL;
if (ek->key_ack)
return NULL;
if (!ek->key_mic)
return NULL;
if (!ek->secure)
return NULL;
if (ek->error)
return NULL;
if (ek->request)
return NULL;
if (ek->encrypted_key_data)
return NULL;
key_len = L_BE16_TO_CPU(ek->key_length);
if (key_len != 0)
return NULL;
VERIFY_IS_ZERO(ek->key_nonce);
VERIFY_IS_ZERO(ek->eapol_key_iv);
VERIFY_IS_ZERO(ek->key_rsc);
VERIFY_IS_ZERO(ek->reserved);
return ek;
}
static struct eapol_key *eapol_create_common(
enum eapol_protocol_version protocol,
enum eapol_key_descriptor_version version,

View File

@ -104,6 +104,8 @@ const struct eapol_key *eapol_verify_ptk_2_of_4(const uint8_t *frame,
size_t len);
const struct eapol_key *eapol_verify_ptk_3_of_4(const uint8_t *frame,
size_t len);
const struct eapol_key *eapol_verify_ptk_4_of_4(const uint8_t *frame,
size_t len);
struct eapol_key *eapol_create_ptk_2_of_4(
enum eapol_protocol_version protocol,