Revert "Cumulative patch from commit a9491695b30a7f750dc45cb563d813b03f1d4b8d"

This reverts commit bbcc4391bed89e8cd0dd235760cd2983f65721cf.

Bug: 34869019
Test: Load image and start soft AP

Change-Id: I85f39c134c1321d6a78f9f25a34f71ad7b1173fb
diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index e4ac24f..f57311e 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -1201,10 +1201,9 @@
 
 #ifdef CONFIG_TDLS_TESTING
 	if (tdls_testing & TDLS_TESTING_DIFF_BSSID) {
-		struct wpa_tdls_lnkid *l = (struct wpa_tdls_lnkid *) pos;
-
 		wpa_printf(MSG_DEBUG, "TDLS: Testing - use incorrect BSSID in "
 			   "Link Identifier");
+		struct wpa_tdls_lnkid *l = (struct wpa_tdls_lnkid *) pos;
 		wpa_tdls_linkid(sm, peer, l);
 		l->bssid[5] ^= 0x01;
 		pos += sizeof(*l);
diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
index 696ea04..365845f 100644
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
@@ -17,7 +17,6 @@
 #include "crypto/aes_siv.h"
 #include "common/ieee802_11_defs.h"
 #include "common/ieee802_11_common.h"
-#include "eap_common/eap_defs.h"
 #include "eapol_supp/eapol_supp_sm.h"
 #include "wpa.h"
 #include "eloop.h"
@@ -3303,19 +3302,12 @@
 	wpabuf_put_data(buf, sm->fils_session, FILS_SESSION_LEN);
 
 	/* FILS Wrapped Data */
-	sm->fils_erp_pmkid_set = 0;
 	if (erp_msg) {
 		wpabuf_put_u8(buf, WLAN_EID_EXTENSION); /* Element ID */
 		wpabuf_put_u8(buf, 1 + wpabuf_len(erp_msg)); /* Length */
 		/* Element ID Extension */
 		wpabuf_put_u8(buf, WLAN_EID_EXT_FILS_WRAPPED_DATA);
 		wpabuf_put_buf(buf, erp_msg);
-		/* Calculate pending PMKID here so that we do not need to
-		 * maintain a copy of the EAP-Initiate/Reauth message. */
-		if (fils_pmkid_erp(sm->key_mgmt, wpabuf_head(erp_msg),
-				   wpabuf_len(erp_msg),
-				   sm->fils_erp_pmkid) == 0)
-			sm->fils_erp_pmkid_set = 1;
 	}
 
 	wpa_hexdump_buf(MSG_DEBUG, "RSN: FILS fields for Authentication frame",
@@ -3415,9 +3407,6 @@
 
 	/* FILS Wrapped Data */
 	if (!sm->cur_pmksa && elems.fils_wrapped_data) {
-		u8 rmsk[ERP_MAX_KEY_LEN];
-		size_t rmsk_len;
-
 		wpa_hexdump(MSG_DEBUG, "FILS: Wrapped Data",
 			    elems.fils_wrapped_data,
 			    elems.fils_wrapped_data_len);
@@ -3426,30 +3415,14 @@
 		if (eapol_sm_failed(sm->eapol))
 			return -1;
 
-		rmsk_len = ERP_MAX_KEY_LEN;
-		res = eapol_sm_get_key(sm->eapol, rmsk, rmsk_len);
-		if (res == PMK_LEN) {
-			rmsk_len = PMK_LEN;
-			res = eapol_sm_get_key(sm->eapol, rmsk, rmsk_len);
-		}
+		res = eapol_sm_get_key(sm->eapol, sm->pmk, PMK_LEN);
 		if (res)
 			return -1;
 
-		res = fils_rmsk_to_pmk(sm->key_mgmt, rmsk, rmsk_len,
-				       sm->fils_nonce, sm->fils_anonce, NULL, 0,
-				       sm->pmk, &sm->pmk_len);
-		os_memset(rmsk, 0, sizeof(rmsk));
-
-		if (!sm->fils_erp_pmkid_set) {
-			wpa_printf(MSG_DEBUG, "FILS: PMKID not available");
-			return -1;
-		}
-		wpa_hexdump(MSG_DEBUG, "FILS: PMKID", sm->fils_erp_pmkid,
-			    PMKID_LEN);
 		wpa_printf(MSG_DEBUG, "FILS: ERP processing succeeded - add PMKSA cache entry for the result");
-		sm->cur_pmksa = pmksa_cache_add(sm->pmksa, sm->pmk, sm->pmk_len,
-						sm->fils_erp_pmkid, NULL, 0,
-						sm->bssid, sm->own_addr,
+		sm->cur_pmksa = pmksa_cache_add(sm->pmksa, sm->pmk, PMK_LEN,
+						NULL, NULL, 0, sm->bssid,
+						sm->own_addr,
 						sm->network_ctx, sm->key_mgmt);
 	}
 
@@ -3483,18 +3456,11 @@
 
 struct wpabuf * fils_build_assoc_req(struct wpa_sm *sm, const u8 **kek,
 				     size_t *kek_len, const u8 **snonce,
-				     const u8 **anonce,
-				     const struct wpabuf **hlp,
-				     unsigned int num_hlp)
+				     const u8 **anonce)
 {
 	struct wpabuf *buf;
-	size_t len;
-	unsigned int i;
 
-	len = 1000;
-	for (i = 0; hlp && i < num_hlp; i++)
-		len += 10 + wpabuf_len(hlp[i]);
-	buf = wpabuf_alloc(len);
+	buf = wpabuf_alloc(1000);
 	if (!buf)
 		return NULL;
 
@@ -3517,34 +3483,7 @@
 	wpabuf_put_u8(buf, WLAN_EID_EXT_FILS_KEY_CONFIRM);
 	wpabuf_put_data(buf, sm->fils_key_auth_sta, sm->fils_key_auth_len);
 
-	/* FILS HLP Container */
-	for (i = 0; hlp && i < num_hlp; i++) {
-		const u8 *pos = wpabuf_head(hlp[i]);
-		size_t left = wpabuf_len(hlp[i]);
-
-		wpabuf_put_u8(buf, WLAN_EID_EXTENSION); /* Element ID */
-		if (left <= 254)
-			len = 1 + left;
-		else
-			len = 255;
-		wpabuf_put_u8(buf, len); /* Length */
-		/* Element ID Extension */
-		wpabuf_put_u8(buf, WLAN_EID_EXT_FILS_HLP_CONTAINER);
-		/* Destination MAC Address, Source MAC Address, HLP Packet.
-		 * HLP Packet is in MSDU format (i.e., included the LLC/SNAP
-		 * header when LPD is used). */
-		wpabuf_put_data(buf, pos, len - 1);
-		pos += len - 1;
-		left -= len - 1;
-		while (left) {
-			wpabuf_put_u8(buf, WLAN_EID_FRAGMENT);
-			len = left > 255 ? 255 : left;
-			wpabuf_put_u8(buf, len);
-			wpabuf_put_data(buf, pos, len);
-			pos += len;
-			left -= len;
-		}
-	}
+	/* TODO: FILS HLP Container */
 
 	/* TODO: FILS IP Address Assignment */
 
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index f0eeec8..c9f278a 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -436,9 +436,7 @@
 int fils_process_auth(struct wpa_sm *sm, const u8 *data, size_t len);
 struct wpabuf * fils_build_assoc_req(struct wpa_sm *sm, const u8 **kek,
 				     size_t *kek_len, const u8 **snonce,
-				     const u8 **anonce,
-				     const struct wpabuf **hlp,
-				     unsigned int num_hlp);
+				     const u8 **anonce);
 int fils_process_assoc_resp(struct wpa_sm *sm, const u8 *resp, size_t len);
 int wpa_fils_is_completed(struct wpa_sm *sm);
 
diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h
index 491fc98..180d468 100644
--- a/src/rsn_supp/wpa_i.h
+++ b/src/rsn_supp/wpa_i.h
@@ -147,8 +147,6 @@
 	u8 fils_key_auth_sta[FILS_MAX_KEY_AUTH_LEN];
 	size_t fils_key_auth_len;
 	unsigned int fils_completed:1;
-	unsigned int fils_erp_pmkid_set:1;
-	u8 fils_erp_pmkid[PMKID_LEN];
 #endif /* CONFIG_FILS */
 };