3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-20 02:32:36 +01:00

eapol: Add __eapol_set_install_tk_func

This commit is contained in:
Denis Kenzior 2015-03-25 22:35:12 -05:00
parent ddcbb3f2a8
commit bf5a6a3999
2 changed files with 13 additions and 0 deletions

View File

@ -42,6 +42,7 @@
struct l_queue *state_machines; struct l_queue *state_machines;
eapol_tx_packet_func_t tx_packet = NULL; eapol_tx_packet_func_t tx_packet = NULL;
eapol_get_nonce_func_t get_nonce = NULL; eapol_get_nonce_func_t get_nonce = NULL;
eapol_install_tk_func_t install_tk = NULL;
enum eapol_protocol_version protocol_version = EAPOL_PROTOCOL_VERSION_2004; enum eapol_protocol_version protocol_version = EAPOL_PROTOCOL_VERSION_2004;
#define VERIFY_IS_ZERO(field) \ #define VERIFY_IS_ZERO(field) \
@ -746,6 +747,9 @@ static void eapol_handle_ptk_3_of_4(uint32_t ifindex,
memcpy(step4->key_mic_data, mic, sizeof(mic)); memcpy(step4->key_mic_data, mic, sizeof(mic));
tx_packet(ifindex, sm->aa, sm->spa, step4, user_data); tx_packet(ifindex, sm->aa, sm->spa, step4, user_data);
if (install_tk)
install_tk(sm->ifindex, sm->aa, ptk->tk, rsne, sm->user_data);
fail: fail:
l_free(step4); l_free(step4);
} }
@ -867,6 +871,11 @@ void __eapol_set_protocol_version(enum eapol_protocol_version version)
protocol_version = version; protocol_version = version;
} }
void __eapol_set_install_tk_func(eapol_install_tk_func_t func)
{
install_tk = func;
}
struct l_io *eapol_open_pae(uint32_t index) struct l_io *eapol_open_pae(uint32_t index)
{ {
struct l_io *io; struct l_io *io;

View File

@ -99,6 +99,9 @@ typedef int (*eapol_tx_packet_func_t)(uint32_t ifindex, const uint8_t *aa,
const uint8_t *spa, const struct eapol_key *ek, const uint8_t *spa, const struct eapol_key *ek,
void *user_data); void *user_data);
typedef bool (*eapol_get_nonce_func_t)(uint8_t nonce[]); typedef bool (*eapol_get_nonce_func_t)(uint8_t nonce[]);
typedef void (*eapol_install_tk_func_t)(uint32_t ifindex, const uint8_t *aa,
const uint8_t *tk, const uint8_t *rsn,
void *user_data);
bool eapol_calculate_mic(const uint8_t *kck, const struct eapol_key *frame, bool eapol_calculate_mic(const uint8_t *kck, const struct eapol_key *frame,
uint8_t *mic); uint8_t *mic);
@ -135,6 +138,7 @@ void __eapol_rx_packet(uint32_t ifindex, const uint8_t *spa, const uint8_t *aa,
void __eapol_set_tx_packet_func(eapol_tx_packet_func_t func); void __eapol_set_tx_packet_func(eapol_tx_packet_func_t func);
void __eapol_set_get_nonce_func(eapol_get_nonce_func_t func); void __eapol_set_get_nonce_func(eapol_get_nonce_func_t func);
void __eapol_set_protocol_version(enum eapol_protocol_version version); void __eapol_set_protocol_version(enum eapol_protocol_version version);
void __eapol_set_install_tk_func(eapol_install_tk_func_t func);
struct eapol_sm *eapol_sm_new(); struct eapol_sm *eapol_sm_new();
void eapol_sm_free(struct eapol_sm *sm); void eapol_sm_free(struct eapol_sm *sm);