Эх сурвалжийг харах

qcacmn: Fix group mgmt cipher error

The value of req->crypto.mgmt_ciphers is bit mask
of wlan_crypto_cipher_type, but the API
wlan_crypto_set_mgmtcipher expects the enum value of
wlan_crypto_cipher_type at present.
Fix by change wlan_crypto_set_mgmtcipher to use bit
mask of mgmt cipher type.

Change-Id: I2d262bbe3f47e41635097ef8ce5722a2baa38001
CRs-Fixed: 2946164
Liangwei Dong 4 жил өмнө
parent
commit
6291826a31

+ 4 - 1
umac/cmn_services/crypto/src/wlan_crypto_global_api.c

@@ -1066,6 +1066,8 @@ QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev,
 	qdf_mem_copy(key->keyval, req_key->keydata, sizeof(key->keyval));
 	key->valid = 1;
 	if ((IS_MGMT_CIPHER(req_key->type))) {
+		uint32_t mgmt_cipher = 0;
+
 		if (HAS_CIPHER_CAP(crypto_params,
 					WLAN_CRYPTO_CAP_PMF_OFFLOAD) ||
 					is_bigtk(req_key->keyix)) {
@@ -1074,7 +1076,8 @@ QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev,
 						key, macaddr, req_key->type);
 			}
 		}
-		wlan_crypto_set_mgmtcipher(crypto_params, req_key->type);
+		QDF_SET_PARAM(mgmt_cipher, req_key->type);
+		wlan_crypto_set_mgmtcipher(crypto_params, mgmt_cipher);
 		status = wlan_crypto_set_igtk_key(key);
 		return status;
 	} else if (IS_FILS_CIPHER(req_key->type)) {

+ 13 - 5
umac/cmn_services/crypto/src/wlan_crypto_param_handling.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2019, 2021 The Linux Foundation. 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
@@ -179,17 +179,25 @@ int32_t wlan_crypto_get_ucastciphers(struct wlan_crypto_params *crypto_params)
  * wlan_crypto_set_mgmtcipher - called by ucfg to configure
  *                                        mgmt ciphers in vdev
  * @vdev: vdev
- * @ciphers: bitmap value of all supported unicast ciphers
+ * @ciphers: bitmap value of all supported group mgmt ciphers
  *
- * This function gets called from ucfg to configure unicast ciphers in vdev
+ * This function gets called from ucfg to configure group mgmt ciphers in vdev
  *
  * Return: QDF_STATUS_SUCCESS - in case of success
  */
 QDF_STATUS wlan_crypto_set_mgmtcipher(
 				struct wlan_crypto_params *crypto_params,
-				uint32_t value)
+				uint32_t ciphers)
 {
-	SET_MGMT_CIPHER(crypto_params, value);
+	uint16_t i;
+
+	RESET_MGMT_CIPHERS(crypto_params);
+
+	for (i = 0; i < WLAN_CRYPTO_CIPHER_MAX ; i++) {
+		if (HAS_PARAM(ciphers, i) && IS_MGMT_CIPHER(i))
+			SET_MGMT_CIPHER(crypto_params, i);
+	}
+
 	return QDF_STATUS_SUCCESS;
 }
 

+ 3 - 3
umac/cmn_services/crypto/src/wlan_crypto_param_handling_i.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, 2021 The Linux Foundation. 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
@@ -91,9 +91,9 @@ int32_t wlan_crypto_get_ucastciphers(struct wlan_crypto_params *crypto_params);
  * wlan_crypto_set_mgmtcipher - called by ucfg to configure
  *                                        mgmt ciphers in vdev
  * @vdev: vdev
- * @ciphers: bitmap value of all supported unicast ciphers
+ * @ciphers: bitmap value of all supported mgmt ciphers
  *
- * This function gets called from ucfg to configure unicast ciphers in vdev
+ * This function gets called from ucfg to configure mgmt ciphers in vdev
  *
  * Return: QDF_STATUS_SUCCESS - in case of success
  */