From: Benjamin Berg The CIGTK and pairwise key needs to be installed with the corresponding flag when CIP is in use. Add the logic to set the correct flags and install the CIGTK in station mode. For AP mode, ignore the CIGTK installation. The firmware will never generate frames that would need to be encrypted. Signed-off-by: Benjamin Berg Signed-off-by: Miri Korenblit --- .../net/wireless/intel/iwlwifi/fw/api/datapath.h | 2 ++ drivers/net/wireless/intel/iwlwifi/mld/key.c | 3 +++ drivers/net/wireless/intel/iwlwifi/mld/mac80211.c | 15 +++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/datapath.h b/drivers/net/wireless/intel/iwlwifi/fw/api/datapath.h index eddf13325df9..78c991719c28 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/api/datapath.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/api/datapath.h @@ -676,6 +676,7 @@ struct iwl_scd_queue_cfg_cmd { * @IWL_SEC_KEY_FLAG_MFP: MFP is in used for this key * @IWL_SEC_KEY_FLAG_MCAST_KEY: this is a multicast key * @IWL_SEC_KEY_FLAG_SPP_AMSDU: SPP A-MSDU should be used + * @IWL_SEC_KEY_FLAG_CTRL_FRAME: key is used for CIP * @IWL_SEC_KEY_FLAG_ASSOC_ENC: use this key for (Re)Assoc Req/Resp encryption */ enum iwl_sec_key_flags { @@ -689,6 +690,7 @@ enum iwl_sec_key_flags { IWL_SEC_KEY_FLAG_MFP = 0x20, IWL_SEC_KEY_FLAG_MCAST_KEY = 0x40, IWL_SEC_KEY_FLAG_SPP_AMSDU = 0x80, + IWL_SEC_KEY_FLAG_CTRL_FRAME = 0x100, IWL_SEC_KEY_FLAG_ASSOC_ENC = 0x200, }; diff --git a/drivers/net/wireless/intel/iwlwifi/mld/key.c b/drivers/net/wireless/intel/iwlwifi/mld/key.c index f2c87f830ba3..74b483783de8 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/key.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/key.c @@ -19,6 +19,9 @@ static u32 iwl_mld_get_key_flags(struct iwl_mld *mld, if (!pairwise) flags |= IWL_SEC_KEY_FLAG_MCAST_KEY; + if (key->flags & IEEE80211_KEY_FLAG_CIP) + flags |= IWL_SEC_KEY_FLAG_CTRL_FRAME; + switch (key->cipher) { case WLAN_CIPHER_SUITE_TKIP: flags |= IWL_SEC_KEY_FLAG_CIPHER_TKIP; diff --git a/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c index 898e376e2979..a7530e01f8c0 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c @@ -2211,6 +2211,21 @@ static int iwl_mld_set_key_add(struct iwl_mld *mld, /* Will be set to 0 if added successfully */ key->hw_key_idx = STA_KEY_IDX_INVALID; + /* + * In AP mode (i.e. when there is no STA and the key is used for TX), + * simply do not install CIGTK but claim we did. Currently the FW will + * never generate frames that would be protected with the CIGTK, so the + * key does not need to be installed. However, these keys require HW + * crypto so we must return success to mac80211. + * + * Note that if we start to install it, we will also need to update the + * bcast/mcast stations to set the correct CIP MIC delays when stations + * join/leave. + */ + if (!sta && !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE) && + (key->flags & IEEE80211_KEY_FLAG_CIP)) + return 0; + switch (key->cipher) { case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: -- 2.34.1