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

netdev: simplify netdev_choose_key_address

The key address can be chosen regardless of iftype. The deciding
factor is the authenticator bit in the handshake.
This commit is contained in:
James Prestwood 2018-10-05 16:03:12 -07:00 committed by Denis Kenzior
parent fb85b1d1a7
commit 395acc8203

View File

@ -1187,6 +1187,12 @@ static bool netdev_copy_tk(uint8_t *tk_buf, const uint8_t *tk,
return true;
}
static const uint8_t *netdev_choose_key_address(
struct netdev_handshake_state *nhs)
{
return (nhs->super.authenticator) ? nhs->super.spa : nhs->super.aa;
}
static void netdev_set_gtk(struct handshake_state *hs, uint8_t key_index,
const uint8_t *gtk, uint8_t gtk_len,
const uint8_t *rsc, uint8_t rsc_len,
@ -1273,24 +1279,6 @@ static void netdev_set_igtk(struct handshake_state *hs, uint8_t key_index,
netdev_setting_keys_failed(nhs, MMPDU_REASON_CODE_UNSPECIFIED);
}
static const uint8_t *netdev_choose_key_address(
struct netdev_handshake_state *nhs)
{
switch (nhs->netdev->type) {
case NL80211_IFTYPE_STATION:
return nhs->super.aa;
case NL80211_IFTYPE_AP:
return nhs->super.spa;
case NL80211_IFTYPE_ADHOC:
if (nhs->super.authenticator)
return nhs->super.spa;
else
return nhs->super.aa;
default:
return NULL;
}
}
static void netdev_new_pairwise_key_cb(struct l_genl_msg *msg, void *data)
{
struct netdev_handshake_state *nhs = data;