3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 23:09:34 +01:00

eapol: Add eapol_create_ptk_4_of_4

This commit is contained in:
Denis Kenzior 2015-02-13 14:10:28 -06:00
parent 11de45fa4d
commit df8d60d7e1
2 changed files with 31 additions and 2 deletions

View File

@ -205,9 +205,10 @@ bool eapol_process_ptk_2_of_4(const uint8_t *frame, size_t len,
return true; return true;
} }
struct eapol_key *eapol_create_ptk_2_of_4( static struct eapol_key *eapol_create_common(
enum eapol_protocol_version protocol, enum eapol_protocol_version protocol,
enum eapol_key_descriptor_version version, enum eapol_key_descriptor_version version,
bool secure,
uint64_t key_replay_counter, uint64_t key_replay_counter,
const uint8_t snonce[], const uint8_t snonce[],
size_t extra_len, size_t extra_len,
@ -227,7 +228,7 @@ struct eapol_key *eapol_create_ptk_2_of_4(
out_frame->install = false; out_frame->install = false;
out_frame->key_ack = false; out_frame->key_ack = false;
out_frame->key_mic = true; out_frame->key_mic = true;
out_frame->secure = false; out_frame->secure = secure;
out_frame->error = false; out_frame->error = false;
out_frame->request = false; out_frame->request = false;
out_frame->encrypted_key_data = false; out_frame->encrypted_key_data = false;
@ -240,3 +241,25 @@ struct eapol_key *eapol_create_ptk_2_of_4(
return out_frame; return out_frame;
} }
struct eapol_key *eapol_create_ptk_2_of_4(
enum eapol_protocol_version protocol,
enum eapol_key_descriptor_version version,
uint64_t key_replay_counter,
const uint8_t snonce[],
size_t extra_len,
const uint8_t *extra_data)
{
return eapol_create_common(protocol, version, false, key_replay_counter,
snonce, extra_len, extra_data);
}
struct eapol_key *eapol_create_ptk_4_of_4(
enum eapol_protocol_version protocol,
enum eapol_key_descriptor_version version,
uint64_t key_replay_counter,
const uint8_t snonce[])
{
return eapol_create_common(protocol, version, true, key_replay_counter,
snonce, 0, NULL);
}

View File

@ -109,3 +109,9 @@ struct eapol_key *eapol_create_ptk_2_of_4(
const uint8_t snonce[], const uint8_t snonce[],
size_t extra_len, size_t extra_len,
const uint8_t *extra_data); const uint8_t *extra_data);
struct eapol_key *eapol_create_ptk_4_of_4(
enum eapol_protocol_version protocol,
enum eapol_key_descriptor_version version,
uint64_t key_replay_counter,
const uint8_t snonce[]);