浏览代码

qcacld-3.0: Use peer to get the cipher to decide MIC length

Driver uses cipher stored in vdev to get the MIC length, which
may get updated if multiple peer(TDLS peer in STA case) get
connected to the vdev. Thus depending on latest peer cipher type
the MIC length will be calculated for all peers.

Add changes to store cipher info in peer and use it to calculate
MIC length for the frame if CRYPTO_SET_KEY_CONVERGED is defined.

Change-Id: I852e4b519f55d8020237989314f8506aa275f379
CRs-Fixed: 2444416
Abhishek Singh 6 年之前
父节点
当前提交
a90516a68e
共有 2 个文件被更改,包括 59 次插入1 次删除
  1. 2 1
      mlme/core/inc/wlan_mlme_main.h
  2. 57 0
      mlme/core/src/wlan_mlme_main.c

+ 2 - 1
mlme/core/inc/wlan_mlme_main.h

@@ -127,6 +127,7 @@ mlme_vdev_object_destroyed_notification(struct wlan_objmgr_vdev *vdev,
 
 
 #endif
 #endif
 
 
+#ifndef CRYPTO_SET_KEY_CONVERGED
 /**
 /**
  * wlan_peer_set_unicast_cipher() - set unicast cipher
  * wlan_peer_set_unicast_cipher() - set unicast cipher
  * @peer: PEER object
  * @peer: PEER object
@@ -168,7 +169,7 @@ uint32_t wlan_peer_get_unicast_cipher(struct wlan_objmgr_peer *peer)
 
 
 	return peer_priv->ucast_key_cipher;
 	return peer_priv->ucast_key_cipher;
 }
 }
-
+#endif
 /**
 /**
  * wma_get_peer_mic_len() - get mic hdr len and mic length for peer
  * wma_get_peer_mic_len() - get mic hdr len and mic length for peer
  * @psoc: psoc
  * @psoc: psoc

+ 57 - 0
mlme/core/src/wlan_mlme_main.c

@@ -26,6 +26,7 @@
 #include "wlan_scan_public_structs.h"
 #include "wlan_scan_public_structs.h"
 #include "wlan_vdev_mlme_api.h"
 #include "wlan_vdev_mlme_api.h"
 #include "wlan_mlme_api.h"
 #include "wlan_mlme_api.h"
+#include <wlan_crypto_global_api.h>
 
 
 #define NUM_OF_SOUNDING_DIMENSIONS     1 /*Nss - 1, (Nss = 2 for 2x2)*/
 #define NUM_OF_SOUNDING_DIMENSIONS     1 /*Nss - 1, (Nss = 2 for 2x2)*/
 
 
@@ -239,6 +240,61 @@ out:
 	return status;
 	return status;
 }
 }
 
 
+#ifdef CRYPTO_SET_KEY_CONVERGED
+QDF_STATUS mlme_get_peer_mic_len(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
+				 uint8_t *peer_mac, uint8_t *mic_len,
+				 uint8_t *mic_hdr_len)
+{
+	struct wlan_objmgr_peer *peer;
+	uint32_t key_cipher;
+
+	if (!psoc || !mic_len || !mic_hdr_len || !peer_mac) {
+		mlme_debug("psoc/mic_len/mic_hdr_len/peer_mac null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	peer = wlan_objmgr_get_peer(psoc, pdev_id,
+				    peer_mac, WLAN_LEGACY_MAC_ID);
+	if (!peer) {
+		mlme_debug("Peer of peer_mac %pM not found", peer_mac);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	key_cipher =
+		wlan_crypto_get_peer_param(peer,
+					   WLAN_CRYPTO_PARAM_UCAST_CIPHER);
+	wlan_objmgr_peer_release_ref(peer, WLAN_LEGACY_MAC_ID);
+
+	if (key_cipher & (1 << WLAN_CRYPTO_CIPHER_AES_GCM) ||
+	    key_cipher & (1 << WLAN_CRYPTO_CIPHER_AES_GCM_256)) {
+		*mic_hdr_len = WLAN_IEEE80211_GCMP_HEADERLEN;
+		*mic_len = WLAN_IEEE80211_GCMP_MICLEN;
+	} else {
+		*mic_hdr_len = IEEE80211_CCMP_HEADERLEN;
+		*mic_len = IEEE80211_CCMP_MICLEN;
+	}
+	mlme_debug("peer %pM hdr_len %d mic_len %d key_cipher 0x%x", peer_mac,
+		   *mic_hdr_len, *mic_len, key_cipher);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+mlme_peer_object_created_notification(struct wlan_objmgr_peer *peer,
+				      void *arg)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+mlme_peer_object_destroyed_notification(struct wlan_objmgr_peer *peer,
+					void *arg)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+#else
+
 QDF_STATUS mlme_get_peer_mic_len(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
 QDF_STATUS mlme_get_peer_mic_len(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
 				 uint8_t *peer_mac, uint8_t *mic_len,
 				 uint8_t *peer_mac, uint8_t *mic_len,
 				 uint8_t *mic_hdr_len)
 				 uint8_t *mic_hdr_len)
@@ -334,6 +390,7 @@ mlme_peer_object_destroyed_notification(struct wlan_objmgr_peer *peer,
 
 
 	return status;
 	return status;
 }
 }
+#endif
 
 
 static void mlme_init_chainmask_cfg(struct wlan_objmgr_psoc *psoc,
 static void mlme_init_chainmask_cfg(struct wlan_objmgr_psoc *psoc,
 				    struct wlan_mlme_chainmask *chainmask_info)
 				    struct wlan_mlme_chainmask *chainmask_info)