From 19c67c3b3ad728a5c753c1ca607d6a2984960f58 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Thu, 19 Mar 2015 21:53:19 -0500 Subject: [PATCH] eapol: Add user_data argument To __eapol_rx_packet. The same argument is passed to tx_packet function. --- src/eapol.c | 16 +++++++++------- src/eapol.h | 6 ++++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/eapol.c b/src/eapol.c index 12a850d5..aa943b98 100644 --- a/src/eapol.c +++ b/src/eapol.c @@ -505,7 +505,8 @@ void eapol_start(uint32_t ifindex, struct eapol_sm *sm) } static void eapol_handle_ptk_1_of_4(uint32_t ifindex, struct eapol_sm *sm, - const struct eapol_key *ek) + const struct eapol_key *ek, + void *user_data) { struct crypto_ptk *ptk = (struct crypto_ptk *) sm->ptk; struct eapol_key *step2; @@ -537,7 +538,7 @@ static void eapol_handle_ptk_1_of_4(uint32_t ifindex, struct eapol_sm *sm, goto fail; memcpy(step2->key_mic_data, mic, sizeof(mic)); - tx_packet(ifindex, sm->aa, sm->spa, step2); + tx_packet(ifindex, sm->aa, sm->spa, step2, user_data); fail: l_free(step2); @@ -677,7 +678,8 @@ static void eapol_handle_ptk_3_of_4(uint32_t ifindex, struct eapol_sm *sm, const struct eapol_key *ek, const uint8_t *decrypted_key_data, - size_t decrypted_key_data_size) + size_t decrypted_key_data_size, + void *user_data) { struct crypto_ptk *ptk = (struct crypto_ptk *) sm->ptk; struct eapol_key *step4; @@ -733,7 +735,7 @@ static void eapol_handle_ptk_3_of_4(uint32_t ifindex, goto fail; memcpy(step4->key_mic_data, mic, sizeof(mic)); - tx_packet(ifindex, sm->aa, sm->spa, step4); + tx_packet(ifindex, sm->aa, sm->spa, step4, user_data); fail: l_free(step4); @@ -766,7 +768,7 @@ static struct eapol_sm *eapol_find_sm(uint32_t ifindex, } void __eapol_rx_packet(uint32_t ifindex, const uint8_t *spa, const uint8_t *aa, - const uint8_t *frame, size_t len) + const uint8_t *frame, size_t len, void *user_data) { const struct eapol_key *ek; struct eapol_sm *sm; @@ -830,10 +832,10 @@ void __eapol_rx_packet(uint32_t ifindex, const uint8_t *spa, const uint8_t *aa, /* If no MIC, then assume packet 1, otherwise packet 3 */ if (!ek->key_mic) - eapol_handle_ptk_1_of_4(ifindex, sm, ek); + eapol_handle_ptk_1_of_4(ifindex, sm, ek, user_data); else eapol_handle_ptk_3_of_4(ifindex, sm, ek, decrypted_key_data, - decrypted_key_data_len); + decrypted_key_data_len, user_data); done: l_free(decrypted_key_data); diff --git a/src/eapol.h b/src/eapol.h index a121f524..6da0e211 100644 --- a/src/eapol.h +++ b/src/eapol.h @@ -97,7 +97,8 @@ struct eapol_key { typedef int (*eapol_tx_packet_func_t)(uint32_t ifindex, const uint8_t *aa_addr, const uint8_t *sta_addr, - const struct eapol_key *ek); + const struct eapol_key *ek, + void *user_data); typedef bool (*eapol_get_nonce_func_t)(uint8_t nonce[]); bool eapol_calculate_mic(const uint8_t *kck, const struct eapol_key *frame, @@ -129,7 +130,8 @@ struct eapol_key *eapol_create_ptk_4_of_4( uint64_t key_replay_counter); void __eapol_rx_packet(uint32_t ifindex, const uint8_t *spa, const uint8_t *aa, - const uint8_t *frame, size_t len); + const uint8_t *frame, size_t len, + void *user_data); void __eapol_set_tx_packet_func(eapol_tx_packet_func_t func); void __eapol_set_get_nonce_func(eapol_get_nonce_func_t func);