Browse Source

qcacmn: Avoid using igtk key index for Mcast WEP key

Use def_tx_keyid for Mcast wep key.
Also reset all the key index in wlan_crypto_free_key once igtk,
bigtk and Ucast/Mcast are freed, so that their values are not
carried to next connection.

Change-Id: I9a1e8715c54f47905889511f983b3127b9b5cfcd
CRs-Fixed: 3297270
Abhishek Singh 2 years ago
parent
commit
3ec922f543

+ 5 - 1
umac/cmn_services/crypto/src/wlan_crypto_obj_mgr.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -201,7 +202,10 @@ static void wlan_crypto_free_key(struct wlan_crypto_comp_priv *crypto_priv)
 			crypto_priv->bigtk_key[i] = NULL;
 		}
 	}
-
+	/* Reset All key index as well */
+	crypto_priv->def_tx_keyid = 0;
+	crypto_priv->def_igtk_tx_keyid = 0;
+	crypto_priv->def_bigtk_tx_keyid = 0;
 }
 
 #ifdef CRYPTO_SET_KEY_CONVERGED

+ 1 - 1
umac/mlme/connection_mgr/core/src/wlan_cm_util.c

@@ -170,7 +170,7 @@ QDF_STATUS cm_set_key(struct cnx_mgr *cm_ctx, bool unicast,
 	cipher = wlan_crypto_get_cipher(cm_ctx->vdev, unicast, key_idx);
 	if (IS_WEP_CIPHER(cipher)) {
 		wep_key_idx = wlan_crypto_get_default_key_idx(cm_ctx->vdev,
-							      !unicast);
+							      false);
 		crypto_key = wlan_crypto_get_key(cm_ctx->vdev, wep_key_idx);
 		qdf_mem_copy(crypto_key->macaddr, bssid->bytes,
 			     QDF_MAC_ADDR_SIZE);