From 83a3de0deff42552a217c5a409097484bce8e825 Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Tue, 5 May 2020 15:13:43 +0530 Subject: [PATCH] qcacld-3.0: Remove unused PMF code PMF logic is moved to crypto so remove unused PMF code. Change-Id: I141a7683879da8f1961183db6dd26285c7bf4c4a CRs-Fixed: 2678890 --- core/hdd/src/wlan_hdd_assoc.c | 6 +- core/mac/inc/sir_api.h | 4 - core/sme/inc/csr_api.h | 3 - core/sme/src/csr/csr_api_roam.c | 52 ------------ core/sme/src/csr/csr_inside_api.h | 9 -- core/sme/src/csr/csr_util.c | 136 ------------------------------ 6 files changed, 4 insertions(+), 206 deletions(-) diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 60d869989de4..e159dbbbd0f2 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -5375,8 +5375,10 @@ static int32_t hdd_process_genie(struct hdd_adapter *adapter, hdd_translate_rsn_to_csr_encryption_type( dot11_rsn_ie.gp_cipher_suite); #ifdef WLAN_FEATURE_11W - *mfp_required = (dot11_rsn_ie.RSN_Cap[0] >> 6) & 0x1; - *mfp_capable = csr_is_mfpc_capable(&dot11_rsn_ie); + *mfp_required = dot11_rsn_ie.RSN_Cap[0] & + WLAN_CRYPTO_RSN_CAP_MFP_REQUIRED; + *mfp_capable = dot11_rsn_ie.RSN_Cap[0] & + WLAN_CRYPTO_RSN_CAP_MFP_ENABLED; #endif qdf_mem_copy(&rsn_cap, dot11_rsn_ie.RSN_Cap, sizeof(rsn_cap)); wlan_crypto_set_vdev_param(adapter->vdev, diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index f7a515211cdd..147b74833c92 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -944,10 +944,6 @@ struct join_req { tAniEdType MCEncryptionType; enum ani_akm_type akm; -#ifdef WLAN_FEATURE_11W - tAniEdType MgmtEncryptionType; -#endif - bool is11Rconnection; bool is_adaptive_11r_connection; #ifdef FEATURE_WLAN_ESE diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h index 755633b85c35..3f3d90215419 100644 --- a/core/sme/inc/csr_api.h +++ b/core/sme/inc/csr_api.h @@ -709,7 +709,6 @@ struct csr_roam_profile { uint8_t MFPRequired; uint8_t MFPCapable; #endif - tAniEdType mgmt_encryption_type; tCsrKeys Keys; tCsrChannelInfo ChannelInfo; uint32_t op_freq; @@ -806,8 +805,6 @@ typedef struct tagCsrRoamConnectedProfile { tCsrEncryptionList EncryptionInfo; eCsrEncryptionType mcEncryptionType; tCsrEncryptionList mcEncryptionInfo; - /* group management cipher suite used for 11w */ - tAniEdType mgmt_encryption_type; uint8_t country_code[WNI_CFG_COUNTRY_CODE_LEN]; uint32_t vht_channel_width; tCsrKeys Keys; diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 707bfa75d336..0d166e5860c7 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -9389,8 +9389,6 @@ csr_roam_save_connected_information(struct mac_context *mac, pConnectProfile->mcEncryptionType = pProfile->negotiatedMCEncryptionType; pConnectProfile->mcEncryptionInfo = pProfile->mcEncryptionType; - pConnectProfile->mgmt_encryption_type = - pProfile->mgmt_encryption_type; pConnectProfile->BSSType = pProfile->BSSType; pConnectProfile->modifyProfileFields.uapsd_mask = pProfile->uapsd_mask; @@ -15269,55 +15267,6 @@ static QDF_STATUS csr_set_ldpc_exception(struct mac_context *mac_ctx, return QDF_STATUS_SUCCESS; } -#ifdef WLAN_FEATURE_11W -/** - * csr_is_mfpc_capable() - is MFPC capable - * @ies: AP information element - * - * Return: true if MFPC capable, false otherwise - */ -bool csr_is_mfpc_capable(struct sDot11fIERSN *rsn) -{ - bool mfpc_capable = false; - - if (rsn && rsn->present && - ((rsn->RSN_Cap[0] >> 7) & 0x01)) - mfpc_capable = true; - - return mfpc_capable; -} - -/** - * csr_set_mgmt_enc_type() - set mgmt enc type for PMF - * @profile: roam profile - * @ies: AP ie - * @csr_join_req: csr join req - * - * Return: void - */ -static void csr_set_mgmt_enc_type(struct csr_roam_profile *profile, - tDot11fBeaconIEs *ies, - struct join_req *csr_join_req) -{ - if (profile->MFPEnabled) - csr_join_req->MgmtEncryptionType = - profile->mgmt_encryption_type; - else - csr_join_req->MgmtEncryptionType = eSIR_ED_NONE; - - if (profile->MFPEnabled && - !(profile->MFPRequired) && - !csr_is_mfpc_capable(&ies->RSN)) - csr_join_req->MgmtEncryptionType = eSIR_ED_NONE; -} -#else -static inline void csr_set_mgmt_enc_type(struct csr_roam_profile *profile, - tDot11fBeaconIEs *pIes, - struct join_req *csr_join_req) -{ -} -#endif - #ifdef WLAN_FEATURE_FILS_SK /* * csr_update_fils_connection_info: Copy fils connection info to join request @@ -16224,7 +16173,6 @@ QDF_STATUS csr_send_join_req_msg(struct mac_context *mac, uint32_t sessionId, csr_join_req->MCEncryptionType = csr_translate_encrypt_type_to_ed_type (pProfile->negotiatedMCEncryptionType); - csr_set_mgmt_enc_type(pProfile, pIes, csr_join_req); #ifdef FEATURE_WLAN_ESE ese_config = mac->mlme_cfg->lfr.ese_enabled; #endif diff --git a/core/sme/src/csr/csr_inside_api.h b/core/sme/src/csr/csr_inside_api.h index d141aae8ef03..42921e7ff7b2 100644 --- a/core/sme/src/csr/csr_inside_api.h +++ b/core/sme/src/csr/csr_inside_api.h @@ -1020,15 +1020,6 @@ csr_roam_set_bss_config_cfg(struct mac_context *mac_ctx, uint32_t session_id, void csr_prune_channel_list_for_mode(struct mac_context *mac, struct csr_channel *pChannelList); -#ifdef WLAN_FEATURE_11W -bool csr_is_mfpc_capable(struct sDot11fIERSN *rsn); -#else -static inline bool csr_is_mfpc_capable(struct sDot11fIERSN *rsn) -{ - return false; -} -#endif - /** * csr_get_rf_band() * diff --git a/core/sme/src/csr/csr_util.c b/core/sme/src/csr/csr_util.c index 635402d9f24c..8c379d293a24 100644 --- a/core/sme/src/csr/csr_util.c +++ b/core/sme/src/csr/csr_util.c @@ -2627,68 +2627,6 @@ bool csr_is_profile_wapi(struct csr_roam_profile *pProfile) } #endif /* FEATURE_WLAN_WAPI */ -#ifdef WLAN_FEATURE_11W -static bool csr_is_wpa_oui_equal(struct mac_context *mac, uint8_t *Oui1, - uint8_t *Oui2) -{ - return !qdf_mem_cmp(Oui1, Oui2, CSR_WPA_OUI_SIZE); -} - -static bool csr_is_oui_match(struct mac_context *mac, - uint8_t AllCyphers[][CSR_WPA_OUI_SIZE], - uint8_t cAllCyphers, uint8_t Cypher[], uint8_t Oui[]) -{ - bool fYes = false; - uint8_t idx; - - for (idx = 0; idx < cAllCyphers; idx++) { - if (csr_is_wpa_oui_equal(mac, AllCyphers[idx], Cypher)) { - fYes = true; - break; - } - } - - if (fYes && Oui) - qdf_mem_copy(Oui, AllCyphers[idx], CSR_WPA_OUI_SIZE); - - return fYes; -} - -/* - * csr_is_group_mgmt_gmac_128() - check whether oui is GMAC_128 - * @mac: Global MAC context - * @all_suites: pointer to all supported akm suites - * @suite_count: all supported akm suites count - * @oui: Oui needs to be matched - * - * Return: True if OUI is GMAC_128, false otherwise - */ -static bool csr_is_group_mgmt_gmac_128(struct mac_context *mac, - uint8_t AllSuites[][CSR_RSN_OUI_SIZE], - uint8_t cAllSuites, uint8_t Oui[]) -{ - return csr_is_oui_match(mac, AllSuites, cAllSuites, - csr_group_mgmt_oui[ENUM_GMAC_128], Oui); -} - -/* - * csr_is_group_mgmt_gmac_256() - check whether oui is GMAC_256 - * @mac: Global MAC context - * @all_suites: pointer to all supported akm suites - * @suite_count: all supported akm suites count - * @oui: Oui needs to be matched - * - * Return: True if OUI is GMAC_256, false otherwise - */ -static bool csr_is_group_mgmt_gmac_256(struct mac_context *mac, - uint8_t AllSuites[][CSR_RSN_OUI_SIZE], - uint8_t cAllSuites, uint8_t Oui[]) -{ - return csr_is_oui_match(mac, AllSuites, cAllSuites, - csr_group_mgmt_oui[ENUM_GMAC_256], Oui); -} -#endif - bool csr_is_pmkid_found_for_peer(struct mac_context *mac, struct csr_roam_session *session, tSirMacAddr peer_mac_addr, @@ -2976,78 +2914,6 @@ 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, - struct bss_description *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, - struct bss_description *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 @@ -3071,8 +2937,6 @@ 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);