From 3360227b8cbde817eeee8a02b32649efbfe8d06f Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Mon, 17 Dec 2018 11:21:32 +0530 Subject: [PATCH] qcacld-3.0: Fill mgmt_encryption_type in case of RSNE override In case of RSNE override, the mgmt_encryption_type is not set and thus AP is not considered as PMF capable by LIM. TO fix this update mgmt_encryption_type if AP is RSN capable and profile is RSN capable. Change-Id: I3350d33ca605c82726156f4f00a8a497dc07d3a8 CRs-Fixed: 2368692 --- core/sme/src/csr/csr_util.c | 74 +++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/core/sme/src/csr/csr_util.c b/core/sme/src/csr/csr_util.c index f082c3b38d2e..67010a700a42 100644 --- a/core/sme/src/csr/csr_util.c +++ b/core/sme/src/csr/csr_util.c @@ -4792,6 +4792,78 @@ uint8_t csr_retrieve_wpa_ie(struct mac_context *mac, uint8_t session_id, return cbWpaIe; } +#ifdef WLAN_FEATURE_11W +/** + * csr_get_mc_mgmt_cipher(): Get mcast management cipher from profile rsn + * @mac: mac ctx + * @profile: connect profile + * @bss: ap scan entry + * @ap_ie: AP IE's + * + * Return: none + */ +static void csr_get_mc_mgmt_cipher(struct mac_context *mac, + struct csr_roam_profile *profile, + tSirBssDescription *bss, + tDot11fBeaconIEs *ap_ie) +{ + int ret; + tDot11fIERSN rsn_ie = {0}; + uint8_t n_mgmt_cipher = 1; + struct rsn_caps rsn_caps; + tDot11fBeaconIEs *local_ap_ie = ap_ie; + uint8_t grp_mgmt_arr[CSR_RSN_MAX_MULTICAST_CYPHERS][CSR_RSN_OUI_SIZE]; + + if (!profile->MFPEnabled) + return; + + if (!local_ap_ie && + (!QDF_IS_STATUS_SUCCESS(csr_get_parsed_bss_description_ies + (mac, bss, &local_ap_ie)))) + return; + + qdf_mem_copy(&rsn_caps, local_ap_ie->RSN.RSN_Cap, sizeof(rsn_caps)); + + if (!ap_ie && local_ap_ie) + /* locally allocated */ + qdf_mem_free(local_ap_ie); + + /* if AP is not PMF capable return */ + if (!rsn_caps.MFPCapable) + return; + + ret = dot11f_unpack_ie_rsn(mac, profile->pRSNReqIE + 2, + profile->nRSNReqIELength -2, + &rsn_ie, false); + if (DOT11F_FAILED(ret)) + return; + + qdf_mem_copy(&rsn_caps, rsn_ie.RSN_Cap, sizeof(rsn_caps)); + + /* if self cap is not PMF capable return */ + if (!rsn_caps.MFPCapable) + return; + + qdf_mem_copy(grp_mgmt_arr, rsn_ie.gp_mgmt_cipher_suite, + CSR_RSN_OUI_SIZE); + if (csr_is_group_mgmt_gmac_128(mac, grp_mgmt_arr, n_mgmt_cipher, NULL)) + profile->mgmt_encryption_type = eSIR_ED_AES_GMAC_128; + else if (csr_is_group_mgmt_gmac_256(mac, grp_mgmt_arr, + n_mgmt_cipher, NULL)) + profile->mgmt_encryption_type = eSIR_ED_AES_GMAC_256; + else + /* Default is CMAC */ + profile->mgmt_encryption_type = eSIR_ED_AES_128_CMAC; +} +#else +static inline +void csr_get_mc_mgmt_cipher(struct mac_context *mac, + struct csr_roam_profile *profile, + tSirBssDescription *bss, + tDot11fBeaconIEs *ap_ie) +{ +} +#endif /* If a RSNIE exists in the profile, just use it. Or else construct * one from the BSS Caller allocated memory for pWpaIe and guarrantee * it can contain a max length WPA IE @@ -4815,6 +4887,8 @@ uint8_t csr_retrieve_rsn_ie(struct mac_context *mac, uint32_t sessionId, cbRsnIe = (uint8_t) pProfile->nRSNReqIELength; qdf_mem_copy(pRsnIe, pProfile->pRSNReqIE, cbRsnIe); + csr_get_mc_mgmt_cipher(mac, pProfile, + pSirBssDesc, pIes); } else { sme_warn("Invalid RSN IE length: %d", pProfile->nRSNReqIELength);