Просмотр исходного кода

qcacmn: Correct the pairwaise cipher order in rsnie

Correct the pairwise cipher order in rsnie to match
hostapd ie generation order. as there difference in the order
cipher is added in rsnie between beacon/probe response generated
in driver and rsnie generated in hostapd, clients drop
this particular association.

Change-Id: I6bc5094a3ff03b013ab1672e8c028a1312eebd3b
CRs-Fixed: 2302389
Ashok Kumar Ponnaiah 6 лет назад
Родитель
Сommit
d652f8ffde
1 измененных файлов с 47 добавлено и 72 удалено
  1. 47 72
      umac/cmn_services/crypto/src/wlan_crypto_global_api.c

+ 47 - 72
umac/cmn_services/crypto/src/wlan_crypto_global_api.c

@@ -39,6 +39,14 @@
 
 const struct wlan_crypto_cipher *wlan_crypto_cipher_ops[WLAN_CRYPTO_CIPHER_MAX];
 
+#define WPA_ADD_CIPHER_TO_SUITE(frm, cipher) \
+	WLAN_CRYPTO_ADDSELECTOR(frm,\
+				wlan_crypto_wpa_cipher_to_suite(cipher))
+
+#define RSN_ADD_CIPHER_TO_SUITE(frm, cipher) \
+	WLAN_CRYPTO_ADDSELECTOR(frm,\
+				wlan_crypto_rsn_cipher_to_suite(cipher))
+
 /**
  * wlan_crypto_vdev_get_crypto_params - called by mlme to get crypto params
  * @vdev:vdev
@@ -2328,30 +2336,22 @@ uint8_t *wlan_crypto_build_wpaie(struct wlan_objmgr_vdev *vdev,
 
 
 	/* multicast cipher */
-	if (MCIPHER_IS_TKIP(crypto_params)) {
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-					wlan_crypto_wpa_cipher_to_suite(
-						WLAN_CRYPTO_CIPHER_TKIP));
-	} else if (MCIPHER_IS_CCMP128(crypto_params)) {
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-					wlan_crypto_wpa_cipher_to_suite(
-						WLAN_CRYPTO_CIPHER_AES_CCM));
-	}
+	if (MCIPHER_IS_TKIP(crypto_params))
+		WPA_ADD_CIPHER_TO_SUITE(frm, WLAN_CRYPTO_CIPHER_TKIP);
+	else if (MCIPHER_IS_CCMP128(crypto_params))
+		WPA_ADD_CIPHER_TO_SUITE(frm, WLAN_CRYPTO_CIPHER_AES_CCM);
+
 	/* unicast cipher list */
 	selcnt = frm;
 	WLAN_CRYPTO_ADDSHORT(frm, 0);
 	/* do not use CCMP unicast cipher in WPA mode */
-	if (UCIPHER_IS_TKIP(crypto_params)) {
+	if (UCIPHER_IS_CCMP128(crypto_params)) {
 		selcnt[0]++;
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-			 wlan_crypto_wpa_cipher_to_suite(
-						WLAN_CRYPTO_CIPHER_TKIP));
+		WPA_ADD_CIPHER_TO_SUITE(frm, WLAN_CRYPTO_CIPHER_AES_CCM);
 	}
-	if (UCIPHER_IS_CCMP128(crypto_params)) {
+	if (UCIPHER_IS_TKIP(crypto_params)) {
 		selcnt[0]++;
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-			wlan_crypto_wpa_cipher_to_suite(
-						WLAN_CRYPTO_CIPHER_AES_CCM));
+		WPA_ADD_CIPHER_TO_SUITE(frm, WLAN_CRYPTO_CIPHER_TKIP);
 	}
 
 	/* authenticator selector list */
@@ -2417,65 +2417,42 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev,
 
 
 	/* multicast cipher */
-	if (MCIPHER_IS_TKIP(crypto_params)) {
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-					wlan_crypto_rsn_cipher_to_suite(
-					WLAN_CRYPTO_CIPHER_TKIP));
-	} else if (MCIPHER_IS_CCMP128(crypto_params)) {
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-					wlan_crypto_rsn_cipher_to_suite(
-					WLAN_CRYPTO_CIPHER_AES_CCM));
-	} else if (MCIPHER_IS_CCMP256(crypto_params)) {
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-					wlan_crypto_rsn_cipher_to_suite(
-					WLAN_CRYPTO_CIPHER_AES_CCM_256));
-	} else if (MCIPHER_IS_GCMP128(crypto_params)) {
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-					wlan_crypto_rsn_cipher_to_suite(
-					WLAN_CRYPTO_CIPHER_AES_GCM));
-	} else if (MCIPHER_IS_GCMP256(crypto_params)) {
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-					wlan_crypto_rsn_cipher_to_suite(
-					WLAN_CRYPTO_CIPHER_AES_GCM_256));
-	}
+	if (MCIPHER_IS_TKIP(crypto_params))
+		RSN_ADD_CIPHER_TO_SUITE(frm, WLAN_CRYPTO_CIPHER_TKIP);
+	else if (MCIPHER_IS_CCMP128(crypto_params))
+		RSN_ADD_CIPHER_TO_SUITE(frm, WLAN_CRYPTO_CIPHER_AES_CCM);
+	else if (MCIPHER_IS_CCMP256(crypto_params))
+		RSN_ADD_CIPHER_TO_SUITE(frm, WLAN_CRYPTO_CIPHER_AES_CCM_256);
+	else if (MCIPHER_IS_GCMP128(crypto_params))
+		RSN_ADD_CIPHER_TO_SUITE(frm, WLAN_CRYPTO_CIPHER_AES_GCM);
+	else if (MCIPHER_IS_GCMP256(crypto_params))
+		RSN_ADD_CIPHER_TO_SUITE(frm, WLAN_CRYPTO_CIPHER_AES_GCM_256);
 
 	/* unicast cipher list */
 	selcnt = frm;
 	WLAN_CRYPTO_ADDSHORT(frm, 0);
