Przeglądaj źródła

qcacld-3.0: Remove legacy WEP CFG definitions

Remove the legacy definitions that are related to the WEP
cfg.
Move them to mlme component

Change-Id: Ibcec8adf15123d12ad7c2eb6ed770b44a093673a
CRs-Fixed: 2324046
Pragaspathi Thilagaraj 6 lat temu
rodzic
commit
da3b5e21eb

+ 23 - 0
components/mlme/dispatcher/inc/wlan_mlme_api.h

@@ -62,6 +62,29 @@ QDF_STATUS wlan_mlme_set_cfg_str(uint8_t *src, struct mlme_cfg_str *dst_cfg_str,
 QDF_STATUS wlan_mlme_get_edca_params(struct wlan_mlme_edca_params *edca_params,
 				     uint8_t *data, enum e_edca_type edca_ac);
 
+/*
+ * mlme_get_wep_key() - get the wep key to process during auth frame
+ * @wep_params: cfg wep parameters structure
+ * @wep_key_id: default key number
+ * @default_key: default key to be copied
+ * @key_len: length of the key to copy
+ *
+ * Return QDF_STATUS
+ */
+QDF_STATUS mlme_get_wep_key(struct wlan_mlme_wep_cfg *wep_params,
+			    enum wep_key_id wep_keyid, uint8_t *default_key,
+			    qdf_size_t key_len);
+
+/**
+ * mlme_set_wep_key() - set the wep keys during auth
+ * @wep_params: cfg wep parametrs structure
+ * @wep_key_id: default key number that needs to be copied
+ * @key_to_set: destination buffer to be copied
+ * @len:        size to be copied
+ */
+QDF_STATUS mlme_set_wep_key(struct wlan_mlme_wep_cfg *wep_params,
+			    enum wep_key_id wep_keyid, uint8_t *key_to_set,
+			    qdf_size_t len);
 /**
  * wlan_mlme_get_ht_cap_info() - Get the HT cap info config
  * @psoc: pointer to psoc object

+ 14 - 0
components/mlme/dispatcher/inc/wlan_mlme_public_struct.h

@@ -842,6 +842,20 @@ struct wlan_mlme_oce {
 
 #define MLME_WEP_MAX_KEY_LEN (13)
 
+/**
+ * enum wep_key_id  - values passed to get/set wep default keys
+ * @MLME_WEP_DEFAULT_KEY_1: wep default key 1
+ * @MLME_WEP_DEFAULT_KEY_2: wep default key 2
+ * @MLME_WEP_DEFAULT_KEY_3: wep default key 3
+ * @MLME_WEP_DEFAULT_KEY_4: wep default key 4
+ */
+enum wep_key_id {
+	MLME_WEP_DEFAULT_KEY_1 = 0,
+	MLME_WEP_DEFAULT_KEY_2,
+	MLME_WEP_DEFAULT_KEY_3,
+	MLME_WEP_DEFAULT_KEY_4
+};
+
 /**
  * struct wlan_mlme_wep_cfg - WEP related configs
  * @is_privacy_enabled:     Flag to check if encryption is enabled

+ 77 - 0
components/mlme/dispatcher/src/wlan_mlme_api.c

@@ -855,3 +855,80 @@ QDF_STATUS wlan_mlme_get_edca_params(struct wlan_mlme_edca_params *edca_params,
 	}
 	return QDF_STATUS_SUCCESS;
 }
+
+QDF_STATUS mlme_get_wep_key(struct wlan_mlme_wep_cfg *wep_params,
+			    enum wep_key_id wep_keyid, uint8_t *default_key,
+			    qdf_size_t key_len)
+{
+	switch (wep_keyid) {
+	case MLME_WEP_DEFAULT_KEY_1:
+		wlan_mlme_get_cfg_str(default_key,
+				      &wep_params->wep_default_key_1,
+				      &key_len);
+		break;
+
+	case MLME_WEP_DEFAULT_KEY_2:
+		wlan_mlme_get_cfg_str(default_key,
+				      &wep_params->wep_default_key_2,
+				      &key_len);
+		break;
+
+	case MLME_WEP_DEFAULT_KEY_3:
+		wlan_mlme_get_cfg_str(default_key,
+				      &wep_params->wep_default_key_3,
+				      &key_len);
+		break;
+
+	case MLME_WEP_DEFAULT_KEY_4:
+		wlan_mlme_get_cfg_str(default_key,
+				      &wep_params->wep_default_key_4,
+				      &key_len);
+		break;
+
+	default:
+		mlme_err("Invalid key id:%d", wep_keyid);
+		return QDF_STATUS_E_INVAL;
+	}
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS mlme_set_wep_key(struct wlan_mlme_wep_cfg *wep_params,
+			    enum wep_key_id wep_keyid, uint8_t *key_to_set,
+			    qdf_size_t len)
+{
+	if (len == 0) {
+		mlme_debug("WEP set key length is zero");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	switch (wep_keyid) {
+	case MLME_WEP_DEFAULT_KEY_1:
+		wlan_mlme_set_cfg_str(key_to_set,
+				      &wep_params->wep_default_key_1,
+				      len);
+		break;
+
+	case MLME_WEP_DEFAULT_KEY_2:
+		wlan_mlme_set_cfg_str(key_to_set,
+				      &wep_params->wep_default_key_2,
+				      len);
+		break;
+
+	case MLME_WEP_DEFAULT_KEY_3:
+		wlan_mlme_set_cfg_str(key_to_set,
+				      &wep_params->wep_default_key_3,
+				      len);
+		break;
+
+	case MLME_WEP_DEFAULT_KEY_4:
+		wlan_mlme_set_cfg_str(key_to_set,
+				      &wep_params->wep_default_key_4,
+				      len);
+		break;
+
+	default:
+		mlme_err("Invalid key id:%d", wep_keyid);
+		return QDF_STATUS_E_INVAL;
+	}
+	return QDF_STATUS_SUCCESS;
+}

+ 0 - 13
core/mac/inc/wni_cfg.h

@@ -30,11 +30,6 @@ enum {
 	WNI_CFG_SSID,
 	WNI_CFG_BEACON_INTERVAL,
 	WNI_CFG_DTIM_PERIOD,
-	WNI_CFG_WEP_DEFAULT_KEY_1,
-	WNI_CFG_WEP_DEFAULT_KEY_2,
-	WNI_CFG_WEP_DEFAULT_KEY_3,
-	WNI_CFG_WEP_DEFAULT_KEY_4,
-	WNI_CFG_WEP_DEFAULT_KEYID,
 	WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
 	WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME,
 	WNI_CFG_JOIN_FAILURE_TIMEOUT,
@@ -51,10 +46,6 @@ enum {
 	WNI_CFG_LISTEN_INTERVAL,
 	WNI_CFG_VALID_CHANNEL_LIST,
 	WNI_CFG_APSD_ENABLED,
-	WNI_CFG_SHARED_KEY_AUTH_ENABLE,
-	WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE,
-	WNI_CFG_AUTHENTICATION_TYPE,
-	WNI_CFG_PRIVACY_ENABLED,
 	WNI_CFG_SHORT_PREAMBLE,
 	WNI_CFG_QOS_ENABLED,
 	WNI_CFG_HEART_BEAT_THRESHOLD,
@@ -273,10 +264,6 @@ enum {
 
 #define WNI_CFG_STA_ID_LEN    6
 #define WNI_CFG_SSID_LEN    32
-#define WNI_CFG_WEP_DEFAULT_KEY_1_LEN    13
-#define WNI_CFG_WEP_DEFAULT_KEY_2_LEN    13
-#define WNI_CFG_WEP_DEFAULT_KEY_3_LEN    13
-#define WNI_CFG_WEP_DEFAULT_KEY_4_LEN    13
 #define WNI_CFG_SUPPORTED_RATES_11B_LEN    4
 #define WNI_CFG_SUPPORTED_RATES_11A_LEN    8
 #define WNI_CFG_OPERATIONAL_RATE_SET_LEN    12

+ 1 - 5
core/mac/src/cfg/cfg_api.c

@@ -703,11 +703,7 @@ QDF_STATUS cfg_get_capability_info(tpAniSirGlobal pMac, uint16_t *pCap,
 		val = sessionEntry->privacy;
 	} else {
 		/* PRIVACY bit */
-		if (wlan_cfg_get_int(pMac, WNI_CFG_PRIVACY_ENABLED, &val) !=
-							QDF_STATUS_SUCCESS) {
-			pe_err("cfg get WNI_CFG_PRIVACY_ENABLED failed");
-			return QDF_STATUS_E_FAILURE;
-		}
+		val = pMac->mlme_cfg->wep_params.is_privacy_enabled;
 	}
 	if (val)
 		pCapInfo->privacy = 1;

