mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 02:19:26 +01:00
handshake: Add handshake_util_find_kde
This commit is contained in:
parent
8606f6e96a
commit
f7b59750d0
@ -813,8 +813,9 @@ bool handshake_util_ap_ie_matches(const uint8_t *msg_ie,
|
||||
return true;
|
||||
}
|
||||
|
||||
static const uint8_t *find_kde(const uint8_t *data, size_t data_len,
|
||||
size_t *out_len, enum handshake_kde selector)
|
||||
const uint8_t *handshake_util_find_kde(enum handshake_kde selector,
|
||||
const uint8_t *data, size_t data_len,
|
||||
size_t *out_kde_len)
|
||||
{
|
||||
struct ie_tlv_iter iter;
|
||||
const uint8_t *result;
|
||||
@ -835,8 +836,8 @@ static const uint8_t *find_kde(const uint8_t *data, size_t data_len,
|
||||
if (l_get_be32(result) != selector)
|
||||
continue;
|
||||
|
||||
if (out_len)
|
||||
*out_len = len - 4;
|
||||
if (out_kde_len)
|
||||
*out_kde_len = len - 4;
|
||||
|
||||
return result + 4;
|
||||
}
|
||||
@ -848,8 +849,8 @@ const uint8_t *handshake_util_find_gtk_kde(const uint8_t *data, size_t data_len,
|
||||
size_t *out_gtk_len)
|
||||
{
|
||||
size_t gtk_len;
|
||||
const uint8_t *gtk = find_kde(data, data_len, >k_len,
|
||||
HANDSHAKE_KDE_GTK);
|
||||
const uint8_t *gtk = handshake_util_find_kde(HANDSHAKE_KDE_GTK,
|
||||
data, data_len, >k_len);
|
||||
|
||||
if (!gtk)
|
||||
return NULL;
|
||||
@ -875,8 +876,8 @@ const uint8_t *handshake_util_find_igtk_kde(const uint8_t *data,
|
||||
size_t *out_igtk_len)
|
||||
{
|
||||
size_t igtk_len;
|
||||
const uint8_t *igtk = find_kde(data, data_len, &igtk_len,
|
||||
HANDSHAKE_KDE_IGTK);
|
||||
const uint8_t *igtk = handshake_util_find_kde(HANDSHAKE_KDE_IGTK,
|
||||
data, data_len, &igtk_len);
|
||||
|
||||
if (!igtk)
|
||||
return NULL;
|
||||
@ -903,7 +904,8 @@ const uint8_t *handshake_util_find_pmkid_kde(const uint8_t *data,
|
||||
const uint8_t *pmkid;
|
||||
size_t pmkid_len;
|
||||
|
||||
pmkid = find_kde(data, data_len, &pmkid_len, HANDSHAKE_KDE_PMKID);
|
||||
pmkid = handshake_util_find_kde(HANDSHAKE_KDE_PMKID, data, data_len,
|
||||
&pmkid_len);
|
||||
|
||||
if (pmkid && pmkid_len != 16)
|
||||
return NULL;
|
||||
|
@ -233,6 +233,9 @@ void handshake_state_set_gtk(struct handshake_state *s, const uint8_t *key,
|
||||
bool handshake_util_ap_ie_matches(const uint8_t *msg_ie,
|
||||
const uint8_t *scan_ie, bool is_wpa);
|
||||
|
||||
const uint8_t *handshake_util_find_kde(enum handshake_kde selector,
|
||||
const uint8_t *data, size_t data_len,
|
||||
size_t *out_kde_len);
|
||||
const uint8_t *handshake_util_find_gtk_kde(const uint8_t *data, size_t data_len,
|
||||
size_t *out_gtk_len);
|
||||
const uint8_t *handshake_util_find_igtk_kde(const uint8_t *data,
|
||||
|
Loading…
Reference in New Issue
Block a user