From 87dc9543b206a183421aa129c8eac750f31e2e22 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 24 Feb 2015 11:10:42 -0600 Subject: [PATCH] eapol: Add tx_packet_func and setter --- src/eapol.c | 6 ++++++ src/eapol.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/eapol.c b/src/eapol.c index 8bf6556c..b9f4732f 100644 --- a/src/eapol.c +++ b/src/eapol.c @@ -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; } diff --git a/src/eapol.h b/src/eapol.h index 2ba5a702..a7cbf3c0 100644 --- a/src/eapol.h +++ b/src/eapol.h @@ -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();