eapol: Add user_data argument

To __eapol_rx_packet.  The same argument is passed to tx_packet
function.
This commit is contained in:
Denis Kenzior 2015-03-19 21:53:19 -05:00
parent b526df19d6
commit 19c67c3b3a
2 changed files with 13 additions and 9 deletions

View File

@ -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);

View File

@ -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);