eapol: Add tx_packet_func and setter

This commit is contained in:
Denis Kenzior 2015-02-24 11:10:42 -06:00
parent 54fa4f29c7
commit 87dc9543b2
2 changed files with 10 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#include "eapol.h"
struct l_hashmap *state_machines;
eapol_tx_packet_func_t tx_packet = NULL;
eapol_get_nonce_func_t get_nonce = NULL;
enum eapol_protocol_version protocol_version = EAPOL_PROTOCOL_VERSION_2004;
@ -482,6 +483,10 @@ void eapol_sm_set_own_rsn(struct eapol_sm *sm, const uint8_t *rsn_ie,
sm->own_rsn = l_memdup(rsn_ie, len);
}
void __eapol_set_tx_packet_func(eapol_tx_packet_func_t func)
{
tx_packet = func;
}
void __eapol_set_get_nonce_func(eapol_get_nonce_func_t func)
{
@ -500,6 +505,7 @@ bool eapol_exit()
{
l_hashmap_destroy(state_machines, eapol_sm_destroy);
get_nonce = NULL;
tx_packet = NULL;
return true;
}

View File

@ -95,6 +95,9 @@ struct eapol_key {
uint8_t key_data[0];
} __attribute__ ((packed));
typedef int (*eapol_tx_packet_func_t)(int ifindex, const uint8_t *aa_addr,
const uint8_t *sta_addr,
const struct eapol_key *ek);
typedef bool (*eapol_get_nonce_func_t)(uint8_t nonce[]);
bool eapol_calculate_mic(const uint8_t *kck, const struct eapol_key *frame,
@ -124,6 +127,7 @@ struct eapol_key *eapol_create_ptk_4_of_4(
enum eapol_key_descriptor_version version,
uint64_t key_replay_counter);
void __eapol_set_tx_packet_func(eapol_tx_packet_func_t func);
void __eapol_set_get_nonce_func(eapol_get_nonce_func_t func);
struct eapol_sm *eapol_sm_new();