Jelajahi Sumber

qcacld-3.0: Cleanup CRYPTO_SET_KEY_CONVERGED for SME layer

CRYPTO_SET_KEY_CONVERGED is a temporary flag which is used for
converged crypto component transition. The transition has already
been done, so cleanup legacy code related to the flag in SME layer.

Change-Id: Iff9ba19887caaa39f43cb58d519a14cf6e759d59
CRs-fixed: 2593523
Yue Ma 5 tahun lalu
induk
melakukan
b49b7fedc5

+ 0 - 2
core/sme/inc/sme_api.h

@@ -664,8 +664,6 @@ void sme_deregister_oem_data_rsp_callback(mac_handle_t mac_handle)
 
 #endif
 
-QDF_STATUS sme_roam_set_key(mac_handle_t mac_handle, uint8_t sessionId,
-			    tCsrRoamSetKey *pSetKey, uint32_t *pRoamId);
 QDF_STATUS sme_get_country_code(mac_handle_t mac_handle, uint8_t *pBuf,
 				uint8_t *pbLen);
 

+ 1 - 3
core/sme/inc/sme_inside.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -147,8 +147,6 @@ void csr_roam_process_wm_status_change_command(struct mac_context *mac,
 void csr_reinit_roam_cmd(struct mac_context *mac, tSmeCmd *pCommand);
 void csr_reinit_wm_status_change_cmd(struct mac_context *mac,
 				     tSmeCmd *pCommand);
-QDF_STATUS csr_roam_send_set_key_cmd(struct mac_context *mac_ctx,
-		uint32_t session_id, struct setkey_cmd *set_key_cmd);
 QDF_STATUS csr_is_valid_channel(struct mac_context *mac, uint32_t freq);
 
 QDF_STATUS sme_acquire_global_lock(struct sme_context *sme);

+ 0 - 69
core/sme/src/common/sme_api.c

@@ -3341,75 +3341,6 @@ QDF_STATUS sme_oem_get_capability(mac_handle_t mac_handle,
 }
 #endif
 
-/**
- * sme_roam_set_key() - To set encryption key.
- * @mac_handle:           mac_handle global context
- * @session_id:    session id
- * @set_key:       pointer to a caller allocated object of tCsrSetContextInfo
- * @ptr_roam_id:       Upon success return, this is the id caller can use to
- *                 identify the request in roamcallback
- *
- * This function should be called only when connected. This is an asynchronous
- * API.
- *
- * Return: Status of operation
- */
-QDF_STATUS sme_roam_set_key(mac_handle_t mac_handle,  uint8_t session_id,
-			    tCsrRoamSetKey *set_key, uint32_t *ptr_roam_id)
-{
-	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
-	uint32_t roam_id;
-	struct csr_roam_session *session = NULL;
-	struct ps_global_info *ps_global_info = &mac_ctx->sme.ps_global_info;
-
-	MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_RX_HDD_SET_KEY,
-			 session_id, 0));
-	if (set_key->keyLength > CSR_MAX_KEY_LEN) {
-		sme_err("Invalid key length: %d", set_key->keyLength);
-		return QDF_STATUS_E_FAILURE;
-	}
-	/*Once Setkey is done, we can go in BMPS */
-	if (set_key->keyLength)
-		ps_global_info->remain_in_power_active_till_dhcp = false;
-
-	status = sme_acquire_global_lock(&mac_ctx->sme);
-	if (!QDF_IS_STATUS_SUCCESS(status))
-		return status;
-
-	roam_id = GET_NEXT_ROAM_ID(&mac_ctx->roam);
-	if (ptr_roam_id)
-		*ptr_roam_id = roam_id;
-
-	sme_debug("keyLength: %d", set_key->keyLength);
-
-	sme_debug("Session_id: %d roam_id: %d", session_id, roam_id);
-	session = CSR_GET_SESSION(mac_ctx, session_id);
-	if (!session) {
-		sme_err("session %d not found", session_id);
-		sme_release_global_lock(&mac_ctx->sme);
-		return QDF_STATUS_E_FAILURE;
-	}
-	if (CSR_IS_INFRA_AP(&session->connectedProfile)
-	    && set_key->keyDirection == eSIR_TX_DEFAULT) {
-		if ((eCSR_ENCRYPT_TYPE_WEP40 == set_key->encType)
-		    || (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY ==
-			set_key->encType)) {
-			session->pCurRoamProfile->negotiatedUCEncryptionType =
-				eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
-		}
-		if ((eCSR_ENCRYPT_TYPE_WEP104 == set_key->encType)
-		    || (eCSR_ENCRYPT_TYPE_WEP104_STATICKEY ==
-			set_key->encType)) {
-			session->pCurRoamProfile->negotiatedUCEncryptionType =
-				eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
-		}
-	}
-	status = csr_roam_set_key(mac_ctx, session_id, set_key, roam_id);
-	sme_release_global_lock(&mac_ctx->sme);
-	return status;
-}
-
 /**
  * sme_roam_set_default_key_index - To set default wep key idx
  * @mac_handle: Opaque handle to the global MAC context

+ 1 - 120
core/sme/src/common/sme_ft_api.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -221,68 +221,6 @@ void sme_set_ft_ies(mac_handle_t mac_handle, uint32_t session_id,
 	sme_release_global_lock(&mac_ctx->sme);
 }
 
-/**
- * sme_ft_send_update_key_ind() - To send key update indication for FT session
- * @mac: pointer to MAC context
- * @vdev_id: vdev_id
- * @ftkey_info: FT key information
- *
- * To send key update indication for FT session
- *
- * Return: QDF_STATUS
- */
-static
-QDF_STATUS sme_ft_send_update_key_ind(struct mac_context *mac, uint32_t vdev_id,
-				      tCsrRoamSetKey *ftkey_info)
-{
-	tSirFTUpdateKeyInfo *msg;
-	uint16_t msglen;
-	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	tSirKeyMaterial *keymaterial = NULL;
-	tAniEdType ed_type;
-
-	sme_debug("keyLength: %d", ftkey_info->keyLength);
-
-	if (ftkey_info->keyLength > CSR_MAX_KEY_LEN) {
-		sme_err("invalid keyLength: %d", ftkey_info->keyLength);
-		return QDF_STATUS_E_FAILURE;
-	}
-	msglen  = sizeof(tSirFTUpdateKeyInfo);
-
-	msg = qdf_mem_malloc(msglen);
-	if (!msg)
-		return QDF_STATUS_E_NOMEM;
-
-	msg->messageType = eWNI_SME_FT_UPDATE_KEY;
-	msg->length = msglen;
-
-	keymaterial = &msg->keyMaterial;
-	keymaterial->length = ftkey_info->keyLength;
-	ed_type = csr_translate_encrypt_type_to_ed_type(ftkey_info->encType);
-	keymaterial->edType = ed_type;
-	keymaterial->numKeys = 1;
-	keymaterial->key[0].keyId = ftkey_info->keyId;
-	keymaterial->key[0].unicast = (uint8_t) true;
-	keymaterial->key[0].keyDirection = ftkey_info->keyDirection;
-
-	qdf_mem_copy(&keymaterial->key[0].keyRsc,
-			ftkey_info->keyRsc, WLAN_CRYPTO_RSC_SIZE);
-	keymaterial->key[0].paeRole = ftkey_info->paeRole;
-	keymaterial->key[0].keyLength = ftkey_info->keyLength;
-
-	if (ftkey_info->keyLength)
-		qdf_mem_copy(&keymaterial->key[0].key, ftkey_info->Key,
-				ftkey_info->keyLength);
-
-	qdf_copy_macaddr(&msg->bssid, &ftkey_info->peerMac);
-	msg->vdev_id = vdev_id;
-	sme_debug("BSSID = " QDF_MAC_ADDR_STR,
-		  QDF_MAC_ADDR_ARRAY(msg->bssid.bytes));
-	status = umac_send_mb_message_to_mac(msg);
-
-	return status;
-}
-
 bool sme_get_ftptk_state(mac_handle_t mac_handle, uint32_t sessionId)
 {
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
@@ -348,63 +286,6 @@ QDF_STATUS sme_check_ft_status(mac_handle_t mac_handle, uint32_t session_id)
 	return status;
 }
 
