3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-17 17:39:28 +01:00

eapol: Add get_nonce func and setter

This commit is contained in:
Denis Kenzior 2015-02-24 11:09:42 -06:00
parent 79bf677e71
commit 54fa4f29c7
2 changed files with 12 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#include "eapol.h"
struct l_hashmap *state_machines;
eapol_get_nonce_func_t get_nonce = NULL;
enum eapol_protocol_version protocol_version = EAPOL_PROTOCOL_VERSION_2004;
#define VERIFY_IS_ZERO(field) \
@ -481,6 +482,12 @@ void eapol_sm_set_own_rsn(struct eapol_sm *sm, const uint8_t *rsn_ie,
sm->own_rsn = l_memdup(rsn_ie, len);
}
void __eapol_set_get_nonce_func(eapol_get_nonce_func_t func)
{
get_nonce = func;
}
bool eapol_init()
{
state_machines = l_hashmap_new();
@ -492,6 +499,7 @@ bool eapol_init()
bool eapol_exit()
{
l_hashmap_destroy(state_machines, eapol_sm_destroy);
get_nonce = NULL;
return true;
}

View File

@ -95,6 +95,8 @@ struct eapol_key {
uint8_t key_data[0];
} __attribute__ ((packed));
typedef bool (*eapol_get_nonce_func_t)(uint8_t nonce[]);
bool eapol_calculate_mic(const uint8_t *kck, const struct eapol_key *frame,
uint8_t *mic);
bool eapol_verify_mic(const uint8_t *kck, const struct eapol_key *frame);
@ -122,6 +124,8 @@ struct eapol_key *eapol_create_ptk_4_of_4(
enum eapol_key_descriptor_version version,
uint64_t key_replay_counter);
void __eapol_set_get_nonce_func(eapol_get_nonce_func_t func);
struct eapol_sm *eapol_sm_new();
void eapol_sm_free(struct eapol_sm *sm);