Explorar o código

qcacld-3.0: Fix SAE connection fail with crypto IE support

Set the RSN capabilities to crypto component which is used to
construct the RSN IE with right capabilities during connection.

Change-Id: Ia21e7f5592eef53d3eb90752e328de6fdbd80aea
CRs-Fixed: 2377823
Kiran Kumar Lokere %!s(int64=6) %!d(string=hai) anos
pai
achega
e0ec5631f5
Modificáronse 2 ficheiros con 36 adicións e 1 borrados
  1. 15 0
      core/hdd/src/wlan_hdd_assoc.c
  2. 21 1
      core/sme/src/csr/csr_util.c

+ 15 - 0
core/hdd/src/wlan_hdd_assoc.c

@@ -62,6 +62,7 @@
 #include "wlan_ipa_ucfg_api.h"
 #include "wlan_hdd_stats.h"
 #include "wlan_hdd_scan.h"
+#include "wlan_crypto_global_api.h"
 
 #include "wlan_hdd_nud_tracking.h"
 #include <wlan_cfg80211_crypto.h>
@@ -5211,6 +5212,9 @@ static int32_t hdd_process_genie(struct hdd_adapter *adapter,
 	uint8_t *pRsnIe;
 	uint16_t RSNIeLen;
 	uint32_t parse_status;
+#ifdef WLAN_CONV_CRYPTO_SUPPORTED
+	uint16_t rsn_cap = 0;
+#endif
 
 	/*
 	 * Clear struct of tDot11fIERSN and tDot11fIEWPA specifically
@@ -5262,6 +5266,11 @@ static int32_t hdd_process_genie(struct hdd_adapter *adapter,
 #ifdef WLAN_FEATURE_11W
 		*pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1;
 		*pMfpCapable = csr_is_mfpc_capable(&dot11RSNIE);
+#endif
+#ifdef WLAN_CONV_CRYPTO_SUPPORTED
+		qdf_mem_copy(&rsn_cap, dot11RSNIE.RSN_Cap, sizeof(rsn_cap));
+		wlan_crypto_set_vdev_param(adapter->vdev,
+					   WLAN_CRYPTO_PARAM_RSN_CAP, rsn_cap);
 #endif
 	} else if (gen_ie[0] == DOT11F_EID_WPA) {
 		/* Validity checks */
@@ -5425,6 +5434,12 @@ int hdd_set_genie_to_csr(struct hdd_adapter *adapter,
 		hdd_debug("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d",
 			 *RSNAuthType, RSNEncryptType, mcRSNEncryptType);
 	}
+#ifdef WLAN_CONV_CRYPTO_SUPPORTED
+	if (QDF_STATUS_SUCCESS != wlan_set_vdev_crypto_prarams_from_ie(
+				  adapter->vdev, security_ie,
+				  (security_ie[1] + 2)))
+		hdd_err("Failed to set the crypto params from IE");
+#endif
 
 	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	if (hdd_ctx->force_rsne_override &&

+ 21 - 1
core/sme/src/csr/csr_util.c

@@ -3755,12 +3755,25 @@ static inline void csr_update_pmksa_to_profile(struct csr_roam_profile *profile,
 uint8_t csr_construct_rsn_ie(struct mac_context *mac, uint32_t sessionId,
 			     struct csr_roam_profile *pProfile,
 			     tSirBssDescription *pSirBssDesc,
-			     tDot11fBeaconIEs *pIes, tCsrRSNIe *pRSNIe)
+			     tDot11fBeaconIEs *ap_ie, tCsrRSNIe *pRSNIe)
 {
 	struct wlan_objmgr_vdev *vdev;
 	uint8_t *rsn_ie_end = NULL;
 	uint8_t *rsn_ie = (uint8_t *)pRSNIe;
 	uint8_t ie_len = 0;
+	tDot11fBeaconIEs *local_ap_ie = ap_ie;
+	uint16_t rsn_cap = 0;
+
+	if (!local_ap_ie &&
+	    (!QDF_IS_STATUS_SUCCESS(csr_get_parsed_bss_description_ies
+	     (mac, pSirBssDesc, &local_ap_ie))))
+		return ie_len;
+
+	/* get AP RSN cap */
+	qdf_mem_copy(&rsn_cap, local_ap_ie->RSN.RSN_Cap, sizeof(rsn_cap));
+	if (!ap_ie && local_ap_ie)
+		/* locally allocated */
+		qdf_mem_free(local_ap_ie);
 
 	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(mac->psoc, sessionId,
 						    WLAN_LEGACY_SME_ID);
@@ -3768,6 +3781,13 @@ uint8_t csr_construct_rsn_ie(struct mac_context *mac, uint32_t sessionId,
 		sme_err("Invalid vdev");
 		return ie_len;
 	}
+	/*
+	 * Use intersection of the RSN cap sent by user space and
+	 * the AP, so that only common capability are enabled.
+	 */
+	rsn_cap &= (uint16_t)wlan_crypto_get_param(vdev,
+						   WLAN_CRYPTO_PARAM_RSN_CAP);
+	wlan_crypto_set_vdev_param(vdev, WLAN_CRYPTO_PARAM_RSN_CAP, rsn_cap);
 	rsn_ie_end = wlan_crypto_build_rsnie(vdev, rsn_ie);
 	if (rsn_ie_end)
 		ie_len = rsn_ie_end - rsn_ie;