+ 0 - 9
core/mac/src/cfg/cfg_param_name.c

@@ -45,11 +45,6 @@ const char *cfg_get_string(uint16_t cfg_id)
 	CASE_RETURN_STRING(WNI_CFG_SSID);
 	CASE_RETURN_STRING(WNI_CFG_BEACON_INTERVAL);
 	CASE_RETURN_STRING(WNI_CFG_DTIM_PERIOD);
-	CASE_RETURN_STRING(WNI_CFG_WEP_DEFAULT_KEY_1);
-	CASE_RETURN_STRING(WNI_CFG_WEP_DEFAULT_KEY_2);
-	CASE_RETURN_STRING(WNI_CFG_WEP_DEFAULT_KEY_3);
-	CASE_RETURN_STRING(WNI_CFG_WEP_DEFAULT_KEY_4);
-	CASE_RETURN_STRING(WNI_CFG_WEP_DEFAULT_KEYID);
 	CASE_RETURN_STRING(WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME);
 	CASE_RETURN_STRING(WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME);
 	CASE_RETURN_STRING(WNI_CFG_JOIN_FAILURE_TIMEOUT);
@@ -66,10 +61,6 @@ const char *cfg_get_string(uint16_t cfg_id)
 	CASE_RETURN_STRING(WNI_CFG_LISTEN_INTERVAL);
 	CASE_RETURN_STRING(WNI_CFG_VALID_CHANNEL_LIST);
 	CASE_RETURN_STRING(WNI_CFG_APSD_ENABLED);
-	CASE_RETURN_STRING(WNI_CFG_SHARED_KEY_AUTH_ENABLE);
-	CASE_RETURN_STRING(WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE);
-	CASE_RETURN_STRING(WNI_CFG_AUTHENTICATION_TYPE);
-	CASE_RETURN_STRING(WNI_CFG_PRIVACY_ENABLED);
 	CASE_RETURN_STRING(WNI_CFG_SHORT_PREAMBLE);
 	CASE_RETURN_STRING(WNI_CFG_QOS_ENABLED);
 	CASE_RETURN_STRING(WNI_CFG_HEART_BEAT_THRESHOLD);

