]> www.infradead.org Git - users/hch/misc.git/commitdiff
wifi: iwlwifi: mld: cleanup cipher lookup in resume
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Thu, 21 Aug 2025 17:47:13 +0000 (20:47 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Tue, 26 Aug 2025 15:39:44 +0000 (18:39 +0300)
We used to lookup the ciphers of the mcast keys, but this was beacuse it
was required for ieee80211_get_rekey_add. Now as this API no longer
needs the cipher as an argument, we can remove the cipher lookups.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250821204455.0650021c587b.Iae55243b575248cb4cc0b416f7f63092b5803219@changeid
drivers/net/wireless/intel/iwlwifi/mld/d3.c

index ed0a0f76f1c51b89c0ecd09b1c7c05455b9e4f9b..daa01fe62f84b450d54c85fec39a831ae9765096 100644 (file)
@@ -40,7 +40,7 @@ enum iwl_mld_d3_notif {
 struct iwl_mld_resume_key_iter_data {
        struct iwl_mld *mld;
        struct iwl_mld_wowlan_status *wowlan_status;
-       u32 num_keys, gtk_cipher, igtk_cipher, bigtk_cipher;
+       u32 num_keys;
        bool unhandled_cipher;
 };
 
@@ -708,11 +708,6 @@ iwl_mld_resume_keys_iter(struct ieee80211_hw *hw,
                        return;
                }
 
-               if (WARN_ON(data->gtk_cipher &&
-                           data->gtk_cipher != key->cipher))
-                       return;
-
-               data->gtk_cipher = key->cipher;
                status_idx = key->keyidx == wowlan_status->gtk[1].id;
                iwl_mld_set_key_rx_seq(key, &wowlan_status->gtk[status_idx]);
                break;
@@ -721,20 +716,10 @@ iwl_mld_resume_keys_iter(struct ieee80211_hw *hw,
        case WLAN_CIPHER_SUITE_BIP_CMAC_256:
        case WLAN_CIPHER_SUITE_AES_CMAC:
                if (key->keyidx == 4 || key->keyidx == 5) {
-                       if (WARN_ON(data->igtk_cipher &&
-                                   data->igtk_cipher != key->cipher))
-                               return;
-
-                       data->igtk_cipher = key->cipher;
                        if (key->keyidx == wowlan_status->igtk.id)
                                iwl_mld_set_key_rx_seq(key, &wowlan_status->igtk);
                }
                if (key->keyidx == 6 || key->keyidx == 7) {
-                       if (WARN_ON(data->bigtk_cipher &&
-                                   data->bigtk_cipher != key->cipher))
-                               return;
-
-                       data->bigtk_cipher = key->cipher;
                        status_idx = key->keyidx == wowlan_status->bigtk[1].id;
                        iwl_mld_set_key_rx_seq(key, &wowlan_status->bigtk[status_idx]);
                }
@@ -750,65 +735,16 @@ static void
 iwl_mld_add_mcast_rekey(struct ieee80211_vif *vif,
                        struct iwl_mld *mld,
                        struct iwl_mld_mcast_key_data *key_data,
-                       struct ieee80211_bss_conf *link_conf,
-                       u32 cipher)
+                       struct ieee80211_bss_conf *link_conf)
 {
        struct ieee80211_key_conf *key_config;
-       struct {
-               struct ieee80211_key_conf conf;
-               u8 key[WOWLAN_KEY_MAX_SIZE];
-       } conf = {
-               .conf.cipher = cipher,
-               .conf.keyidx = key_data->id,
-       };
        int link_id = vif->active_links ? __ffs(vif->active_links) : -1;
-       u8 key[WOWLAN_KEY_MAX_SIZE];
-
-       BUILD_BUG_ON(WLAN_KEY_LEN_CCMP != WLAN_KEY_LEN_GCMP);
-       BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_CCMP);
-       BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_GCMP_256);
-       BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_TKIP);
-       BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_BIP_GMAC_128);
-       BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_BIP_GMAC_256);
-       BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_AES_CMAC);
-       BUILD_BUG_ON(sizeof(conf.key) < sizeof(key_data->key));
 
        if (!key_data->len)
                return;
 
-       switch (cipher) {
-       case WLAN_CIPHER_SUITE_CCMP:
-       case WLAN_CIPHER_SUITE_GCMP:
-               conf.conf.keylen = WLAN_KEY_LEN_CCMP;
-               break;
-       case WLAN_CIPHER_SUITE_GCMP_256:
-               conf.conf.keylen = WLAN_KEY_LEN_GCMP_256;
-               break;
-       case WLAN_CIPHER_SUITE_TKIP:
-               conf.conf.keylen = WLAN_KEY_LEN_TKIP;
-               break;
-       case WLAN_CIPHER_SUITE_BIP_GMAC_128:
-               conf.conf.keylen = WLAN_KEY_LEN_BIP_GMAC_128;
-               break;
-       case WLAN_CIPHER_SUITE_BIP_GMAC_256:
-               conf.conf.keylen = WLAN_KEY_LEN_BIP_GMAC_256;
-               break;
-       case WLAN_CIPHER_SUITE_AES_CMAC:
-               conf.conf.keylen = WLAN_KEY_LEN_AES_CMAC;
-               break;
-       case WLAN_CIPHER_SUITE_BIP_CMAC_256:
-               conf.conf.keylen = WLAN_KEY_LEN_BIP_CMAC_256;
-               break;
-       default:
-               WARN_ON(1);
-       }
-
-       memcpy(conf.conf.key, key_data->key, conf.conf.keylen);
-
-       memcpy(key, key_data->key, sizeof(key_data->key));
-
-       key_config = ieee80211_gtk_rekey_add(vif, key_data->id, key,
-                                            sizeof(key), link_id);
+       key_config = ieee80211_gtk_rekey_add(vif, key_data->id, key_data->key,
+                                            sizeof(key_data->key), link_id);
        if (IS_ERR(key_config))
                return;
 
@@ -850,18 +786,15 @@ iwl_mld_add_all_rekeys(struct ieee80211_vif *vif,
        for (i = 0; i < ARRAY_SIZE(wowlan_status->gtk); i++)
                iwl_mld_add_mcast_rekey(vif, key_iter_data->mld,
                                        &wowlan_status->gtk[i],
-                                       link_conf,
-                                       key_iter_data->gtk_cipher);
+                                       link_conf);
 
        iwl_mld_add_mcast_rekey(vif, key_iter_data->mld,
-                               &wowlan_status->igtk,
-                               link_conf, key_iter_data->igtk_cipher);
+                               &wowlan_status->igtk, link_conf);
 
        for (i = 0; i < ARRAY_SIZE(wowlan_status->bigtk); i++)
                iwl_mld_add_mcast_rekey(vif, key_iter_data->mld,
                                        &wowlan_status->bigtk[i],
-                                       link_conf,
-                                       key_iter_data->bigtk_cipher);
+                                       link_conf);
 }
 
 static bool