qcacld-3.0: Add Support for FILS Association
Adds the following support:
1) Add FILS IE's to assoc request.
2) AEAD encrypt/decrypt the assoc request/response frames for FILS
3) Process/Verify the Assoc response for the FILS params
4) Plumb the Auth keys to firmware after successful FILS assoc
5) Update the user space with Auth key details
Change-Id: I57f6319cecdf10e08047b510321b885c3cd711b5
CRs-Fixed: 2030038
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 62a6c51..c0c5921 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -4749,6 +4749,175 @@
}
#endif
+#ifdef WLAN_FEATURE_FILS_SK
+#ifdef CFG80211_CONNECT_DONE
+#ifdef CFG80211_FILS_SK_OFFLOAD_SUPPORT
+/**
+ * hdd_populate_fils_params() - Populate FILS keys to connect response
+ * @fils_params: connect response to supplicant
+ * @fils_kek: FILS kek
+ * @fils_kek_len: FILS kek length
+ * @pmk: FILS PMK
+ * @pmk_len: FILS PMK length
+ * @pmkid: PMKID
+ * @fils_seq_num: FILS Seq number
+ *
+ * Return: None
+ */
+static void hdd_populate_fils_params(struct cfg80211_connect_resp_params
+ *fils_params, const uint8_t *fils_kek,
+ size_t fils_kek_len, const uint8_t *pmk,
+ size_t pmk_len, const uint8_t *pmkid,
+ uint16_t fils_seq_num)
+{
+ /* Increament seq number to be used for next FILS */
+ fils_params->fils_erp_next_seq_num = fils_seq_num + 1;
+ fils_params->update_erp_next_seq_num = true;
+ fils_params->fils_kek = fils_kek;
+ fils_params->fils_kek_len = fils_kek_len;
+ fils_params->pmk = pmk;
+ fils_params->pmk_len = pmk_len;
+ fils_params->pmkid = pmkid;
+}
+#else
+static inline void hdd_populate_fils_params(struct cfg80211_connect_resp_params
+ *fils_params, const uint8_t
+ *fils_kek, size_t fils_kek_len,
+ const uint8_t *pmk, size_t pmk_len,
+ const uint8_t *pmkid,
+ uint16_t fils_seq_num)
+{ }
+#endif
+
+/**
+ * hdd_connect_done() - Wrapper API to call cfg80211_connect_done
+ * @dev: network device
+ * @bssid: bssid to which we want to associate
+ * @bss: cfg80211 bss info
+ * @roam_info: information about connected bss
+ * @req_ie: Request Information Element
+ * @req_ie_len: len of the req IE
+ * @resp_ie: Response IE
+ * @resp_ie_len: len of ht response IE
+ * @status: status
+ * @gfp: allocation flags
+ * @connect_timeout: If timed out waiting for Auth/Assoc/Probe resp
+ * @timeout_reason: reason for connect timeout
+ * @roam_fils_params: FILS join response params
+ *
+ * This API is used as wrapper to send FILS key/sequence number
+ * params etc. to supplicant in case of FILS connection
+ *
+ * Return: None
+ */
+static void hdd_connect_done(struct net_device *dev, const u8 *bssid,
+ struct cfg80211_bss *bss, tCsrRoamInfo *roam_info,
+ const u8 *req_ie, size_t req_ie_len,
+ const u8 *resp_ie, size_t resp_ie_len, u16 status,
+ gfp_t gfp, bool connect_timeout, tSirResultCodes
+ timeout_reason, struct fils_join_rsp_params
+ *roam_fils_params)
+{
+ struct cfg80211_connect_resp_params fils_params;
+ qdf_mem_zero(&fils_params, sizeof(fils_params));
+
+ if (!roam_fils_params) {
+ fils_params.status = WLAN_STATUS_UNSPECIFIED_FAILURE;
+ } else {
+ fils_params.status = status;
+ fils_params.bssid = bssid;
+ fils_params.timeout_reason = timeout_reason;
+ fils_params.req_ie = req_ie;
+ fils_params.req_ie_len = req_ie_len;
+ fils_params.resp_ie = resp_ie;
+ fils_params.resp_ie_len = resp_ie_len;
+ fils_params.bss = bss;
+ hdd_populate_fils_params(&fils_params, roam_fils_params->kek,
+ roam_fils_params->kek_len,
+ roam_fils_params->fils_pmk,
+ roam_fils_params->fils_pmk_len,
+ roam_fils_params->fils_pmkid,
+ roam_info->fils_seq_num);
+ }
+ hdd_debug("FILS indicate connect status %d seq no %d",
+ fils_params.status,
+ fils_params.fils_erp_next_seq_num);
+
+ cfg80211_connect_done(dev, &fils_params, gfp);
+
+ /* Clear all the FILS key info */
+ if (roam_fils_params && roam_fils_params->fils_pmk)
+ qdf_mem_free(roam_fils_params->fils_pmk);
+ if (roam_fils_params)
+ qdf_mem_free(roam_fils_params);
+ roam_info->fils_join_rsp = NULL;
+}
+#else
+static inline void hdd_connect_done(struct net_device *dev, const u8 *bssid,
+ struct cfg80211_bss *bss, tCsrRoamInfo
+ *roam_info, const u8 *req_ie,
+ size_t req_ie_len, const u8 *resp_ie,
+ size_t resp_ie_len, u16 status, gfp_t gfp,
+ bool connect_timeout, tSirResultCodes
+ timeout_reason, struct fils_join_rsp_params
+ *roam_fils_params)
+{ }
+#endif
+#endif
+
+#if defined(CFG80211_CONNECT_DONE) && defined(WLAN_FEATURE_FILS_SK)
+/**
+ * hdd_fils_update_connect_results() - API to send fils connection status to
+ * supplicant.
+ * @dev: network device
+ * @bssid: bssid to which we want to associate
+ * @bss: cfg80211 bss info
+ * @roam_info: information about connected bss
+ * @req_ie: Request Information Element
+ * @req_ie_len: len of the req IE
+ * @resp_ie: Response IE
+ * @resp_ie_len: len of ht response IE
+ * @status: status
+ * @gfp: allocation flags
+ * @connect_timeout: If timed out waiting for Auth/Assoc/Probe resp
+ * @timeout_reason: reason for connect timeout
+ *
+ * The API is a wrapper to send connection status to supplicant
+ *
+ * Return: 0 if success else failure
+ */
+static int hdd_fils_update_connect_results(struct net_device *dev,
+ const u8 *bssid,
+ struct cfg80211_bss *bss,
+ tCsrRoamInfo *roam_info, const u8 *req_ie,
+ size_t req_ie_len, const u8 *resp_ie,
+ size_t resp_ie_len, u16 status, gfp_t gfp,
+ bool connect_timeout,
+ tSirResultCodes timeout_reason)
+{
+ ENTER();
+ if (!roam_info || !roam_info->is_fils_connection)
+ return -EINVAL;
+
+ hdd_connect_done(dev, bssid, bss, roam_info, req_ie, req_ie_len,
+ resp_ie, resp_ie_len, status, gfp, connect_timeout,
+ timeout_reason, roam_info->fils_join_rsp);
+ return 0;
+}
+#else
+static inline int hdd_fils_update_connect_results(struct net_device *dev,
+ const u8 *bssid,
+ struct cfg80211_bss *bss,
+ tCsrRoamInfo *roam_info, const u8 *req_ie,
+ size_t req_ie_len, const u8 *resp_ie,
+ size_t resp_ie_len, u16 status, gfp_t gfp,
+ bool connect_timeout,
+ tSirResultCodes timeout_reason)
+{
+ return -EINVAL;
+}
+#endif
+
/**
* hdd_connect_result() - API to send connection status to supplicant
* @dev: network device
@@ -4796,9 +4965,14 @@
roam_info->u.pConnectedProfile->SSID.length);
}
- hdd_connect_bss(dev, bssid, bss, req_ie,
- req_ie_len, resp_ie, resp_ie_len,
- status, gfp, connect_timeout, timeout_reason);
+ if (hdd_fils_update_connect_results(dev, bssid, bss,
+ roam_info, req_ie, req_ie_len, resp_ie,
+ resp_ie_len, status, gfp, connect_timeout,
+ timeout_reason) != 0) {
+ hdd_connect_bss(dev, bssid, bss, req_ie,
+ req_ie_len, resp_ie, resp_ie_len,
+ status, gfp, connect_timeout, timeout_reason);
+ }
qdf_runtime_pm_allow_suspend(&padapter->connect_rpm_ctx.connect);
hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_CONNECT);