diff --git a/src/eapol.c b/src/eapol.c index be85e574..f6cee970 100644 --- a/src/eapol.c +++ b/src/eapol.c @@ -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); +} diff --git a/src/eapol.h b/src/eapol.h index 5cd78767..f94beb1d 100644 --- a/src/eapol.h +++ b/src/eapol.h @@ -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);