Преглед изворни кода

qcacmn: Add API to get FILS pmksa entry cache id and SSID

Add new API to lookup the pmksa entry by fils cache id
and SSID.

Change-Id: I654d2b29b97a3b02ab6da7d2cfa0884bb8e5d2a1
CRs-Fixed: 2719643
Pragaspathi Thilagaraj пре 5 година
родитељ
комит
81b14a586e

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

@@ -903,6 +903,21 @@ struct wlan_crypto_pmksa *
 wlan_crypto_get_pmksa(struct wlan_objmgr_vdev *vdev,
 		      struct qdf_mac_addr *bssid);
 
+/**
+ * wlan_crypto_get_fils_pmksa  - Get the PMKSA for FILS
+ * SSID, if the SSID and cache id matches
+ * @vdev:     Pointer with VDEV object
+ * @cache_id: Cache id
+ * @ssid:     Pointer to ssid
+ * @ssid_len: SSID length
+ *
+ * Return: PMKSA entry if the cache id and SSID matches
+ */
+struct wlan_crypto_pmksa *
+wlan_crypto_get_fils_pmksa(struct wlan_objmgr_vdev *vdev,
+			   uint8_t *cache_id, uint8_t *ssid,
+			   uint8_t ssid_len);
+
 /**
  * wlan_crypto_pmksa_flush - called to flush saved pmksa
  * @crypto_params: crypto_params

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

@@ -567,6 +567,40 @@ wlan_crypto_get_pmksa(struct wlan_objmgr_vdev *vdev, struct qdf_mac_addr *bssid)
 	return NULL;
 }
 
+struct wlan_crypto_pmksa *
+wlan_crypto_get_fils_pmksa(struct wlan_objmgr_vdev *vdev,
+			   uint8_t *cache_id, uint8_t *ssid,
+			   uint8_t ssid_len)
+{
+	struct wlan_crypto_comp_priv *crypto_priv;
+	struct wlan_crypto_params *crypto_params;
+	uint8_t i;
+
+	crypto_priv = (struct wlan_crypto_comp_priv *)
+					wlan_get_vdev_crypto_obj(vdev);
+
+	if (!crypto_priv) {
+		crypto_err("crypto_priv NULL");
+		return NULL;
+	}
+
+	crypto_params = &crypto_priv->crypto_params;
+	for (i = 0; i < WLAN_CRYPTO_MAX_PMKID; i++) {
+		if (!crypto_params->pmksa[i])
+			continue;
+
+		if (!qdf_mem_cmp(cache_id,
+				 crypto_params->pmksa[i]->cache_id,
+				 WLAN_CACHE_ID_LEN) &&
+		    !qdf_mem_cmp(ssid, crypto_params->pmksa[i]->ssid,
+				 ssid_len) &&
+		    ssid_len == crypto_params->pmksa[i]->ssid_len)
+			return crypto_params->pmksa[i];
+	}
+
+	return NULL;
+}
+
 /**
  * wlan_crypto_is_htallowed - called to check is HT allowed for cipher
  * @vdev:  vdev