mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-05-04 07:47:27 +02:00
eapol: Add user_data argument
To __eapol_rx_packet. The same argument is passed to tx_packet function.
This commit is contained in:
parent
b526df19d6
commit
19c67c3b3a
16
src/eapol.c
16
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,
|
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 crypto_ptk *ptk = (struct crypto_ptk *) sm->ptk;
|
||||||
struct eapol_key *step2;
|
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;
|
goto fail;
|
||||||
|
|
||||||
memcpy(step2->key_mic_data, mic, sizeof(mic));
|
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:
|
fail:
|
||||||
l_free(step2);
|
l_free(step2);
|
||||||
@ -677,7 +678,8 @@ static void eapol_handle_ptk_3_of_4(uint32_t ifindex,
|
|||||||
struct eapol_sm *sm,
|
struct eapol_sm *sm,
|
||||||
const struct eapol_key *ek,
|
const struct eapol_key *ek,
|
||||||
const uint8_t *decrypted_key_data,
|
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 crypto_ptk *ptk = (struct crypto_ptk *) sm->ptk;
|
||||||
struct eapol_key *step4;
|
struct eapol_key *step4;
|
||||||
@ -733,7 +735,7 @@ static void eapol_handle_ptk_3_of_4(uint32_t ifindex,
|
|||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
memcpy(step4->key_mic_data, mic, sizeof(mic));
|
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:
|
fail:
|
||||||
l_free(step4);
|
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,
|
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;
|
const struct eapol_key *ek;
|
||||||
struct eapol_sm *sm;
|
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 no MIC, then assume packet 1, otherwise packet 3 */
|
||||||
if (!ek->key_mic)
|
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
|
else
|
||||||
eapol_handle_ptk_3_of_4(ifindex, sm, ek, decrypted_key_data,
|
eapol_handle_ptk_3_of_4(ifindex, sm, ek, decrypted_key_data,
|
||||||
decrypted_key_data_len);
|
decrypted_key_data_len, user_data);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
l_free(decrypted_key_data);
|
l_free(decrypted_key_data);
|
||||||
|
@ -97,7 +97,8 @@ struct eapol_key {
|
|||||||
|
|
||||||
typedef int (*eapol_tx_packet_func_t)(uint32_t ifindex, const uint8_t *aa_addr,
|
typedef int (*eapol_tx_packet_func_t)(uint32_t ifindex, const uint8_t *aa_addr,
|
||||||
const uint8_t *sta_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[]);
|
typedef bool (*eapol_get_nonce_func_t)(uint8_t nonce[]);
|
||||||
|
|
||||||
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,
|
||||||
@ -129,7 +130,8 @@ struct eapol_key *eapol_create_ptk_4_of_4(
|
|||||||
uint64_t key_replay_counter);
|
uint64_t key_replay_counter);
|
||||||
|
|
||||||
void __eapol_rx_packet(uint32_t ifindex, const uint8_t *spa, const uint8_t *aa,
|
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_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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user