eapol: Introduce eapol_sm

This commit is contained in:
Denis Kenzior 2015-02-24 10:54:23 -06:00
parent bf42e3e7a3
commit 2866fbbf91
2 changed files with 44 additions and 0 deletions

View File

@ -407,3 +407,42 @@ struct eapol_key *eapol_create_ptk_4_of_4(
return eapol_create_common(protocol, version, true, key_replay_counter,
snonce, 0, NULL);
}
struct eapol_sm {
uint8_t pmk[32];
uint64_t replay_counter;
uint8_t sta_addr[6];
uint8_t snonce[32];
uint8_t aa_addr[6];
uint8_t anonce[32];
uint8_t ptk[64];
uint8_t *ap_rsn;
size_t ap_rsn_size;
uint8_t *own_rsn;
size_t own_rsn_size;
bool have_snonce:1;
bool have_replay:1;
};
static void eapol_sm_destroy(void *value)
{
struct eapol_sm *sm = value;
l_free(sm->ap_rsn);
l_free(sm->own_rsn);
l_free(sm);
}
struct eapol_sm *eapol_sm_new()
{
struct eapol_sm *sm;
sm = l_new(struct eapol_sm, 1);
return sm;
}
void eapol_sm_free(struct eapol_sm *sm)
{
eapol_sm_destroy(sm);
}

View File

@ -47,6 +47,8 @@ enum eapol_key_descriptor_version {
EAPOL_KEY_DESCRIPTOR_VERSION_AES_128_CMAC_AES = 3,
};
struct eapol_sm;
struct eapol_key {
uint8_t protocol_version;
uint8_t packet_type;
@ -119,3 +121,6 @@ struct eapol_key *eapol_create_ptk_4_of_4(
enum eapol_protocol_version protocol,
enum eapol_key_descriptor_version version,
uint64_t key_replay_counter);
struct eapol_sm *eapol_sm_new();
void eapol_sm_free(struct eapol_sm *sm);