From bf5a6a399986a98e23edd8fd1c9ee6ce9791181e Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Wed, 25 Mar 2015 22:35:12 -0500 Subject: [PATCH] eapol: Add __eapol_set_install_tk_func --- src/eapol.c | 9 +++++++++ src/eapol.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/src/eapol.c b/src/eapol.c index 05eb4e4f..1523283c 100644 --- a/src/eapol.c +++ b/src/eapol.c @@ -42,6 +42,7 @@ struct l_queue *state_machines; eapol_tx_packet_func_t tx_packet = 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; #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)); 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: l_free(step4); } @@ -867,6 +871,11 @@ void __eapol_set_protocol_version(enum eapol_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 *io; diff --git a/src/eapol.h b/src/eapol.h index a9466831..312cc8f8 100644 --- a/src/eapol.h +++ b/src/eapol.h @@ -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, void *user_data); 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, 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_get_nonce_func(eapol_get_nonce_func_t func); 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(); void eapol_sm_free(struct eapol_sm *sm);