Browse Source

qcacmn: Add mgmt cipher in rsn ie

Mgmt cipher is not set when igtk key is set.

Set mgmt cipher for igtk set key in crypto params
and add mgmt cipher in RSN IE.

Change-Id: I9e18972b7dd614a3692c107e2d92ac2fc6110458
Crs-Fixed: 2239608
Ashok Ponnaiah 7 years ago
parent
commit
adfce988a9

+ 3 - 4
umac/cmn_services/crypto/inc/wlan_crypto_global_def.h

@@ -135,10 +135,9 @@ typedef enum wlan_crypto_cap {
 	WLAN_CRYPTO_CAP_WAPI_SMS4        = 11,
 	WLAN_CRYPTO_CAP_WAPI_GCM4        = 12,
 	WLAN_CRYPTO_CAP_KEY_MGMT_OFFLOAD = 13,
-	WLAN_CRYPTO_CAP_PMF              = 14,
-	WLAN_CRYPTO_CAP_PMF_OFFLOAD      = 15,
-	WLAN_CRYPTO_CAP_PN_TID_BASED     = 16,
-	WLAN_CRYPTO_CAP_FILS_AEAD        = 17,
+	WLAN_CRYPTO_CAP_PMF_OFFLOAD      = 14,
+	WLAN_CRYPTO_CAP_PN_TID_BASED     = 15,
+	WLAN_CRYPTO_CAP_FILS_AEAD        = 16,
 } wlan_crypto_cap;
 
 typedef enum wlan_crypto_rsn_cap {

+ 1 - 1
umac/cmn_services/crypto/src/wlan_crypto_def_i.h

@@ -334,7 +334,7 @@ static inline void wlan_crypto_put_be64(u8 *a, u64 val)
 		HAS_MCAST_CIPHER((_param), WLAN_CRYPTO_CIPHER_WAPI_SMS4)
 
 #define RESET_MGMT_CIPHERS(_param)   ((_param)->mgmtcipherset = 0)
-#define SET_MGMT_CIPHER(_param, _c)  ((_param)->mgmtcipherset |= (1<<(_c)))
+#define SET_MGMT_CIPHER(_param, _c)  ((_param)->mgmtcipherset = (1<<(_c)))
 #define HAS_MGMT_CIPHER(_param, _c)  ((_param)->mgmtcipherset & (1<<(_c)))
 #define IS_MGMT_CIPHER(_c)      ((_c == WLAN_CRYPTO_CIPHER_AES_CMAC) || \
 				 (_c == WLAN_CRYPTO_CIPHER_AES_CMAC_256) || \

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

@@ -635,6 +635,7 @@ QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev,
 						key, macaddr, req_key->type);
 			}
 		}
+		wlan_crypto_set_mgmtcipher(crypto_params, req_key->type);
 		status = wlan_crypto_set_igtk_key(key);
 		return status;
 	} else if (IS_FILS_CIPHER(req_key->type)) {
@@ -2392,26 +2393,23 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev,
 
 	WLAN_CRYPTO_ADDSHORT(frm, crypto_params->rsn_caps);
 	/* optional capabilities */
-	if (crypto_params->rsn_caps != 0 &&
-		crypto_params->rsn_caps != WLAN_CRYPTO_RSN_CAP_PREAUTH){
-
+	if (crypto_params->rsn_caps & WLAN_CRYPTO_RSN_CAP_MFP_ENABLED) {
+		/* PMK list */
+		WLAN_CRYPTO_ADDSHORT(frm, 0);
 		if (HAS_MGMT_CIPHER(crypto_params,
 						WLAN_CRYPTO_CIPHER_AES_CMAC)) {
-			selcnt[0]++;
 			WLAN_CRYPTO_ADDSELECTOR(frm,
 				 wlan_crypto_rsn_cipher_to_suite(
 						WLAN_CRYPTO_CIPHER_AES_CMAC));
 		}
 		if (HAS_MGMT_CIPHER(crypto_params,
 						WLAN_CRYPTO_CIPHER_AES_GMAC)) {
-			selcnt[0]++;
 			WLAN_CRYPTO_ADDSELECTOR(frm,
 				 wlan_crypto_rsn_cipher_to_suite(
 						WLAN_CRYPTO_CIPHER_AES_GMAC));
 		}
 		if (HAS_MGMT_CIPHER(crypto_params,
 					 WLAN_CRYPTO_CIPHER_AES_CMAC_256)) {
-			selcnt[0]++;
 			WLAN_CRYPTO_ADDSELECTOR(frm,
 				 wlan_crypto_rsn_cipher_to_suite(
 					WLAN_CRYPTO_CIPHER_AES_CMAC_256));
@@ -2419,7 +2417,6 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev,
 
 		if (HAS_MGMT_CIPHER(crypto_params,
 					WLAN_CRYPTO_CIPHER_AES_GMAC_256)) {
-			selcnt[0]++;
 			WLAN_CRYPTO_ADDSELECTOR(frm,
 				 wlan_crypto_rsn_cipher_to_suite(
 					WLAN_CRYPTO_CIPHER_AES_GMAC_256));

+ 2 - 8
umac/cmn_services/crypto/src/wlan_crypto_param_handling.c

@@ -187,14 +187,8 @@ QDF_STATUS wlan_crypto_set_mgmtcipher(
 				struct wlan_crypto_params *crypto_params,
 				uint32_t value)
 {
-
-	if (HAS_CIPHER_CAP(crypto_params, WLAN_CRYPTO_CAP_PMF) ||
-		HAS_CIPHER_CAP(crypto_params, WLAN_CRYPTO_CAP_PMF_OFFLOAD)) {
-		SET_MGMT_CIPHER(crypto_params, value);
-		return QDF_STATUS_SUCCESS;
-	}
-
-	return QDF_STATUS_E_INVAL;
+	SET_MGMT_CIPHER(crypto_params, value);
+	return QDF_STATUS_SUCCESS;
 }
 
 /**