mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-02 09:22:32 +01:00
handshake: Add GTK data to handshake_state
Add places to store the GTK data, index and RSC in struct handshake_state and add a setter function for these fields. We may want to also convert install_gtk to use these fields similar to install_ptk.
This commit is contained in:
parent
7eb59602df
commit
68e612573e
@ -445,6 +445,21 @@ bool handshake_state_get_pmkid(struct handshake_state *s, uint8_t *out_pmkid)
|
||||
use_sha256);
|
||||
}
|
||||
|
||||
void handshake_state_set_gtk(struct handshake_state *s, const uint8_t *key,
|
||||
unsigned int key_index, const uint8_t *rsc)
|
||||
{
|
||||
enum crypto_cipher cipher =
|
||||
ie_rsn_cipher_suite_to_cipher(s->group_cipher);
|
||||
int key_len = crypto_cipher_key_len(cipher);
|
||||
|
||||
if (!key_len)
|
||||
return;
|
||||
|
||||
memcpy(s->gtk, key, key_len);
|
||||
s->gtk_index = key_index;
|
||||
memcpy(s->gtk_rsc, rsc, 6);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function performs a match of the RSN/WPA IE obtained from the scan
|
||||
* results vs the RSN/WPA IE obtained as part of the 4-way handshake. If they
|
||||
|
@ -109,6 +109,9 @@ struct handshake_state {
|
||||
uint8_t r0khid[48];
|
||||
size_t r0khid_len;
|
||||
uint8_t r1khid[6];
|
||||
uint8_t gtk[32];
|
||||
uint8_t gtk_rsc[6];
|
||||
unsigned int gtk_index;
|
||||
void *user_data;
|
||||
|
||||
void (*free)(struct handshake_state *s);
|
||||
@ -179,6 +182,9 @@ bool handshake_state_get_pmkid(struct handshake_state *s, uint8_t *out_pmkid);
|
||||
bool handshake_decode_fte_key(struct handshake_state *s, const uint8_t *wrapped,
|
||||
size_t key_len, uint8_t *key_out);
|
||||
|
||||
void handshake_state_set_gtk(struct handshake_state *s, const uint8_t *key,
|
||||
unsigned int key_index, const uint8_t *rsc);
|
||||
|
||||
bool handshake_util_ap_ie_matches(const uint8_t *msg_ie,
|
||||
const uint8_t *scan_ie, bool is_wpa);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user