-QDF_STATUS sme_ft_update_key(mac_handle_t mac_handle, uint32_t sessionId,
-			     tCsrRoamSetKey *pFTKeyInfo)
-{
-	struct mac_context *mac = MAC_CONTEXT(mac_handle);
-	struct csr_roam_session *pSession = CSR_GET_SESSION(mac, sessionId);
-	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-
-	if (!pSession) {
-		sme_err("pSession is NULL");
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	if (!pFTKeyInfo) {
-		sme_err("pFTKeyInfo is NULL");
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	status = sme_acquire_global_lock(&mac->sme);
-	if (!(QDF_IS_STATUS_SUCCESS(status)))
-		return QDF_STATUS_E_FAILURE;
-
-	sme_debug("FT update key is received in state %d",
-		  pSession->ftSmeContext.FTState);
-
-	/* Global Station FT State */
-	switch (pSession->ftSmeContext.FTState) {
-	case eFT_SET_KEY_WAIT:
-		if (sme_get_ft_pre_auth_state(mac_handle, sessionId) == true) {
-			status = sme_ft_send_update_key_ind(mac, sessionId,
-								pFTKeyInfo);
-			if (status != 0) {
-				sme_err("Key set failure: %d", status);
-				pSession->ftSmeContext.setFTPTKState = false;
-				status = QDF_STATUS_FT_PREAUTH_KEY_FAILED;
-			} else {
-				pSession->ftSmeContext.setFTPTKState = true;
-				status = QDF_STATUS_FT_PREAUTH_KEY_SUCCESS;
-				sme_debug("Key set success");
-			}
-			sme_set_ft_pre_auth_state(mac_handle, sessionId, false);
-		}
-
-		pSession->ftSmeContext.FTState = eFT_START_READY;
-		sme_debug("state changed to %d status %d",
-			  pSession->ftSmeContext.FTState, status);
-		break;
-
-	default:
-		sme_debug("Unhandled state:%d", pSession->ftSmeContext.FTState);
-		status = QDF_STATUS_E_FAILURE;
-		break;
-	}
-	sme_release_global_lock(&mac->sme);
-
-	return status;
-}
-
 /*
  * HDD Interface to SME. SME now sends the Auth 2 and RIC IEs up to the
  * supplicant. The supplicant will then proceed to send down the

+ 0 - 534
core/sme/src/csr/csr_api_roam.c

@@ -428,15 +428,6 @@ static QDF_STATUS csr_init_channel_power_list(struct mac_context *mac,
 static QDF_STATUS csr_roam_free_connected_info(struct mac_context *mac,
 					       struct csr_roam_connectedinfo *
 					       pConnectedInfo);
-static QDF_STATUS csr_send_mb_set_context_req_msg(struct mac_context *mac,
-						uint32_t sessionId,
-					   struct qdf_mac_addr peer_macaddr,
-					    uint8_t numKeys,
-					   tAniEdType edType, bool fUnicast,
-					   tAniKeyDirection aniKeyDirection,
-					   uint8_t keyId, uint8_t keyLength,
-					   uint8_t *pKey, uint8_t paeRole,
-					   uint8_t *pKeyRsc);
 static void csr_roam_link_up(struct mac_context *mac, struct qdf_mac_addr bssid);
 static void csr_roam_link_down(struct mac_context *mac, uint32_t sessionId);
 static enum csr_cfgdot11mode
@@ -457,10 +448,6 @@ static QDF_STATUS csr_roam_start_wds(struct mac_context *mac,
 				     struct csr_roam_profile *pProfile,
 				     struct bss_description *bss_desc);
 static void csr_init_session(struct mac_context *mac, uint32_t sessionId);
-static QDF_STATUS csr_roam_issue_set_key_command(struct mac_context *mac,
-						 uint32_t sessionId,
-						 tCsrRoamSetKey *pSetKey,
-						 uint32_t roamId);
 
 static QDF_STATUS
 csr_roam_get_qos_info_from_bss(struct mac_context *mac,
@@ -10753,7 +10740,6 @@ void csr_roam_joined_state_msg_processor(struct mac_context *mac, void *msg_buf)
 	}
 }
 
-#ifdef CRYPTO_SET_KEY_CONVERGED
 static QDF_STATUS csr_roam_issue_set_context_req(struct mac_context *mac_ctx,
 						 uint32_t session_id,
 						 bool add_key, bool unicast,
@@ -10856,450 +10842,6 @@ QDF_STATUS csr_roam_issue_set_context_req_helper(
 					      unicast, key_id);
 }
 
-#else
-static QDF_STATUS
-csr_roam_issue_set_context_req(struct mac_context *mac, uint32_t sessionId,
-			       eCsrEncryptionType EncryptType,
-			       struct bss_description *pBssDescription,
-			       tSirMacAddr *bssId, bool addKey, bool fUnicast,
-			       tAniKeyDirection aniKeyDirection, uint8_t keyId,
-			       uint16_t keyLength, uint8_t *pKey,
-			       uint8_t paeRole)
-{
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	tAniEdType edType;
-
-	sme_debug("sessionId: %d EncryptType: %d", sessionId, EncryptType);
-
-	if (eCSR_ENCRYPT_TYPE_UNKNOWN == EncryptType)
-		EncryptType = eCSR_ENCRYPT_TYPE_NONE;
-
-	edType = csr_translate_encrypt_type_to_ed_type(EncryptType);
-
-	/*
-	 * Allow 0 keys to be set for the non-WPA encrypt types. For WPA encrypt
-	 * types, the num keys must be non-zero or LIM will reject the set
-	 * context (assumes the SET_CONTEXT does not occur until the keys are
-	 * distrubuted).
-	 */
-	if (CSR_IS_ENC_TYPE_STATIC(EncryptType) || addKey) {
-		tCsrRoamSetKey setKey;
-
-		setKey.encType = EncryptType;
-		setKey.keyDirection = aniKeyDirection;
-		qdf_mem_copy(&setKey.peerMac, bssId, sizeof(struct
-							qdf_mac_addr));
-		/* 0 for supplicant */
-		setKey.paeRole = paeRole;
-		/* Key index */
-		setKey.keyId = keyId;
-		setKey.keyLength = keyLength;
-		if (keyLength)
-			qdf_mem_copy(setKey.Key, pKey, keyLength);
-		status = csr_roam_issue_set_key_command(mac, sessionId,
-							&setKey, 0);
-	}
-	return status;
-}
-
-QDF_STATUS csr_roam_issue_set_context_req_helper(
-					struct mac_context *mac_ctx,
-					uint32_t session_id,
-					eCsrEncryptionType encr_type,
-					struct bss_description *bss_descr,
-					tSirMacAddr *bssid, bool addkey,
-					bool unicast,
-					tAniKeyDirection key_direction,
-					uint8_t key_id, uint16_t key_length,
-					uint8_t *key, uint8_t pae_role)
-{
-	return csr_roam_issue_set_context_req(mac_ctx, session_id, encr_type,
-					      bss_descr, bssid, addkey,
-					      unicast, key_direction, key_id,
-					      key_length, key, pae_role);
-}
-#endif
-
-/**
- * csr_update_key_cmd() - update key info in set key command
- * @mac_ctx:         mac global context
- * @session:         roam session
- * @set_key:         input set key command
- * @set_key_cmd:     set key command to update
- * @is_key_valid:    indicates if key is valid
- *
- * This function will validate the key length, adjust if too long. It will
- * update is_key_valid flag to false if some error has occurred key are local.
- *
- * Return: status of operation
- */
-static QDF_STATUS
-csr_update_key_cmd(struct mac_context *mac_ctx, struct csr_roam_session *session,
-		   tCsrRoamSetKey *set_key, struct setkey_cmd *set_key_cmd,
-		   bool *is_key_valid)
-{
-	switch (set_key->encType) {
-	case eCSR_ENCRYPT_TYPE_WEP40:
-	case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
-		/* KeyLength maybe 0 for static WEP */
-		if (set_key->keyLength) {
-			if (set_key->keyLength < WLAN_CRYPTO_KEY_WEP40_LEN) {
-				sme_warn("Invalid WEP40 keylength [= %d]",
-					set_key->keyLength);
-				*is_key_valid = false;
-				return QDF_STATUS_E_INVAL;
-			}
-
-			set_key_cmd->keyLength = WLAN_CRYPTO_KEY_WEP40_LEN;
-			qdf_mem_copy(set_key_cmd->Key, set_key->Key,
-				     WLAN_CRYPTO_KEY_WEP40_LEN);
-		}
-		*is_key_valid = true;
-		break;
-	case eCSR_ENCRYPT_TYPE_WEP104:
-	case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
-		/* KeyLength maybe 0 for static WEP */
-		if (set_key->keyLength) {
-			if (set_key->keyLength < WLAN_CRYPTO_KEY_WEP104_LEN) {
-				sme_warn("Invalid WEP104 keylength [= %d]",
-					set_key->keyLength);
-				*is_key_valid = false;
-				return QDF_STATUS_E_INVAL;
-			}
-
-			set_key_cmd->keyLength = WLAN_CRYPTO_KEY_WEP104_LEN;
-			qdf_mem_copy(set_key_cmd->Key, set_key->Key,
-				     WLAN_CRYPTO_KEY_WEP104_LEN);
-		}
-		*is_key_valid = true;
-		break;
-	case eCSR_ENCRYPT_TYPE_TKIP:
-		if (set_key->keyLength < CSR_TKIP_KEY_LEN) {
-			sme_warn("Invalid TKIP keylength [= %d]",
-				set_key->keyLength);
-			*is_key_valid = false;
-			return QDF_STATUS_E_INVAL;
-		}
-		set_key_cmd->keyLength = CSR_TKIP_KEY_LEN;
-		qdf_mem_copy(set_key_cmd->Key, set_key->Key,
-			     CSR_TKIP_KEY_LEN);
-		*is_key_valid = true;
-		break;
-	case eCSR_ENCRYPT_TYPE_AES:
-		if (set_key->keyLength < CSR_AES_KEY_LEN) {
-			sme_warn("Invalid AES/CCMP keylength [= %d]",
-				set_key->keyLength);
-			*is_key_valid = false;
-			return QDF_STATUS_E_INVAL;
-		}
-		set_key_cmd->keyLength = CSR_AES_KEY_LEN;
-		qdf_mem_copy(set_key_cmd->Key, set_key->Key,
-			     CSR_AES_KEY_LEN);
-		*is_key_valid = true;
-		break;
-	case eCSR_ENCRYPT_TYPE_AES_GCMP:
-		if (set_key->keyLength < CSR_AES_GCMP_KEY_LEN) {
-			sme_warn(
-				"Invalid AES_GCMP keylength [= %d]",
-				set_key->keyLength);
-			*is_key_valid = false;
-			return QDF_STATUS_E_INVAL;
-		}
-		set_key_cmd->keyLength = CSR_AES_GCMP_KEY_LEN;
-		qdf_mem_copy(set_key_cmd->Key, set_key->Key,
-			     CSR_AES_GCMP_KEY_LEN);
-		*is_key_valid = true;
-		break;
-	case eCSR_ENCRYPT_TYPE_AES_GCMP_256:
-		if (set_key->keyLength < CSR_AES_GCMP_256_KEY_LEN) {
-			sme_warn(
-				"Invalid AES_GCMP_256 keylength [= %d]",
-				set_key->keyLength);
-			*is_key_valid = false;
-			return QDF_STATUS_E_INVAL;
-		}
-		set_key_cmd->keyLength = CSR_AES_GCMP_256_KEY_LEN;
-		qdf_mem_copy(set_key_cmd->Key, set_key->Key,
-			     CSR_AES_GCMP_256_KEY_LEN);
-		*is_key_valid = true;
-		break;
-#ifdef FEATURE_WLAN_WAPI
-	case eCSR_ENCRYPT_TYPE_WPI:
-		if (set_key->keyLength < CSR_WAPI_KEY_LEN) {
-			sme_warn("Invalid WAPI keylength [= %d]",
-				set_key->keyLength);
-			*is_key_valid = false;
-			return QDF_STATUS_E_INVAL;
-		}
-		set_key_cmd->keyLength = CSR_WAPI_KEY_LEN;
-		qdf_mem_copy(set_key_cmd->Key, set_key->Key,
-			     CSR_WAPI_KEY_LEN);
-		if (session->pCurRoamProfile) {
-			session->pCurRoamProfile->negotiatedUCEncryptionType =
-				eCSR_ENCRYPT_TYPE_WPI;
-		} else {
-			sme_err("pCurRoamProfile is NULL");
-			*is_key_valid = false;
-			return QDF_STATUS_E_INVAL;
-		}
-		*is_key_valid = true;
-		break;
-#endif /* FEATURE_WLAN_WAPI */
-#ifdef FEATURE_WLAN_ESE
-	case eCSR_ENCRYPT_TYPE_KRK:
-		/* no need to enqueue KRK key request, since they are local */
-		*is_key_valid = false;
-		if (set_key->keyLength < CSR_KRK_KEY_LEN) {
-			sme_warn("Invalid KRK keylength [= %d]",
-				set_key->keyLength);
-			return QDF_STATUS_E_INVAL;
-		}
-		qdf_mem_copy(session->eseCckmInfo.krk, set_key->Key,
-			     CSR_KRK_KEY_LEN);
-		session->eseCckmInfo.reassoc_req_num = 1;
-		session->eseCckmInfo.krk_plumbed = true;
-		break;
-#ifdef WLAN_FEATURE_ROAM_OFFLOAD
-	case eCSR_ENCRYPT_TYPE_BTK:
-		/* no need to enqueue KRK key request, since they are local */
-		*is_key_valid = false;
-		if (set_key->keyLength < SIR_BTK_KEY_LEN) {
-			sme_warn("LFR3:Invalid BTK keylength [= %d]",
-				set_key->keyLength);
-			return QDF_STATUS_E_INVAL;
-		}
-		qdf_mem_copy(session->eseCckmInfo.btk, set_key->Key,
-			     SIR_BTK_KEY_LEN);
-		/*
-		 * KRK and BTK are updated by upper layer back to back. Send
-		 * updated KRK and BTK together to FW here.
-		 */
-		csr_roam_update_cfg(mac_ctx, session->sessionId,
-				    REASON_ROAM_PSK_PMK_CHANGED);
-		break;
-#endif
-#endif /* FEATURE_WLAN_ESE */
-#ifdef WLAN_FEATURE_11W
-	/* Check for 11w BIP */
-	case eCSR_ENCRYPT_TYPE_AES_CMAC:
-		if (set_key->keyLength < CSR_AES_KEY_LEN) {
-			sme_warn("Invalid AES/CCMP keylength [= %d]",
-				set_key->keyLength);
-			*is_key_valid = false;
-			return QDF_STATUS_E_INVAL;
-		}
-		set_key_cmd->keyLength = CSR_AES_KEY_LEN;
-		qdf_mem_copy(set_key_cmd->Key, set_key->Key,
-			     CSR_AES_KEY_LEN);
-		*is_key_valid = true;
-		break;
-
-	case eCSR_ENCRYPT_TYPE_AES_GMAC_128:
-		if (set_key->keyLength < CSR_AES_GMAC_128_KEY_LEN) {
-			sme_warn("Invalid AES GMAC 128 keylength [= %d]",
-				set_key->keyLength);
-			*is_key_valid = false;
-			return QDF_STATUS_E_INVAL;
-		}
-		set_key_cmd->keyLength = CSR_AES_GMAC_128_KEY_LEN;
-		qdf_mem_copy(set_key_cmd->Key, set_key->Key,
-			     CSR_AES_GMAC_128_KEY_LEN);
-		*is_key_valid = true;
-		break;
-
-	case eCSR_ENCRYPT_TYPE_AES_GMAC_256:
-		if (set_key->keyLength < CSR_AES_GMAC_256_KEY_LEN) {
-			sme_warn("Invalid AES GMAC 256 keylength [= %d]",
-				set_key->keyLength);
-			*is_key_valid = false;
-			return QDF_STATUS_E_INVAL;
-		}
-		set_key_cmd->keyLength = CSR_AES_GMAC_256_KEY_LEN;
-		qdf_mem_copy(set_key_cmd->Key, set_key->Key,
-			     CSR_AES_GMAC_256_KEY_LEN);
-		*is_key_valid = true;
-		break;
-
-#endif /* WLAN_FEATURE_11W */
-	default:
-		/* for open security also we want to enqueue command */
-		*is_key_valid = true;
-		return QDF_STATUS_SUCCESS;
-	} /* end of switch */
-	return QDF_STATUS_SUCCESS;
-}
-
-
-static QDF_STATUS csr_roam_issue_set_key_command(
-struct mac_context *mac_ctx, uint32_t session_id,
-		 tCsrRoamSetKey *set_key,
-		 uint32_t roam_id)
-{
-	QDF_STATUS status = QDF_STATUS_E_INVAL;
-	bool is_key_valid = true;
-	struct setkey_cmd set_key_cmd;
-#if defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_WAPI)
-	struct csr_roam_session *session = CSR_GET_SESSION(mac_ctx, session_id);
-
-	if (!session) {
-		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
-			 "session %d not found", session_id);
-		return QDF_STATUS_E_FAILURE;
-	}
-#endif /* FEATURE_WLAN_ESE */
-
-	qdf_mem_zero(&set_key_cmd, sizeof(struct setkey_cmd));
-	/*
-	 * following function will validate the key length, Adjust if too long.
-	 * for static WEP the keys are not set thru' SetContextReq
-	 *
-	 * it will update bool is_key_valid, to false if some error has occurred
-	 * key are local. enqueue sme command only if is_key_valid is true
-	 * status is indication of success or failure and will be returned to
-	 * called of current function if command is not enqueued due to key req
-	 * being local
-	 */
-	status = csr_update_key_cmd(mac_ctx, session, set_key,
-				    &set_key_cmd, &is_key_valid);
-	if (is_key_valid) {
-		set_key_cmd.roamId = roam_id;
-		set_key_cmd.encType = set_key->encType;
-		set_key_cmd.keyDirection = set_key->keyDirection;
-		qdf_copy_macaddr(&set_key_cmd.peermac,
-				 &set_key->peerMac);
-		/* 0 for supplicant */
-		set_key_cmd.paeRole = set_key->paeRole;
-		set_key_cmd.keyId = set_key->keyId;
-		qdf_mem_copy(set_key_cmd.keyRsc, set_key->keyRsc,
-			     WLAN_CRYPTO_RSC_SIZE);
-		/*
-		 * Always put set key to the head of the Q because it is the
-		 * only thing to get executed in case of WT_KEY state
-		 */
-		sme_debug("set key req for session-%d authtype-%d",
-			session_id, set_key->encType);
-		status = csr_roam_send_set_key_cmd(mac_ctx, session_id,
-						&set_key_cmd);
-		if (!QDF_IS_STATUS_SUCCESS(status))
-			sme_err("fail to send message status = %d", status);
-	}
-	return status;
-}
-
-QDF_STATUS csr_roam_send_set_key_cmd(struct mac_context *mac_ctx,
-				uint32_t session_id,
-				struct setkey_cmd *set_key_cmd)
-{
-	QDF_STATUS status;
-	uint8_t num_keys = (set_key_cmd->keyLength) ? 1 : 0;
-	tAniEdType ed_type = csr_translate_encrypt_type_to_ed_type(
-						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,
-				 host_event_wlan_security_payload_type);
-
-	if (!session) {
-		sme_err("session %d not found", session_id);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	if (eSIR_ED_NONE != ed_type) {
-		qdf_mem_zero(&setKeyEvent,
-			sizeof(host_event_wlan_security_payload_type));
-		if (qdf_is_macaddr_group(&set_key_cmd->peermac)) {
-			setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_BCAST_REQ;
-			setKeyEvent.encryptionModeMulticast =
-				(uint8_t) diag_enc_type_from_csr_type(
-					set_key_cmd->encType);
-			setKeyEvent.encryptionModeUnicast =
-				(uint8_t) diag_enc_type_from_csr_type(session->
-							connectedProfile.
-							EncryptionType);
-		} else {
-			setKeyEvent.eventId =
-				WLAN_SECURITY_EVENT_SET_UNICAST_REQ;
-			setKeyEvent.encryptionModeUnicast =
-				(uint8_t) diag_enc_type_from_csr_type(
-					set_key_cmd->encType);
-			setKeyEvent.encryptionModeMulticast =
-				(uint8_t) diag_enc_type_from_csr_type(session->
-							connectedProfile.
-							mcEncryptionType);
-		}
-		qdf_mem_copy(setKeyEvent.bssid,
-			     session->connectedProfile.bssid.bytes,
-			     QDF_MAC_ADDR_SIZE);
-		if (CSR_IS_ENC_TYPE_STATIC(set_key_cmd->encType)) {
-			/* It has to be static WEP here */
-			setKeyEvent.keyId = wep_params->wep_default_key_id;
-		} else {
-			setKeyEvent.keyId = set_key_cmd->keyId;
-		}
-		setKeyEvent.authMode =
-			(uint8_t) diag_auth_type_from_csr_type(session->
-							       connectedProfile.
-							       AuthType);
-		WLAN_HOST_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY);
-	}
-#endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */
-	if (csr_is_set_key_allowed(mac_ctx, session_id)) {
-		status = csr_send_mb_set_context_req_msg(mac_ctx, session_id,
-					set_key_cmd->peermac,
-					num_keys, ed_type, unicast,
-					set_key_cmd->keyDirection,
-					set_key_cmd->keyId,
-					set_key_cmd->keyLength,
-					set_key_cmd->Key,
-					set_key_cmd->paeRole,
-					set_key_cmd->keyRsc);
-	} else {
-		sme_warn(" cannot process not connected");
-		/* Set this status so the error handling take
-		 * care of the case.
-		 */
-		status = QDF_STATUS_CSR_WRONG_STATE;
-	}
-	if (!QDF_IS_STATUS_SUCCESS(status)) {
-		sme_err("  error status %d", status);
-		csr_roam_call_callback(mac_ctx, session_id, NULL,
-				       set_key_cmd->roamId,
-				       eCSR_ROAM_SET_KEY_COMPLETE,
-				       eCSR_ROAM_RESULT_FAILURE);
-#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
-		if (eSIR_ED_NONE != ed_type) {
-			if (qdf_is_macaddr_group(&set_key_cmd->peermac))
-				setKeyEvent.eventId =
-					WLAN_SECURITY_EVENT_SET_BCAST_RSP;
-			else
-				setKeyEvent.eventId =
-					WLAN_SECURITY_EVENT_SET_UNICAST_RSP;
-			setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE;
-			WLAN_HOST_DIAG_EVENT_REPORT(&setKeyEvent,
-						    EVENT_WLAN_SECURITY);
-		}
-#endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */
-	}
-	return status;
-}
-
-QDF_STATUS csr_roam_set_key(struct mac_context *mac, uint32_t sessionId,
-			    tCsrRoamSetKey *pSetKey, uint32_t roamId)
-{
-	QDF_STATUS status;
-
-	if (!csr_is_set_key_allowed(mac, sessionId)) {
-		status = QDF_STATUS_CSR_WRONG_STATE;
-	} else {
-		status = csr_roam_issue_set_key_command(mac, sessionId,
-							pSetKey, roamId);
-	}
-	return status;
-}
-
 #ifdef WLAN_FEATURE_FILS_SK
 /*
  * csr_create_fils_realm_hash: API to create hash using realm
@@ -16933,82 +16475,6 @@ QDF_STATUS csr_send_assoc_cnf_msg(struct mac_context *mac,
 	return status;
 }
 
-QDF_STATUS csr_send_mb_set_context_req_msg(struct mac_context *mac,
-					   uint32_t sessionId,
-					   struct qdf_mac_addr peer_macaddr,
-					   uint8_t numKeys,
-					   tAniEdType edType, bool fUnicast,
-					   tAniKeyDirection aniKeyDirection,
-					   uint8_t keyId, uint8_t keyLength,
-					   uint8_t *pKey, uint8_t paeRole,
-					   uint8_t *pKeyRsc)
-{
-	struct set_context_req *pMsg;
-	struct scheduler_msg msg = {0};
-	uint16_t msgLen;
-	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	struct csr_roam_session *pSession = CSR_GET_SESSION(mac, sessionId);
-
-	sme_debug("keylength: %d Encry type: %d", keyLength, edType);
-	do {
-		if ((1 != numKeys) && (0 != numKeys))
-			break;
-		/*
-		 * All of these fields appear in every SET_CONTEXT message.
-		 * Below we'll add in the size for each key set. Since we only
-		 * support up to one key, we always allocate memory for 1 key.
-		 */
-		msgLen = sizeof(*pMsg);
-
-		pMsg = qdf_mem_malloc(msgLen);
-		if (!pMsg)
-			return QDF_STATUS_E_NOMEM;
-		pMsg->messageType = eWNI_SME_SETCONTEXT_REQ;
-		pMsg->length = msgLen;
-		pMsg->vdev_id = (uint8_t) sessionId;
-		qdf_copy_macaddr(&pMsg->peer_macaddr, &peer_macaddr);
-		qdf_copy_macaddr(&pMsg->bssid,
-				 &pSession->connectedProfile.bssid);
-
-		/**
-		 * Set the pMsg->keyMaterial.length field
-		 * (this length is defined as all data that follows the
-		 * edType field in the tSirKeyMaterial keyMaterial; field).
-		 *
-		 * NOTE:  This keyMaterial.length contains the length of a
-		 * MAX size key, though the keyLength can be shorter than this
-		 * max size.  Is LIM interpreting this ok ?
-		 */
-		pMsg->keyMaterial.length =
-				sizeof(pMsg->keyMaterial.numKeys) +
-				(numKeys * sizeof(pMsg->keyMaterial.key));
-		pMsg->keyMaterial.edType = edType;
-		pMsg->keyMaterial.numKeys = numKeys;
-		pMsg->keyMaterial.key[0].keyId = keyId;
-		pMsg->keyMaterial.key[0].unicast = fUnicast;
-		pMsg->keyMaterial.key[0].keyDirection = aniKeyDirection;
-		qdf_mem_copy(pMsg->keyMaterial.key[0].keyRsc,
-				pKeyRsc, WLAN_CRYPTO_RSC_SIZE);
-		/* 0 is Supplicant */
-		pMsg->keyMaterial.key[0].paeRole = paeRole;
-		pMsg->keyMaterial.key[0].keyLength = keyLength;
-		if (keyLength && pKey)
-			qdf_mem_copy(pMsg->keyMaterial.key[0].key,
-					pKey, keyLength);
-
-		msg.type = eWNI_SME_SETCONTEXT_REQ;
-		msg.bodyptr = pMsg;
-		status = scheduler_post_message(QDF_MODULE_ID_SME,
-						QDF_MODULE_ID_PE,
-						QDF_MODULE_ID_PE, &msg);
-		if (QDF_IS_STATUS_ERROR(status)) {
-			qdf_mem_zero(pMsg, msgLen);
-			qdf_mem_free(pMsg);
-		}
-	} while (0);
-	return status;
-}
-
 QDF_STATUS csr_send_mb_start_bss_req_msg(struct mac_context *mac, uint32_t
 					sessionId, eCsrRoamBssType bssType,
 					 struct csr_roamstart_bssparams *pParam,

+ 0 - 2
core/sme/src/csr/csr_inside_api.h

@@ -362,8 +362,6 @@ void csr_reset_pmkid_candidate_list(struct mac_context *mac, uint32_t sessionId)
 QDF_STATUS csr_save_to_channel_power2_g_5_g(struct mac_context *mac,
 					uint32_t tableSize, tSirMacChanInfo
 					*channelTable);
-QDF_STATUS csr_roam_set_key(struct mac_context *mac, uint32_t sessionId,
-			    tCsrRoamSetKey *pSetKey, uint32_t roamId);
 
 /*
  * csr_roam_vdev_delete() - CSR api to delete vdev