mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 06:01:57 +00:00
wifi: mac80211: add link id to ieee80211_gtk_rekey_add()
In MLO, we need the link id in the GTK key to be given by the driver after rekeying in wowlan, so add that. Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com> Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com> Link: https://msgid.link/20240228094500.ce1bfc83a680.I43a6f8ab2804ee07116a37d5b9ec601b843464b1@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
b2edc72171
commit
04577bfa99
@ -1976,6 +1976,7 @@ static bool iwl_mvm_gtk_rekey(struct iwl_wowlan_status_data *status,
|
||||
} conf = {
|
||||
.conf.cipher = gtk_cipher,
|
||||
};
|
||||
int link_id = vif->active_links ? __ffs(vif->active_links) : -1;
|
||||
|
||||
BUILD_BUG_ON(WLAN_KEY_LEN_CCMP != WLAN_KEY_LEN_GCMP);
|
||||
BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_CCMP);
|
||||
@ -2009,7 +2010,7 @@ static bool iwl_mvm_gtk_rekey(struct iwl_wowlan_status_data *status,
|
||||
memcpy(conf.conf.key, status->gtk[i].key,
|
||||
sizeof(status->gtk[i].key));
|
||||
|
||||
key = ieee80211_gtk_rekey_add(vif, &conf.conf);
|
||||
key = ieee80211_gtk_rekey_add(vif, &conf.conf, link_id);
|
||||
if (IS_ERR(key))
|
||||
return false;
|
||||
|
||||
@ -2040,6 +2041,7 @@ iwl_mvm_d3_igtk_bigtk_rekey_add(struct iwl_wowlan_status_data *status,
|
||||
.conf.keyidx = key_data->id,
|
||||
};
|
||||
struct ieee80211_key_seq seq;
|
||||
int link_id = vif->active_links ? __ffs(vif->active_links) : -1;
|
||||
|
||||
if (!key_data->len)
|
||||
return true;
|
||||
@ -2065,17 +2067,17 @@ iwl_mvm_d3_igtk_bigtk_rekey_add(struct iwl_wowlan_status_data *status,
|
||||
BUILD_BUG_ON(sizeof(conf.key) < sizeof(key_data->key));
|
||||
memcpy(conf.conf.key, key_data->key, conf.conf.keylen);
|
||||
|
||||
key_config = ieee80211_gtk_rekey_add(vif, &conf.conf);
|
||||
key_config = ieee80211_gtk_rekey_add(vif, &conf.conf, link_id);
|
||||
if (IS_ERR(key_config))
|
||||
return false;
|
||||
ieee80211_set_key_rx_seq(key_config, 0, &seq);
|
||||
|
||||
if (key_config->keyidx == 4 || key_config->keyidx == 5) {
|
||||
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
|
||||
int link_id = vif->active_links ? __ffs(vif->active_links) : 0;
|
||||
struct iwl_mvm_vif_link_info *mvm_link =
|
||||
mvmvif->link[link_id];
|
||||
struct iwl_mvm_vif_link_info *mvm_link;
|
||||
|
||||
link_id = link_id < 0 ? 0 : link_id;
|
||||
mvm_link = mvmvif->link[link_id];
|
||||
mvm_link->igtk = key_config;
|
||||
}
|
||||
|
||||
|
@ -5912,6 +5912,7 @@ void ieee80211_remove_key(struct ieee80211_key_conf *keyconf);
|
||||
* ieee80211_gtk_rekey_add - add a GTK key from rekeying during WoWLAN
|
||||
* @vif: the virtual interface to add the key on
|
||||
* @keyconf: new key data
|
||||
* @link_id: the link id of the key or -1 for non-MLO
|
||||
*
|
||||
* When GTK rekeying was done while the system was suspended, (a) new
|
||||
* key(s) will be available. These will be needed by mac80211 for proper
|
||||
@ -5939,7 +5940,8 @@ void ieee80211_remove_key(struct ieee80211_key_conf *keyconf);
|
||||
*/
|
||||
struct ieee80211_key_conf *
|
||||
ieee80211_gtk_rekey_add(struct ieee80211_vif *vif,
|
||||
struct ieee80211_key_conf *keyconf);
|
||||
struct ieee80211_key_conf *keyconf,
|
||||
int link_id);
|
||||
|
||||
/**
|
||||
* ieee80211_gtk_rekey_notify - notify userspace supplicant of rekeying
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net>
|
||||
* Copyright 2013-2014 Intel Mobile Communications GmbH
|
||||
* Copyright 2015-2017 Intel Deutschland GmbH
|
||||
* Copyright 2018-2020, 2022-2023 Intel Corporation
|
||||
* Copyright 2018-2020, 2022-2024 Intel Corporation
|
||||
*/
|
||||
|
||||
#include <crypto/utils.h>
|
||||
@ -1372,12 +1372,19 @@ EXPORT_SYMBOL_GPL(ieee80211_remove_key);
|
||||
|
||||
struct ieee80211_key_conf *
|
||||
ieee80211_gtk_rekey_add(struct ieee80211_vif *vif,
|
||||
struct ieee80211_key_conf *keyconf)
|
||||
struct ieee80211_key_conf *keyconf,
|
||||
int link_id)
|
||||
{
|
||||
struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
|
||||
struct ieee80211_local *local = sdata->local;
|
||||
struct ieee80211_key *key;
|
||||
int err;
|
||||
struct ieee80211_link_data *link_data =
|
||||
link_id < 0 ? &sdata->deflink :
|
||||
sdata_dereference(sdata->link[link_id], sdata);
|
||||
|
||||
if (WARN_ON(!link_data))
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
if (WARN_ON(!local->wowlan))
|
||||
return ERR_PTR(-EINVAL);
|
||||
@ -1394,8 +1401,9 @@ ieee80211_gtk_rekey_add(struct ieee80211_vif *vif,
|
||||
if (sdata->u.mgd.mfp != IEEE80211_MFP_DISABLED)
|
||||
key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT;
|
||||
|
||||
/* FIXME: this function needs to get a link ID */
|
||||
err = ieee80211_key_link(key, &sdata->deflink, NULL);
|
||||
key->conf.link_id = link_id;
|
||||
|
||||
err = ieee80211_key_link(key, link_data, NULL);
|
||||
if (err)
|
||||
return ERR_PTR(err);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user