mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
netdev: Move pairwise NEW_KEY builder to nl80211util
This commit is contained in:
parent
1aa83722a0
commit
708a8feaba
27
src/netdev.c
27
src/netdev.c
@ -1898,27 +1898,6 @@ error:
|
|||||||
netdev_setting_keys_failed(nhs, err);
|
netdev_setting_keys_failed(nhs, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct l_genl_msg *netdev_build_cmd_new_key_pairwise(
|
|
||||||
struct netdev *netdev,
|
|
||||||
uint32_t cipher,
|
|
||||||
const uint8_t *aa,
|
|
||||||
const uint8_t *tk,
|
|
||||||
size_t tk_len,
|
|
||||||
uint8_t key_id)
|
|
||||||
{
|
|
||||||
struct l_genl_msg *msg;
|
|
||||||
|
|
||||||
msg = l_genl_msg_new_sized(NL80211_CMD_NEW_KEY, 512);
|
|
||||||
|
|
||||||
l_genl_msg_append_attr(msg, NL80211_ATTR_KEY_DATA, tk_len, tk);
|
|
||||||
l_genl_msg_append_attr(msg, NL80211_ATTR_KEY_CIPHER, 4, &cipher);
|
|
||||||
l_genl_msg_append_attr(msg, NL80211_ATTR_MAC, ETH_ALEN, aa);
|
|
||||||
l_genl_msg_append_attr(msg, NL80211_ATTR_KEY_IDX, 1, &key_id);
|
|
||||||
l_genl_msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &netdev->index);
|
|
||||||
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct l_genl_msg *netdev_build_cmd_new_rx_key_pairwise(
|
static struct l_genl_msg *netdev_build_cmd_new_rx_key_pairwise(
|
||||||
struct netdev *netdev,
|
struct netdev *netdev,
|
||||||
uint32_t cipher,
|
uint32_t cipher,
|
||||||
@ -2024,9 +2003,9 @@ static void netdev_set_tk(struct handshake_state *hs, uint8_t key_index,
|
|||||||
if (!netdev_copy_tk(tk_buf, tk, cipher, hs->authenticator))
|
if (!netdev_copy_tk(tk_buf, tk, cipher, hs->authenticator))
|
||||||
goto invalid_key;
|
goto invalid_key;
|
||||||
|
|
||||||
msg = netdev_build_cmd_new_key_pairwise(netdev, cipher, addr, tk_buf,
|
msg = nl80211_build_new_key_pairwise(netdev->index, cipher, addr,
|
||||||
crypto_cipher_key_len(cipher),
|
tk_buf, crypto_cipher_key_len(cipher),
|
||||||
key_index);
|
key_index);
|
||||||
nhs->pairwise_new_key_cmd_id =
|
nhs->pairwise_new_key_cmd_id =
|
||||||
l_genl_family_send(nl80211, msg, netdev_new_pairwise_key_cb,
|
l_genl_family_send(nl80211, msg, netdev_new_pairwise_key_cb,
|
||||||
nhs, NULL);
|
nhs, NULL);
|
||||||
|
@ -359,6 +359,26 @@ struct l_genl_msg *nl80211_build_new_key_group(uint32_t ifindex, uint32_t cipher
|
|||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct l_genl_msg *nl80211_build_new_key_pairwise(uint32_t ifindex,
|
||||||
|
uint32_t cipher,
|
||||||
|
const uint8_t addr[static 6],
|
||||||
|
const uint8_t *tk,
|
||||||
|
size_t tk_len,
|
||||||
|
uint8_t key_id)
|
||||||
|
{
|
||||||
|
struct l_genl_msg *msg;
|
||||||
|
|
||||||
|
msg = l_genl_msg_new_sized(NL80211_CMD_NEW_KEY, 512);
|
||||||
|
|
||||||
|
l_genl_msg_append_attr(msg, NL80211_ATTR_KEY_DATA, tk_len, tk);
|
||||||
|
l_genl_msg_append_attr(msg, NL80211_ATTR_KEY_CIPHER, 4, &cipher);
|
||||||
|
l_genl_msg_append_attr(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
|
||||||
|
l_genl_msg_append_attr(msg, NL80211_ATTR_KEY_IDX, 1, &key_id);
|
||||||
|
l_genl_msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &ifindex);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
static struct l_genl_msg *nl80211_build_set_station(uint32_t ifindex,
|
static struct l_genl_msg *nl80211_build_set_station(uint32_t ifindex,
|
||||||
const uint8_t *addr,
|
const uint8_t *addr,
|
||||||
struct nl80211_sta_flag_update *flags)
|
struct nl80211_sta_flag_update *flags)
|
||||||
|
@ -44,6 +44,12 @@ struct l_genl_msg *nl80211_build_new_key_group(uint32_t ifindex,
|
|||||||
const uint8_t *key, size_t key_len,
|
const uint8_t *key, size_t key_len,
|
||||||
const uint8_t *ctr, size_t ctr_len,
|
const uint8_t *ctr, size_t ctr_len,
|
||||||
const uint8_t *addr);
|
const uint8_t *addr);
|
||||||
|
struct l_genl_msg *nl80211_build_new_key_pairwise(uint32_t ifindex,
|
||||||
|
uint32_t cipher,
|
||||||
|
const uint8_t addr[static 6],
|
||||||
|
const uint8_t *tk,
|
||||||
|
size_t tk_len,
|
||||||
|
uint8_t key_id);
|
||||||
|
|
||||||
struct l_genl_msg *nl80211_build_set_station_authorized(uint32_t ifindex,
|
struct l_genl_msg *nl80211_build_set_station_authorized(uint32_t ifindex,
|
||||||
const uint8_t *addr);
|
const uint8_t *addr);
|
||||||
|
Loading…
Reference in New Issue
Block a user