+ 0 - 56
core/mac/src/cfg/cfg_proc_msg.c

@@ -53,24 +53,6 @@ cgstatic cfg_static[CFG_PARAM_MAX_NUM] = {
 	WNI_CFG_DTIM_PERIOD_STAMIN,
 	WNI_CFG_DTIM_PERIOD_STAMAX,
 	WNI_CFG_DTIM_PERIOD_STADEF},
-	{WNI_CFG_WEP_DEFAULT_KEY_1,
-	CFG_CTL_VALID | CFG_CTL_WE | CFG_CTL_RESTART,
-	0, 65535, 0},
-	{WNI_CFG_WEP_DEFAULT_KEY_2,
-	CFG_CTL_VALID | CFG_CTL_WE | CFG_CTL_RESTART,
-	1, 1, 1},
-	{WNI_CFG_WEP_DEFAULT_KEY_3,
-	CFG_CTL_VALID | CFG_CTL_WE | CFG_CTL_RESTART,
-	0, 5, 5},
-	{WNI_CFG_WEP_DEFAULT_KEY_4,
-	CFG_CTL_VALID | CFG_CTL_WE | CFG_CTL_RESTART,
-	0, 1, 0},
-	{WNI_CFG_WEP_DEFAULT_KEYID,
-	CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT |
-	CFG_CTL_NTF_LIM,
-	WNI_CFG_WEP_DEFAULT_KEYID_STAMIN,
-	WNI_CFG_WEP_DEFAULT_KEYID_STAMAX,
-	WNI_CFG_WEP_DEFAULT_KEYID_STADEF},
 	{WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
 	CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
 	WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME_STAMIN,
@@ -144,28 +126,6 @@ cgstatic cfg_static[CFG_PARAM_MAX_NUM] = {
 	WNI_CFG_APSD_ENABLED_STAMIN,
 	WNI_CFG_APSD_ENABLED_STAMAX,
 	WNI_CFG_APSD_ENABLED_STADEF},
-	{WNI_CFG_SHARED_KEY_AUTH_ENABLE,
-	CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
-	WNI_CFG_SHARED_KEY_AUTH_ENABLE_STAMIN,
-	WNI_CFG_SHARED_KEY_AUTH_ENABLE_STAMAX,
-	WNI_CFG_SHARED_KEY_AUTH_ENABLE_STADEF},
-	{WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE,
-	CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT,
-	WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_STAMIN,
-	WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_STAMAX,
-	WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE_STADEF},
-	{WNI_CFG_AUTHENTICATION_TYPE,
-	CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT |
-	CFG_CTL_RESTART,
-	WNI_CFG_AUTHENTICATION_TYPE_STAMIN,
-	WNI_CFG_AUTHENTICATION_TYPE_STAMAX,
-	WNI_CFG_AUTHENTICATION_TYPE_STADEF},
-	{WNI_CFG_PRIVACY_ENABLED,
-	CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT |
-	CFG_CTL_RESTART,
-	WNI_CFG_PRIVACY_ENABLED_STAMIN,
-	WNI_CFG_PRIVACY_ENABLED_STAMAX,
-	WNI_CFG_PRIVACY_ENABLED_STADEF},
 	{WNI_CFG_SHORT_PREAMBLE,
 	CFG_CTL_VALID | CFG_CTL_RE | CFG_CTL_WE | CFG_CTL_INT |
 	CFG_CTL_RESTART,
@@ -1205,22 +1165,6 @@ cfgstatic_string cfg_static_string[CFG_MAX_STATIC_STRING] = {
 	WNI_CFG_SSID_LEN,
 	10,
 	{1, 2, 3, 4, 5, 6, 7, 8, 9, 0} },
-	{WNI_CFG_WEP_DEFAULT_KEY_1,
-	WNI_CFG_WEP_DEFAULT_KEY_1_LEN,
-	0,
-	{0} },
-	{WNI_CFG_WEP_DEFAULT_KEY_2,
-	WNI_CFG_WEP_DEFAULT_KEY_2_LEN,
-	0,
-	{0} },
-	{WNI_CFG_WEP_DEFAULT_KEY_3,
-	WNI_CFG_WEP_DEFAULT_KEY_3_LEN,
-	0,
-	{0} },
-	{WNI_CFG_WEP_DEFAULT_KEY_4,
-	WNI_CFG_WEP_DEFAULT_KEY_4_LEN,
-	0,
-	{0} },
 	{WNI_CFG_SUPPORTED_RATES_11B,
 	WNI_CFG_SUPPORTED_RATES_11B_LEN,
 	4,

+ 41 - 40
core/mac/src/pe/lim/lim_process_auth_frame.c

@@ -43,6 +43,7 @@
 #include "cds_utils.h"
 #include "lim_send_messages.h"
 #include "lim_process_fils.h"
+#include "wlan_mlme_api.h"
 
 /**
  * is_auth_valid
@@ -107,9 +108,9 @@ static void lim_process_auth_shared_system_algo(tpAniSirGlobal mac_ctx,
 	pe_debug("=======> eSIR_SHARED_KEY");
 	if (LIM_IS_AP_ROLE(pe_session))
 		val = pe_session->privacy;
-	else if (wlan_cfg_get_int(mac_ctx,
-			WNI_CFG_PRIVACY_ENABLED, &val) != QDF_STATUS_SUCCESS)
-		pe_warn("couldnt retrieve Privacy option");
+	else
+		val = mac_ctx->mlme_cfg->wep_params.is_privacy_enabled;
+
 	cfg_privacy_opt_imp = (uint8_t) val;
 	if (!cfg_privacy_opt_imp) {
 		pe_err("rx Auth frame for unsupported auth algorithm %d "
@@ -567,6 +568,8 @@ static void lim_process_auth_frame_type2(tpAniSirGlobal mac_ctx,
 	uint8_t defaultkey[SIR_MAC_KEY_LENGTH];
 	struct tLimPreAuthNode *auth_node;
 	uint8_t *encr_auth_frame;
+	struct wlan_mlme_wep_cfg *wep_params = &mac_ctx->mlme_cfg->wep_params;
+	QDF_STATUS qdf_status;
 
 	/* AuthFrame 2 */
 	if (pe_session->limMlmState != eLIM_MLM_WT_AUTH_FRAME2_STATE) {
@@ -713,12 +716,10 @@ static void lim_process_auth_frame_type2(tpAniSirGlobal mac_ctx,
 	} else {
 		/* Shared key authentication */
 		if (LIM_IS_AP_ROLE(pe_session))
-			val = pe_session->privacy;
-		else if (wlan_cfg_get_int(mac_ctx,
-					WNI_CFG_PRIVACY_ENABLED,
-					&val) != QDF_STATUS_SUCCESS)
-			pe_warn("couldnt retrieve Privacy option");
-		cfg_privacy_opt_imp = (uint8_t) val;
+			cfg_privacy_opt_imp = pe_session->privacy;
+		else
+			cfg_privacy_opt_imp = wep_params->is_privacy_enabled;
+
 		if (!cfg_privacy_opt_imp) {
 			/*
 			 * Requesting STA does not have WEP implemented.
@@ -746,21 +747,21 @@ static void lim_process_auth_frame_type2(tpAniSirGlobal mac_ctx,
 			pe_err("rx auth frm with invalid challenge txtie");
 			return;
 		}
-		if (wlan_cfg_get_int(mac_ctx, WNI_CFG_WEP_DEFAULT_KEYID,
-					&val) != QDF_STATUS_SUCCESS)
-			pe_warn("could not retrieve Default key_id");
-		key_id = (uint8_t) val;
+
+		key_id = mac_ctx->mlme_cfg->wep_params.wep_default_key_id;
 		val = SIR_MAC_KEY_LENGTH;
 		if (LIM_IS_AP_ROLE(pe_session)) {
 			tpSirKeys key_ptr =
 				&pe_session->WEPKeyMaterial[key_id].key[0];
 			qdf_mem_copy(defaultkey, key_ptr->key,
 					key_ptr->keyLength);
-		} else if (wlan_cfg_get_str(mac_ctx,
-				(uint16_t)(WNI_CFG_WEP_DEFAULT_KEY_1 + key_id),
-				defaultkey, &val) != QDF_STATUS_SUCCESS) {
-			/* Couldnt get Default key from CFG. */
-			pe_warn("cant retrieve Defaultkey");
+		} else {
+			qdf_status = mlme_get_wep_key(wep_params,
+						      (MLME_WEP_DEFAULT_KEY_1 +
+						      key_id), defaultkey, val);
+			if (QDF_IS_STATUS_ERROR(qdf_status))
+				pe_warn("cant retrieve Defaultkey");
+
 			auth_frame->authAlgoNumber =
 				rx_auth_frm_body->authAlgoNumber;
 			auth_frame->authTransactionSeqNumber =
@@ -1123,6 +1124,8 @@ lim_process_auth_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info,
 	tSirMacAuthFrameBody *rx_auth_frm_body, *rx_auth_frame, *auth_frame;
 	tpSirMacMgmtHdr mac_hdr;
 	struct tLimPreAuthNode *auth_node;
+	struct wlan_mlme_wep_cfg *wep_params = &mac_ctx->mlme_cfg->wep_params;
+	QDF_STATUS qdf_status;
 
 	/* Get pointer to Authentication frame header and body */
 	mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
@@ -1254,18 +1257,15 @@ lim_process_auth_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info,
 			lim_print_mac_addr(mac_ctx, mac_hdr->sa, LOGE);
 			goto free;
 		}
-		if (LIM_IS_AP_ROLE(pe_session)) {
-			val = pe_session->privacy;
-		} else if (wlan_cfg_get_int(mac_ctx, WNI_CFG_PRIVACY_ENABLED,
-					&val) != QDF_STATUS_SUCCESS) {
-			/*
-			 * Accept Authentication frame only if Privacy is
-			 * implemented, if Could not get Privacy option
-			 * from CFG then Log fatal error
-			 */
-			pe_warn("could not retrieve Privacy option");
-		}
-		cfg_privacy_opt_imp = (uint8_t) val;
+
+		/*
+		 * Accept Authentication frame only if Privacy is
+		 * implemented
+		 */
+		if (LIM_IS_AP_ROLE(pe_session))
+			cfg_privacy_opt_imp = pe_session->privacy;
+		else
+			cfg_privacy_opt_imp = wep_params->is_privacy_enabled;
 
 		if (!cfg_privacy_opt_imp) {
 			pe_err("received Authentication frame3 from peer that while privacy option is turned OFF "
@@ -1355,10 +1355,12 @@ lim_process_auth_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info,
 			qdf_mem_copy(defaultkey, key_ptr->key,
 					key_ptr->keyLength);
 			val = key_ptr->keyLength;
-		} else if (wlan_cfg_get_str(mac_ctx,
-				(uint16_t) (WNI_CFG_WEP_DEFAULT_KEY_1 + key_id),
-				defaultkey, &val) != QDF_STATUS_SUCCESS) {
-			pe_warn("could not retrieve Default key");
+		} else {
+			qdf_status = mlme_get_wep_key(wep_params,
+						      (MLME_WEP_DEFAULT_KEY_1 +
+						      key_id), defaultkey, val);
+			if (QDF_IS_STATUS_ERROR(qdf_status))
+				pe_warn("could not retrieve Default key");
 
 			/*
 			 * Send Authentication frame
@@ -1404,17 +1406,16 @@ lim_process_auth_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info,
 			pe_err("failed to convert Auth Frame to structure or Auth is not valid");
 			goto free;
 		}
-	} else if ((auth_alg ==
-		    eSIR_AUTH_TYPE_SAE) && (LIM_IS_STA_ROLE(pe_session))) {
-		lim_process_sae_auth_frame(mac_ctx,
-					rx_pkt_info, pe_session);
+	} else if ((auth_alg == eSIR_AUTH_TYPE_SAE) &&
+		   (LIM_IS_STA_ROLE(pe_session))) {
+		lim_process_sae_auth_frame(mac_ctx, rx_pkt_info, pe_session);
 		goto free;
 	} else if ((sir_convert_auth_frame2_struct(mac_ctx, body_ptr,
 				frame_len, rx_auth_frame) != QDF_STATUS_SUCCESS)
 				|| (!is_auth_valid(mac_ctx, rx_auth_frame,
 						pe_session))) {
-			pe_err("failed to convert Auth Frame to structure or Auth is not valid");
-			goto free;
+		pe_err("failed to convert Auth Frame to structure or Auth is not valid");
+		goto free;
 	}
 
 	rx_auth_frm_body = rx_auth_frame;

+ 5 - 11
core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c

@@ -512,14 +512,10 @@ void lim_process_mlm_auth_cnf(tpAniSirGlobal mac_ctx, uint32_t *msg)
 	 * Failure case handle:
 	 * Process AUTH confirm from MLM
 	 */
-	if (session_entry->limSmeState == eLIM_SME_WT_AUTH_STATE) {
-		if (wlan_cfg_get_int(mac_ctx, WNI_CFG_AUTHENTICATION_TYPE,
-			(uint32_t *) &auth_type) !=  QDF_STATUS_SUCCESS) {
-			pe_err("Fail to retrieve AuthType value");
-		}
-	} else {
+	if (session_entry->limSmeState == eLIM_SME_WT_AUTH_STATE)
+		auth_type = mac_ctx->mlme_cfg->wep_params.auth_type;
+	else
 		auth_type = mac_ctx->lim.gLimPreAuthType;
-	}
 
 	if ((auth_type == eSIR_AUTO_SWITCH) &&
 		(auth_cnf->authType == eSIR_SHARED_KEY) &&
@@ -2338,10 +2334,8 @@ lim_process_sta_add_bss_rsp_pre_assoc(tpAniSirGlobal mac_ctx,
 		/* STA Index(genr by HAL) for the BSS entry is stored here */
 		pStaDs->staIndex = pAddBssParams->staContext.staIdx;
 		/* Trigger Authentication with AP */
-		if (wlan_cfg_get_int(mac_ctx, WNI_CFG_AUTHENTICATION_TYPE,
-			(uint32_t *) &cfgAuthType) != QDF_STATUS_SUCCESS) {
-			pe_warn("could not retrieve AuthType");
-		}
+		cfgAuthType = mac_ctx->mlme_cfg->wep_params.auth_type;
+
 		/* Try shared Authentication first */
 		if (cfgAuthType == eSIR_AUTO_SWITCH)
 			authMode = eSIR_SHARED_KEY;

+ 9 - 23
core/mac/src/pe/lim/lim_security_utils.c

@@ -74,7 +74,8 @@ uint8_t
 lim_is_auth_algo_supported(tpAniSirGlobal pMac, tAniAuthType authType,
 			   tpPESession psessionEntry)
 {
-	uint32_t algoEnable, privacyOptImp;
+	bool algoEnable, privacyOptImp;
+	struct wlan_mlme_wep_cfg *wep_params = &pMac->mlme_cfg->wep_params;
 
 	if (authType == eSIR_OPEN_SYSTEM) {
 
@@ -86,13 +87,9 @@ lim_is_auth_algo_supported(tpAniSirGlobal pMac, tAniAuthType authType,
 				return false;
 		}
 
-		if (wlan_cfg_get_int(pMac, WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE,
-				     &algoEnable) != QDF_STATUS_SUCCESS) {
-			pe_err("could not retrieve AuthAlgo1 Enable value");
+		algoEnable = wep_params->is_auth_open_system;
+		return algoEnable > 0 ? true : false;
 
-			return false;
-		} else
-			return algoEnable > 0 ? true : false;
 	} else {
 
 		if (LIM_IS_AP_ROLE(psessionEntry)) {
@@ -102,26 +99,15 @@ lim_is_auth_algo_supported(tpAniSirGlobal pMac, tAniAuthType authType,
 			else
 				algoEnable = false;
 
-		} else
-
-		if (wlan_cfg_get_int
-			    (pMac, WNI_CFG_SHARED_KEY_AUTH_ENABLE,
-			    &algoEnable) != QDF_STATUS_SUCCESS) {
-			pe_err("could not retrieve AuthAlgo2 Enable value");
-
-			return false;
+		} else {
+			algoEnable = wep_params->is_shared_key_auth;
 		}
 
-		if (LIM_IS_AP_ROLE(psessionEntry)) {
+		if (LIM_IS_AP_ROLE(psessionEntry))
 			privacyOptImp = psessionEntry->privacy;
-		} else
-
-		if (wlan_cfg_get_int(pMac, WNI_CFG_PRIVACY_ENABLED,
-				     &privacyOptImp) != QDF_STATUS_SUCCESS) {
-			pe_err("could not retrieve PrivacyOptImplemented value");
+		else
+			privacyOptImp = wep_params->is_privacy_enabled;
 
-			return false;
-		}
 		return algoEnable && privacyOptImp;
 	}
 } /****** end lim_is_auth_algo_supported() ******/

+ 12 - 17
core/mac/src/pe/lim/lim_sme_req_utils.c

@@ -43,7 +43,7 @@
 #include "lim_sme_req_utils.h"
 
 /**
- * lim_is_rs_nie_valid_in_sme_req_message()
+ * lim_is_rsn_ie_valid_in_sme_req_message()
  *
  * @mac_ctx   Pointer to Global MAC structure
  * @rsn_ie    Pointer to received RSN IE
@@ -54,17 +54,15 @@
  * Return: true when RSN IE is valid, false otherwise
  *
  */
-
 static uint8_t
-lim_is_rsn_ie_valid_in_sme_req_message(tpAniSirGlobal mac_ctx, tpSirRSNie rsn_ie)
+lim_is_rsn_ie_valid_in_sme_req_message(tpAniSirGlobal mac_ctx,
+				       tpSirRSNie rsn_ie)
 {
-	uint8_t start = 0;
-	uint32_t privacy, val;
+	uint8_t start = 0, privacy;
+	uint32_t val;
 	int len;
 
-	if (wlan_cfg_get_int(mac_ctx, WNI_CFG_PRIVACY_ENABLED,
-			     &privacy) != QDF_STATUS_SUCCESS)
-		pe_warn("Unable to retrieve POI from CFG");
+	privacy = mac_ctx->mlme_cfg->wep_params.is_privacy_enabled;
 
 	val = mac_ctx->mlme_cfg->feature_flags.enable_rsn;
 	if (rsn_ie->length && (!privacy || !val)) {
@@ -222,11 +220,10 @@ lim_set_rs_nie_wp_aiefrom_sme_start_bss_req_message(tpAniSirGlobal mac_ctx,
 {
 	uint32_t ret;
 	uint8_t wpa_idx = 0;
-	uint32_t privacy, val;
+	uint32_t val;
+	bool privacy;
 
-	if (wlan_cfg_get_int(mac_ctx, WNI_CFG_PRIVACY_ENABLED,
-			     &privacy) != QDF_STATUS_SUCCESS)
-		pe_warn("Unable to retrieve POI from CFG");
+	privacy = mac_ctx->mlme_cfg->wep_params.is_privacy_enabled;
 
 	val = mac_ctx->mlme_cfg->feature_flags.enable_rsn;
 	if (rsn_ie->length && (!privacy || !val)) {
@@ -711,13 +708,11 @@ lim_is_sme_set_context_req_valid(tpAniSirGlobal pMac,
 		valid = false;
 		goto end;
 	} else if (pSetContextReq->keyMaterial.edType > eSIR_ED_NONE) {
-		uint32_t poi;
+		bool privacy;
 
-		if (wlan_cfg_get_int(pMac, WNI_CFG_PRIVACY_ENABLED,
-				     &poi) != QDF_STATUS_SUCCESS)
-			pe_warn("Unable to retrieve POI from CFG");
+		privacy = pMac->mlme_cfg->wep_params.is_privacy_enabled;
 
-		if (!poi) {
+		if (!privacy) {
 			/**
 			 * Privacy is not enabled
 			 * In order to allow mixed mode for Guest access

+ 1 - 1
core/mac/src/sys/legacy/src/utils/src/parser_api.c

@@ -6026,7 +6026,7 @@ populate_dot11f_timing_advert_frame(tpAniSirGlobal mac_ctx,
 	QDF_STATUS nSirStatus;
 
 	/* Capabilities */
-	wlan_cfg_get_int(mac_ctx, WNI_CFG_PRIVACY_ENABLED, &val);
+	val = mac_ctx->mlme_cfg->wep_params.is_privacy_enabled;
 	if (val)
 		frame->Capabilities.privacy = 1;
 

+ 25 - 26
core/sme/src/csr/csr_api_roam.c

@@ -56,9 +56,9 @@
 #include <wlan_action_oui_ucfg_api.h>
 #include "wlan_mlme_api.h"
 #include <wlan_utility.h>
-#include "wlan_mlme_public_struct.h"
 #include "cfg_mlme.h"
 #include "cfg_ucfg_api.h"
+#include "wlan_mlme_api.h"
 
 #define MAX_PWR_FCC_CHAN_12 8
 #define MAX_PWR_FCC_CHAN_13 2
@@ -4819,20 +4819,22 @@ void csr_set_cfg_privacy(tpAniSirGlobal pMac, struct csr_roam_profile *pProfile,
 	 * CFG based on the advertised privacy setting from the AP for WPA
 	 * associations. See note below in this function...
 	 */
-	uint32_t PrivacyEnabled = 0, RsnEnabled = 0, WepDefaultKeyId = 0;
+	uint32_t privacy_enabled = 0, RsnEnabled = 0, wep_default_key_id = 0;
 	uint32_t WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5;
 	uint32_t Key0Length = 0, Key1Length = 0, Key2Length = 0, Key3Length = 0;
 
 	/* Reserve for the biggest key */
-	uint8_t Key0[WNI_CFG_WEP_DEFAULT_KEY_1_LEN];
-	uint8_t Key1[WNI_CFG_WEP_DEFAULT_KEY_2_LEN];
-	uint8_t Key2[WNI_CFG_WEP_DEFAULT_KEY_3_LEN];
-	uint8_t Key3[WNI_CFG_WEP_DEFAULT_KEY_4_LEN];
+	uint8_t Key0[MLME_WEP_MAX_KEY_LEN];
+	uint8_t Key1[MLME_WEP_MAX_KEY_LEN];
+	uint8_t Key2[MLME_WEP_MAX_KEY_LEN];
+	uint8_t Key3[MLME_WEP_MAX_KEY_LEN];
+
+	struct wlan_mlme_wep_cfg *wep_params = &pMac->mlme_cfg->wep_params;
 
 	switch (pProfile->negotiatedUCEncryptionType) {
 	case eCSR_ENCRYPT_TYPE_NONE:
 		/* for NO encryption, turn off Privacy and Rsn. */
-		PrivacyEnabled = 0;
+		privacy_enabled = 0;
 		RsnEnabled = 0;
 		/* clear out the WEP keys that may be hanging around. */
 		Key0Length = 0;
@@ -4845,10 +4847,10 @@ void csr_set_cfg_privacy(tpAniSirGlobal pMac, struct csr_roam_profile *pProfile,
 	case eCSR_ENCRYPT_TYPE_WEP40:
 
 		/* Privacy is ON.  NO RSN for Wep40 static key. */
-		PrivacyEnabled = 1;
+		privacy_enabled = 1;
 		RsnEnabled = 0;
 		/* Set the Wep default key ID. */
-		WepDefaultKeyId = pProfile->Keys.defaultIndex;
+		wep_default_key_id = pProfile->Keys.defaultIndex;
 		/* Wep key size if 5 bytes (40 bits). */
 		WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5;
 		/*
@@ -4896,10 +4898,10 @@ void csr_set_cfg_privacy(tpAniSirGlobal pMac, struct csr_roam_profile *pProfile,
 	case eCSR_ENCRYPT_TYPE_WEP104:
 
 		/* Privacy is ON.  NO RSN for Wep40 static key. */
-		PrivacyEnabled = 1;
+		privacy_enabled = 1;
 		RsnEnabled = 0;
 		/* Set the Wep default key ID. */
-		WepDefaultKeyId = pProfile->Keys.defaultIndex;
+		wep_default_key_id = pProfile->Keys.defaultIndex;
 		/* Wep key size if 13 bytes (104 bits). */
 		WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_13;
 		/*
@@ -4956,7 +4958,7 @@ void csr_set_cfg_privacy(tpAniSirGlobal pMac, struct csr_roam_profile *pProfile,
 		 * (setting of the privacy CFG based on the advertised
 		 *  privacy setting from AP for WPA/WAPI associations).
 		 */
-		PrivacyEnabled = (0 != fPrivacy);
+		privacy_enabled = (0 != fPrivacy);
 		/* turn on RSN enabled for WPA associations */
 		RsnEnabled = 1;
 		/* clear static WEP keys that may be hanging around. */
@@ -4966,18 +4968,18 @@ void csr_set_cfg_privacy(tpAniSirGlobal pMac, struct csr_roam_profile *pProfile,
 		Key3Length = 0;
 		break;
 	default:
-		PrivacyEnabled = 0;
+		privacy_enabled = 0;
 		RsnEnabled = 0;
 		break;
 	}
 
-	cfg_set_int(pMac, WNI_CFG_PRIVACY_ENABLED, PrivacyEnabled);
+	pMac->mlme_cfg->wep_params.is_privacy_enabled = privacy_enabled;
 	pMac->mlme_cfg->feature_flags.enable_rsn = RsnEnabled;
-	cfg_set_str(pMac, WNI_CFG_WEP_DEFAULT_KEY_1, Key0, Key0Length);
-	cfg_set_str(pMac, WNI_CFG_WEP_DEFAULT_KEY_2, Key1, Key1Length);
-	cfg_set_str(pMac, WNI_CFG_WEP_DEFAULT_KEY_3, Key2, Key2Length);
-	cfg_set_str(pMac, WNI_CFG_WEP_DEFAULT_KEY_4, Key3, Key3Length);
-	cfg_set_int(pMac, WNI_CFG_WEP_DEFAULT_KEYID, WepDefaultKeyId);
+	mlme_set_wep_key(wep_params, MLME_WEP_DEFAULT_KEY_1, Key0, Key0Length);
+	mlme_set_wep_key(wep_params, MLME_WEP_DEFAULT_KEY_2, Key1, Key1Length);
+	mlme_set_wep_key(wep_params, MLME_WEP_DEFAULT_KEY_3, Key2, Key2Length);
+	mlme_set_wep_key(wep_params, MLME_WEP_DEFAULT_KEY_4, Key3, Key3Length);
+	pMac->mlme_cfg->wep_params.wep_default_key_id = wep_default_key_id;
 }
 
 static void csr_set_cfg_ssid(tpAniSirGlobal pMac, tSirMacSSid *pSSID)
@@ -5365,7 +5367,8 @@ QDF_STATUS csr_roam_set_bss_config_cfg(tpAniSirGlobal pMac, uint32_t sessionId,
 	csr_set_cfg_ssid(pMac, &pBssConfig->SSID);
 
 	/* Auth type */
-	cfg_set_int(pMac, WNI_CFG_AUTHENTICATION_TYPE, pBssConfig->authType);
+	pMac->mlme_cfg->wep_params.auth_type = pBssConfig->authType;
+
 	/* encryption type */
 	csr_set_cfg_privacy(pMac, pProfile, (bool) pBssConfig->BssCap.privacy);
 	/* short slot time */
@@ -10886,6 +10889,7 @@ QDF_STATUS csr_roam_send_set_key_cmd(tpAniSirGlobal mac_ctx,
 						set_key_cmd->encType);
 	bool unicast = (set_key_cmd->peermac.bytes[0] == 0xFF) ? false : true;
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+	struct wlan_mlme_wep_cfg *wep_params = &mac_ctx->mlme_cfg->wep_params;
 	struct csr_roam_session *session = CSR_GET_SESSION(mac_ctx, session_id);
 
 	WLAN_HOST_DIAG_EVENT_DEF(setKeyEvent,
@@ -10923,13 +10927,8 @@ QDF_STATUS csr_roam_send_set_key_cmd(tpAniSirGlobal mac_ctx,
 			     session->connectedProfile.bssid.bytes,
 			     QDF_MAC_ADDR_SIZE);
 		if (CSR_IS_ENC_TYPE_STATIC(set_key_cmd->encType)) {
-			uint32_t defKeyId;
 			/* It has to be static WEP here */
-			if (QDF_IS_STATUS_SUCCESS(wlan_cfg_get_int(mac_ctx,
-					WNI_CFG_WEP_DEFAULT_KEYID,
-					&defKeyId))) {
-				setKeyEvent.keyId = (uint8_t) defKeyId;
-			}
+			setKeyEvent.keyId = wep_params->wep_default_key_id;
 		} else {
 			setKeyEvent.keyId = set_key_cmd->keyId;
 		}

+ 8 - 8
core/wma/src/wma_mgmt.c

@@ -75,6 +75,7 @@
 #include "wlan_p2p_cfg_api.h"
 #include "cfg_ucfg_api.h"
 #include "cfg_mlme_sta.h"
+#include "wlan_mlme_api.h"
 
 /**
  * wma_send_bcn_buf_ll() - prepare and send beacon buffer to fw for LL
@@ -1746,19 +1747,18 @@ static void wma_read_cfg_wepkey(tp_wma_handle wma_handle,
 	QDF_STATUS status;
 	uint32_t val = SIR_MAC_KEY_LENGTH;
 	uint8_t i, j;
+	tpAniSirGlobal mac_ctx = wma_handle->mac_context;
 
 	WMA_LOGD("Reading WEP keys from cfg");
+
 	/* NOTE:def_key_idx is initialized to 0 by the caller */
-	status = wlan_cfg_get_int(wma_handle->mac_context,
-				  WNI_CFG_WEP_DEFAULT_KEYID, def_key_idx);
-	if (status != QDF_STATUS_SUCCESS)
-		WMA_LOGE("Unable to read default id, defaulting to 0");
+	*def_key_idx = mac_ctx->mlme_cfg->wep_params.wep_default_key_id;
 
 	for (i = 0, j = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++) {
-		status = wlan_cfg_get_str(wma_handle->mac_context,
-					  (uint16_t) WNI_CFG_WEP_DEFAULT_KEY_1 +
-					  i, key_info[j].key, &val);
-		if (status != QDF_STATUS_SUCCESS) {
+		status = mlme_get_wep_key(&mac_ctx->mlme_cfg->wep_params,
+					  (MLME_WEP_DEFAULT_KEY_1 +
+					  i), key_info[j].key, val);
+		if (QDF_IS_STATUS_ERROR(status)) {
 			WMA_LOGE("WEP key is not configured at :%d", i);
 		} else {
 			key_info[j].keyId = i;

+ 2 - 6
core/wma/src/wma_scan_roam.c

@@ -2693,14 +2693,10 @@ QDF_STATUS wma_roam_scan_fill_self_caps(tp_wma_handle wma_handle,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	if (wlan_cfg_get_int(pMac, WNI_CFG_PRIVACY_ENABLED, &val) !=
-							 QDF_STATUS_SUCCESS) {
-		QDF_TRACE(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_ERROR,
-			  "Failed to get WNI_CFG_PRIVACY_ENABLED");
-		return QDF_STATUS_E_FAILURE;
-	}
 	selfCaps.ess = 1;
 	selfCaps.ibss = 0;
+
+	val = pMac->mlme_cfg->wep_params.is_privacy_enabled;
 	if (val)
 		selfCaps.privacy = 1;
 	if (wlan_cfg_get_int(pMac, WNI_CFG_SHORT_PREAMBLE, &val) !=