瀏覽代碼

qcacmn: Add wlan_crypto_is_key_valid check

Add wlan_crypto_is_key_valid to check if key
is valid.

Change-Id: Ica71f56f1739261fff425e793ec8c15d2523e8e7
Disha Das 5 年之前
父節點
當前提交
07721fc036

+ 14 - 0
umac/cmn_services/crypto/inc/wlan_crypto_global_api.h

@@ -244,6 +244,20 @@ bool wlan_crypto_vdev_is_pmf_required(struct wlan_objmgr_vdev *vdev);
 bool wlan_crypto_is_pmf_enabled(struct wlan_objmgr_vdev *vdev,
 					struct wlan_objmgr_peer *peer);
 
+/**
+ * wlan_crypto_is_key_valid - called by mgmt txrx to check if key is valid
+ * @vdev: vdev
+ * @peer: peer
+ * @keyidx : key index
+ *
+ * This function gets called by mgmt txrx to check if key is valid
+ *
+ * Return: true or false
+ */
+bool wlan_crypto_is_key_valid(struct wlan_objmgr_vdev *vdev,
+			      struct wlan_objmgr_peer *peer,
+			      uint16_t keyidx);
+
 /**
  * wlan_crypto_add_mmie - called by mgmt txrx to add mmie in frame
  * @vdev: vdev

+ 30 - 0
umac/cmn_services/crypto/src/wlan_crypto_global_api.c

@@ -1724,6 +1724,36 @@ bool wlan_crypto_is_pmf_enabled(struct wlan_objmgr_vdev *vdev,
 	return false;
 }
 
+/**
+ * wlan_crypto_is_key_valid - called by mgmt txrx to check if key is valid
+ * @vdev: vdev
+ * @peer: peer
+ * @keyidx : key index
+ *
+ * This function gets called by mgmt txrx to check if key is valid
+ *
+ * Return: true or false
+ */
+bool wlan_crypto_is_key_valid(struct wlan_objmgr_vdev *vdev,
+			      struct wlan_objmgr_peer *peer,
+			      uint16_t keyidx)
+{
+	struct wlan_crypto_key *key = NULL;
+
+	if (!vdev && !peer)
+		return false;
+
+	if (peer)
+		key = wlan_crypto_peer_getkey(peer, keyidx);
+	else if (vdev)
+		key = wlan_crypto_vdev_getkey(vdev, keyidx);
+
+	if ((key) && key->valid)
+		return true;
+
+	return false;
+}
+
 static void wlan_crypto_gmac_pn_swap(uint8_t *a, uint8_t *b)
 {
 	a[0] = b[5];