-	/* do not use CCMP unicast cipher in WPA mode */
-	if (UCIPHER_IS_TKIP(crypto_params)) {
+
+	if (UCIPHER_IS_CCMP256(crypto_params)) {
 		selcnt[0]++;
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-					wlan_crypto_rsn_cipher_to_suite(
-						WLAN_CRYPTO_CIPHER_TKIP));
+		RSN_ADD_CIPHER_TO_SUITE(frm, WLAN_CRYPTO_CIPHER_AES_CCM_256);
 	}
-	if (UCIPHER_IS_CCMP128(crypto_params)) {
+	if (UCIPHER_IS_GCMP256(crypto_params)) {
 		selcnt[0]++;
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-					wlan_crypto_rsn_cipher_to_suite(
-						WLAN_CRYPTO_CIPHER_AES_CCM));
+		RSN_ADD_CIPHER_TO_SUITE(frm, WLAN_CRYPTO_CIPHER_AES_GCM_256);
 	}
-	if (UCIPHER_IS_CCMP256(crypto_params)) {
+	if (UCIPHER_IS_CCMP128(crypto_params)) {
 		selcnt[0]++;
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-			wlan_crypto_rsn_cipher_to_suite(
-					WLAN_CRYPTO_CIPHER_AES_CCM_256));
+		RSN_ADD_CIPHER_TO_SUITE(frm, WLAN_CRYPTO_CIPHER_AES_CCM);
 	}
-
 	if (UCIPHER_IS_GCMP128(crypto_params)) {
 		selcnt[0]++;
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-			 wlan_crypto_rsn_cipher_to_suite(
-					WLAN_CRYPTO_CIPHER_AES_GCM));
+		RSN_ADD_CIPHER_TO_SUITE(frm, WLAN_CRYPTO_CIPHER_AES_GCM);
 	}
-	if (UCIPHER_IS_GCMP256(crypto_params)) {
+	if (UCIPHER_IS_TKIP(crypto_params)) {
 		selcnt[0]++;
-		WLAN_CRYPTO_ADDSELECTOR(frm,
-			wlan_crypto_rsn_cipher_to_suite(
-					WLAN_CRYPTO_CIPHER_AES_GCM_256));
+		RSN_ADD_CIPHER_TO_SUITE(frm, WLAN_CRYPTO_CIPHER_TKIP);
 	}
 
-
 	/* authenticator selector list */
 	selcnt = frm;
 	WLAN_CRYPTO_ADDSHORT(frm, 0);
@@ -2540,28 +2517,26 @@ uint8_t *wlan_crypto_build_rsnie(struct wlan_objmgr_vdev *vdev,
 		WLAN_CRYPTO_ADDSHORT(frm, 0);
 		if (HAS_MGMT_CIPHER(crypto_params,
 						WLAN_CRYPTO_CIPHER_AES_CMAC)) {
-			WLAN_CRYPTO_ADDSELECTOR(frm,
-				 wlan_crypto_rsn_cipher_to_suite(
-						WLAN_CRYPTO_CIPHER_AES_CMAC));
+			RSN_ADD_CIPHER_TO_SUITE(frm,
+						WLAN_CRYPTO_CIPHER_AES_CMAC);
 		}
 		if (HAS_MGMT_CIPHER(crypto_params,
 						WLAN_CRYPTO_CIPHER_AES_GMAC)) {
-			WLAN_CRYPTO_ADDSELECTOR(frm,
-				 wlan_crypto_rsn_cipher_to_suite(
-						WLAN_CRYPTO_CIPHER_AES_GMAC));
+			RSN_ADD_CIPHER_TO_SUITE(frm,
+						WLAN_CRYPTO_CIPHER_AES_GMAC);
 		}
 		if (HAS_MGMT_CIPHER(crypto_params,
 					 WLAN_CRYPTO_CIPHER_AES_CMAC_256)) {
-			WLAN_CRYPTO_ADDSELECTOR(frm,
-				 wlan_crypto_rsn_cipher_to_suite(
-					WLAN_CRYPTO_CIPHER_AES_CMAC_256));
+			RSN_ADD_CIPHER_TO_SUITE(frm,
+						WLAN_CRYPTO_CIPHER_AES_CMAC_256
+						);
 		}
 
 		if (HAS_MGMT_CIPHER(crypto_params,
 					WLAN_CRYPTO_CIPHER_AES_GMAC_256)) {
-			WLAN_CRYPTO_ADDSELECTOR(frm,
-				 wlan_crypto_rsn_cipher_to_suite(
-					WLAN_CRYPTO_CIPHER_AES_GMAC_256));
+			RSN_ADD_CIPHER_TO_SUITE(frm,
+						WLAN_CRYPTO_CIPHER_AES_GMAC_256
+						);
 		}
 	}