mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-04-14 13:37:52 +02:00
eapol: Add eapol_verify_gtk_2_of_2
This commit is contained in:
parent
2ba7867e9f
commit
8f3fd6e47d
55
src/eapol.c
55
src/eapol.c
@ -382,21 +382,23 @@ bool eapol_verify_ptk_4_of_4(const struct eapol_key *ek, bool is_wpa)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define VERIFY_GTK_COMMON(ek) \
|
||||||
|
if (ek->key_type) \
|
||||||
|
return false; \
|
||||||
|
if (ek->smk_message) \
|
||||||
|
return false; \
|
||||||
|
if (ek->request) \
|
||||||
|
return false; \
|
||||||
|
if (ek->error) \
|
||||||
|
return false; \
|
||||||
|
if (ek->install) \
|
||||||
|
return false \
|
||||||
|
|
||||||
bool eapol_verify_gtk_1_of_2(const struct eapol_key *ek, bool is_wpa)
|
bool eapol_verify_gtk_1_of_2(const struct eapol_key *ek, bool is_wpa)
|
||||||
{
|
{
|
||||||
uint16_t key_len;
|
uint16_t key_len;
|
||||||
|
|
||||||
if (ek->key_type)
|
VERIFY_GTK_COMMON(ek);
|
||||||
return false;
|
|
||||||
if (ek->smk_message)
|
|
||||||
return false;
|
|
||||||
if (ek->request)
|
|
||||||
return false;
|
|
||||||
if (ek->error)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (ek->install)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!ek->key_ack)
|
if (!ek->key_ack)
|
||||||
return false;
|
return false;
|
||||||
@ -429,6 +431,37 @@ bool eapol_verify_gtk_1_of_2(const struct eapol_key *ek, bool is_wpa)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool eapol_verify_gtk_2_of_2(const struct eapol_key *ek, bool is_wpa)
|
||||||
|
{
|
||||||
|
uint16_t key_len;
|
||||||
|
|
||||||
|
/* Verify according to 802.11, Section 11.6.7.3 */
|
||||||
|
VERIFY_GTK_COMMON(ek);
|
||||||
|
|
||||||
|
if (ek->key_ack)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!ek->key_mic)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (ek->secure != !is_wpa)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (ek->encrypted_key_data)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
key_len = L_BE16_TO_CPU(ek->key_length);
|
||||||
|
if (key_len != 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
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 true;
|
||||||
|
}
|
||||||
|
|
||||||
static struct eapol_key *eapol_create_common(
|
static struct eapol_key *eapol_create_common(
|
||||||
enum eapol_protocol_version protocol,
|
enum eapol_protocol_version protocol,
|
||||||
enum eapol_key_descriptor_version version,
|
enum eapol_key_descriptor_version version,
|
||||||
|
@ -126,6 +126,7 @@ bool eapol_verify_ptk_2_of_4(const struct eapol_key *ek);
|
|||||||
bool eapol_verify_ptk_3_of_4(const struct eapol_key *ek, bool is_wpa);
|
bool eapol_verify_ptk_3_of_4(const struct eapol_key *ek, bool is_wpa);
|
||||||
bool eapol_verify_ptk_4_of_4(const struct eapol_key *ek, bool is_wpa);
|
bool eapol_verify_ptk_4_of_4(const struct eapol_key *ek, bool is_wpa);
|
||||||
bool eapol_verify_gtk_1_of_2(const struct eapol_key *ek, bool is_wpa);
|
bool eapol_verify_gtk_1_of_2(const struct eapol_key *ek, bool is_wpa);
|
||||||
|
bool eapol_verify_gtk_2_of_2(const struct eapol_key *ek, bool is_wpa);
|
||||||
|
|
||||||
struct eapol_key *eapol_create_ptk_2_of_4(
|
struct eapol_key *eapol_create_ptk_2_of_4(
|
||||||
enum eapol_protocol_version protocol,
|
enum eapol_protocol_version protocol,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user