Merge "Add skeleton implemention for USD interface in the mainline supplicant." into main
diff --git a/hostapd/Android.bp b/hostapd/Android.bp
index 4f76a30..5b08d3e 100644
--- a/hostapd/Android.bp
+++ b/hostapd/Android.bp
@@ -451,6 +451,9 @@
     }) + select(soong_config_variable("wpa_supplicant_8", "hostapd_11ax"), {
         true: ["-DCONFIG_IEEE80211AX"],
         default: [],
+    }) + select(soong_config_variable("wpa_supplicant_8", "hostapd_11be"), {
+        true: ["-DCONFIG_IEEE80211BE"],
+        default: [],
     }) + select(soong_config_variable("wpa_supplicant_8", "board_hostapd_config_80211w_mfp_optional"), {
         true: ["-DENABLE_HOSTAPD_CONFIG_80211W_MFP_OPTIONAL"],
         default: [],
@@ -602,6 +605,10 @@
     ] + select(soong_config_variable("wpa_supplicant_8", "hostapd_11ax"), {
         true: ["src/ap/ieee802_11_he.c"],
         default: [],
+    }) +
+    select(soong_config_variable("wpa_supplicant_8", "hostapd_11be"), {
+        true: ["src/ap/ieee802_11_eht.c"],
+        default: [],
     }),
     defaults: [
         "hostapd_driver_srcs_default",
diff --git a/hostapd/aidl/hostapd.cpp b/hostapd/aidl/hostapd.cpp
index 12d0d9e..0aab000 100644
--- a/hostapd/aidl/hostapd.cpp
+++ b/hostapd/aidl/hostapd.cpp
@@ -138,6 +138,12 @@
 int32_t aidl_client_version = 0;
 int32_t aidl_service_version = 0;
 
+inline std::array<uint8_t, ETH_ALEN> macAddrToArray(const uint8_t* mac_addr) {
+	std::array<uint8_t, ETH_ALEN> arr;
+	std::copy(mac_addr, mac_addr + ETH_ALEN, std::begin(arr));
+	return arr;
+}
+
 /**
  * Check that the AIDL service is running at least the expected version.
  * Use to avoid the case where the AIDL interface version
@@ -1279,7 +1285,7 @@
 				return hapd;
 		}
 	}
-#endif
+#endif /* CONFIG_IEEE80211BE */
 	return NULL;
 }
 
@@ -1374,7 +1380,7 @@
 						&& strlen(iface_hapd->conf->bridge) == 0) {
 					instanceName = std::to_string(iface_hapd->mld_link_id);
 				}
-#endif
+#endif /* CONFIG_IEEE80211BE */
 				for (const auto& callback : callbacks_) {
 					auto status = callback->onFailure(
 						strlen(iface_hapd->conf->bridge) > 0 ?
@@ -1403,7 +1409,7 @@
 				&& strlen(iface_hapd->conf->bridge) == 0) {
 			instanceName = std::to_string(iface_hapd->mld_link_id);
 		}
-#endif
+#endif /* CONFIG_IEEE80211BE */
 		info.apIfaceInstance = instanceName;
 		info.clientAddress.assign(mac_addr, mac_addr + ETH_ALEN);
 		info.isConnected = authorized;
@@ -1439,7 +1445,7 @@
 			if (iface_hapd->conf->mld_ap && strlen(iface_hapd->conf->bridge) == 0) {
 				instanceName = std::to_string(iface_hapd->mld_link_id);
 			}
-#endif
+#endif /* CONFIG_IEEE80211BE */
 			ApInfo info;
 			info.ifaceName = strlen(iface_hapd->conf->bridge) > 0 ?
 				iface_hapd->conf->bridge : iface_hapd->conf->iface,
@@ -1449,6 +1455,11 @@
 			info.generation = getGeneration(iface_hapd->iface->current_mode);
 			info.apIfaceInstanceMacAddress.assign(iface_hapd->own_addr,
 				iface_hapd->own_addr + ETH_ALEN);
+#ifdef CONFIG_IEEE80211BE
+			if (iface_hapd->conf->mld_ap) {
+				info.mldMacAddress = macAddrToArray(iface_hapd->mld->mld_addr);
+			}
+#endif /* CONFIG_IEEE80211BE */
 			for (const auto &callback : callbacks_) {
 				auto status = callback->onApInstanceInfoChanged(info);
 				if (!status.isOk()) {
@@ -1464,7 +1475,7 @@
 			if (iface_hapd->conf->mld_ap && strlen(iface_hapd->conf->bridge) == 0) {
 				instanceName = std::to_string(iface_hapd->mld_link_id);
 			}
-#endif
+#endif /* CONFIG_IEEE80211BE */
 			// Invoke the failure callback on all registered clients.
 			for (const auto& callback : callbacks_) {
 				auto status =
@@ -1589,6 +1600,7 @@
 ::ndk::ScopedAStatus Hostapd::removeLinkFromMultipleLinkBridgedApIfaceInternal(
 const std::string& iface_name, const std::string& linkIdentity)
 {
+#ifdef CONFIG_IEEE80211BE
 	if (!hostapd_get_iface(interfaces_, iface_name.c_str())) {
 		wpa_printf(MSG_ERROR, "Interface %s doesn't exist", iface_name.c_str());
 		return createStatus(HostapdStatusCode::FAILURE_IFACE_UNKNOWN);
@@ -1596,11 +1608,18 @@
 	struct hostapd_data* iface_hapd =
 		hostapd_get_iface_by_link_id(interfaces_, (size_t) linkIdentity.c_str());
 	if (iface_hapd) {
+// Currently, hostapd_link_remove is still under CONFIG_TESTING_OPTIONS.
+// TODO: b/340821197 - Make sure to take out the hostapd_link_remove() and other related code
+// out of CONFIG_TESTING_OPTIONS.
+#ifdef CONFIG_TESTING_OPTIONS
 		if (0 == hostapd_link_remove(iface_hapd, 1)) {
 			return ndk::ScopedAStatus::ok();
 		}
+#endif /* CONFIG_TESTING_OPTIONS */
 	}
 	return createStatus(HostapdStatusCode::FAILURE_ARGS_INVALID);
+#endif /* CONFIG_IEEE80211BE */
+	return createStatus(HostapdStatusCode::FAILURE_UNKNOWN);
 }
 
 }  // namespace hostapd
diff --git a/wpa_supplicant/Android.bp b/wpa_supplicant/Android.bp
index f66d45b..5361289 100644
--- a/wpa_supplicant/Android.bp
+++ b/wpa_supplicant/Android.bp
@@ -919,85 +919,28 @@
     cflags: [
         "-DANDROID_LIB_STUB",
         "-DANDROID_LOG_NAME=\"mainline_supplicant\"",
-        "-DCONFIG_ACS",
         "-DCONFIG_ANDROID_LOG",
-        "-DCONFIG_AP",
         "-DCONFIG_BACKEND_FILE",
         "-DCONFIG_CTRL_IFACE",
         "-DCONFIG_CTRL_IFACE_UNIX",
-        "-DCONFIG_DPP",
-        "-DCONFIG_DPP2",
         "-DCONFIG_DRIVER_NL80211",
-        "-DCONFIG_DRIVER_NL80211_QCA",
-        "-DCONFIG_ECC",
-        "-DCONFIG_ERP",
-        "-DCONFIG_FILS",
-        "-DCONFIG_GAS",
-        "-DCONFIG_GAS_SERVER",
-        "-DCONFIG_HMAC_SHA256_KDF",
-        "-DCONFIG_HMAC_SHA384_KDF",
-        "-DCONFIG_HMAC_SHA512_KDF",
-        "-DCONFIG_HS20",
-        "-DCONFIG_IEEE80211AC",
-        "-DCONFIG_IEEE80211R",
-        "-DCONFIG_INTERWORKING",
-        "-DCONFIG_IPV6",
-        "-DCONFIG_JSON",
-        "-DCONFIG_MBO",
         "-DCONFIG_NO_ACCOUNTING",
-        "-DCONFIG_NO_RADIUS",
+        "-DCONFIG_NO_CONFIG_BLOBS",
+        "-DCONFIG_NO_CONFIG_WRITE",
         "-DCONFIG_NO_RADIUS",
         "-DCONFIG_NO_RANDOM_POOL",
         "-DCONFIG_NO_ROAMING",
+        "-DCONFIG_NO_ROBUST_AV",
+        "-DCONFIG_NO_RRM",
+        "-DCONFIG_NO_SCAN_PROCESSING",
+        "-DCONFIG_NO_TKIP",
         "-DCONFIG_NO_VLAN",
+        "-DCONFIG_NO_WMM_AC",
+        "-DCONFIG_NO_WPA",
+        "-DCONFIG_NO_WPA_PASSPHRASE",
         "-DCONFIG_OFFCHANNEL",
-        "-DCONFIG_OWE",
-        "-DCONFIG_P2P",
-        "-DCONFIG_PASN",
-        "-DCONFIG_PTKSA_CACHE",
-        "-DCONFIG_SAE",
-        "-DCONFIG_SAE_PK",
-        "-DCONFIG_SHA256",
-        "-DCONFIG_SHA384",
-        "-DCONFIG_SHA512",
-        "-DCONFIG_SMARTCARD",
-        "-DCONFIG_SME",
-        "-DCONFIG_SUITEB",
-        "-DCONFIG_SUITEB192",
-        "-DCONFIG_TDLS",
-        "-DCONFIG_WEP",
-        "-DCONFIG_WIFI_DISPLAY",
-        "-DCONFIG_WNM",
-        "-DCONFIG_WPS",
-        "-DCONFIG_WPS_ER",
-        "-DCONFIG_WPS_NFC",
-        "-DCONFIG_WPS_OOB",
-        "-DCONFIG_WPS_UPNP",
-        "-DCRYPTO_RSA_OAEP_SHA256",
-        "-DEAP_AKA",
-        "-DEAP_AKA_PRIME",
-        "-DEAP_GTC",
-        "-DEAP_LEAP",
-        "-DEAP_MD5",
-        "-DEAP_MSCHAPv2",
-        "-DEAP_OTP",
-        "-DEAP_PEAP",
-        "-DEAP_PWD",
-        "-DEAP_SERVER",
-        "-DEAP_SERVER_IDENTITY",
-        "-DEAP_SERVER_WSC",
-        "-DEAP_SIM",
-        "-DEAP_TLS",
-        "-DEAP_TLSV1_3",
-        "-DEAP_TLS_OPENSSL",
-        "-DEAP_TTLS",
-        "-DEAP_WSC",
-        "-DIEEE8021X_EAPOL",
         "-DMAINLINE_SUPPLICANT",
-        "-DNEED_AP_MLME",
         "-DOPENSSL_NO_ENGINE",
-        "-DPKCS12_FUNCS",
-        "-DTLS_DEFAULT_CIPHERS=\"DEFAULT:!EXP:!LOW\"",
         "-DWPA_IGNORE_CONFIG_ERRORS",
         "-Wall",
         "-Werror",
@@ -1010,22 +953,7 @@
         "-Wno-unused-function",
         "-Wno-unused-parameter",
         "-Wno-unused-variable",
-    ] + select(soong_config_variable("wpa_supplicant_8", "wpa_supplicant_use_stub_lib"), {
-        true: ["-DANDROID_LIB_STUB"],
-        default: [],
-    }) + select(soong_config_variable("wpa_supplicant_8", "board_hostapd_config_80211w_mfp_optional"), {
-        true: ["-DENABLE_HOSTAPD_CONFIG_80211W_MFP_OPTIONAL"],
-        default: [],
-    }) + select(soong_config_variable("wpa_supplicant_8", "wifi_priv_cmd_update_mbo_cell_status"), {
-        true: ["-DENABLE_PRIV_CMD_UPDATE_MBO_CELL_STATUS"],
-        default: [],
-    }) + select(soong_config_variable("wpa_supplicant_8", "hostapd_11ax"), {
-        true: ["-DCONFIG_IEEE80211AX"],
-        default: [],
-    }) + select(soong_config_variable("wpa_supplicant_8", "wifi_brcm_open_source_multi_akm"), {
-        true: ["-DWIFI_BRCM_OPEN_SOURCE_MULTI_AKM"],
-        default: [],
-    }),
+    ],
 }
 
 cc_defaults {
@@ -1238,6 +1166,62 @@
     ],
 }
 
+cc_defaults {
+    name: "wpa_supplicant_mainline_srcs_default",
+    srcs: [
+        "bss.c",
+        "bssid_ignore.c",
+        "config.c",
+        "config_file.c",
+        "ctrl_iface.c",
+        "ctrl_iface_unix.c",
+        "eap_register.c",
+        "events.c",
+        "main.c",
+        "notify.c",
+        "offchannel.c",
+        "op_classes.c",
+        "rrm.c",
+        "scan.c",
+        "wpa_supplicant.c",
+        "wpas_glue.c",
+        "src/common/ctrl_iface_common.c",
+        "src/common/hw_features_common.c",
+        "src/common/ieee802_11_common.c",
+        "src/common/ptksa_cache.c",
+        "src/common/wpa_common.c",
+        "src/crypto/crypto_openssl.c",
+        "src/crypto/tls_none.c",
+        "src/drivers/driver_common.c",
+        "src/drivers/driver_nl80211.c",
+        "src/drivers/driver_nl80211_android.c",
+        "src/drivers/driver_nl80211_capa.c",
+        "src/drivers/driver_nl80211_event.c",
+        "src/drivers/driver_nl80211_monitor.c",
+        "src/drivers/driver_nl80211_scan.c",
+        "src/drivers/drivers.c",
+        "src/drivers/linux_ioctl.c",
+        "src/drivers/netlink.c",
+        "src/drivers/rfkill.c",
+        "src/l2_packet/l2_packet_linux.c",
+        "src/rsn_supp/pmksa_cache.c",
+        "src/utils/base64.c",
+        "src/utils/bitfield.c",
+        "src/utils/common.c",
+        "src/utils/config.c",
+        "src/utils/crc32.c",
+        "src/utils/eloop.c",
+        "src/utils/ip_addr.c",
+        "src/utils/os_unix.c",
+        "src/utils/radiotap.c",
+        "src/utils/wpa_debug.c",
+        "src/utils/wpabuf.c",
+    ],
+    defaults: [
+        "wpa_supplicant_driver_srcs_default",
+    ],
+}
+
 cc_binary {
     name: "wpa_cli",
     proprietary: true,
@@ -1390,7 +1374,7 @@
         "mainline_supplicant_aidl_bp",
     ],
     defaults: [
-        "wpa_supplicant_srcs_default",
+        "wpa_supplicant_mainline_srcs_default",
         "wpa_supplicant_includes_default",
         "wpa_supplicant_mainline_cflags_default",
     ],
@@ -1430,7 +1414,7 @@
         "service_fuzzer_defaults",
         "wpa_supplicant_includes_default",
         "wpa_supplicant_mainline_cflags_default",
-        "wpa_supplicant_srcs_default",
+        "wpa_supplicant_mainline_srcs_default",
     ],
     shared_libs: [
         "android.system.wifi.mainline_supplicant-ndk",
diff --git a/wpa_supplicant/aidl/vendor/aidl.h b/wpa_supplicant/aidl/vendor/aidl.h
index eb1426a..71620f4 100644
--- a/wpa_supplicant/aidl/vendor/aidl.h
+++ b/wpa_supplicant/aidl/vendor/aidl.h
@@ -110,8 +110,10 @@
 	void wpas_aidl_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
 		struct wpa_ssid *ssid, bool conn_status_requested);
 	void wpas_aidl_notify_dpp_config_sent(struct wpa_supplicant *wpa_s);
+#ifdef CONFIG_DPP
 	void wpas_aidl_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s,
 		enum dpp_status_error result);
+#endif /* CONFIG_DPP */
 	void wpas_aidl_notify_dpp_auth_success(struct wpa_supplicant *wpa_s);
 	void wpas_aidl_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s);
 	void wpas_aidl_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s);
@@ -124,9 +126,11 @@
 	void wpas_aidl_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s);
 	void wpas_aidl_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s);
 	void wpas_aidl_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s);
+#ifdef CONFIG_DPP
 	void wpas_aidl_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
 		enum dpp_status_error status, const char *ssid,
 		const char *channel_list, unsigned short band_list[], int size);
+#endif /* CONFIG_DPP */
 	void wpas_aidl_notify_pmk_cache_added(
 		struct wpa_supplicant *wpas, struct rsn_pmksa_cache_entry *pmksa_entry);
 	void wpas_aidl_notify_bss_tm_status(struct wpa_supplicant *wpa_s);
@@ -274,9 +278,11 @@
 {}
 static void wpas_aidl_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
 {}
+#ifdef CONFIG_DPP
 static void wpas_aidl_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s,
 	enum dpp_status_error result)
 {}
+#endif /* CONFIG_DPP */
 static void wpas_aidl_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
 {}
 static void wpas_aidl_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s)
@@ -301,10 +307,12 @@
 {}
 static void wpas_aidl_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s)
 {}
+#ifdef CONFIG_DPP
 static void wpas_aidl_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
 			enum dpp_status_error status, const char *ssid,
 			const char *channel_list, unsigned short band_list[], int size)
 {}
+#endif /* CONFIG_DPP */
 static void wpas_aidl_notify_pmk_cache_added(struct wpa_supplicant *wpas,
 						 struct rsn_pmksa_cache_entry *pmksa_entry)
 {}
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 6dba468..a8fc962 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -8674,6 +8674,7 @@
 	int ret;
 
 	ret = wpa_drv_driver_cmd(wpa_s, cmd, buf, buflen);
+#ifdef CONFIG_P2P
 	if (ret == 0) {
 		if (os_strncasecmp(cmd, "COUNTRY", 7) == 0) {
 			struct p2p_data *p2p = wpa_s->global->p2p;
@@ -8689,6 +8690,7 @@
 		if (os_snprintf_error(buflen, ret))
 			ret = -1;
 	}
+#endif /* CONFIG_P2P */
 	return ret;
 }
 #endif /* ANDROID */
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 3e6f88d..2a665d7 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -3430,7 +3430,10 @@
 static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
 					  union wpa_event_data *data)
 {
-	int l, len, found = 0, found_x = 0, wpa_found, rsn_found;
+	int l, len, found = 0, wpa_found, rsn_found;
+#ifndef CONFIG_NO_WPA
+	int found_x = 0;
+#endif /* CONFIG_NO_WPA */
 	const u8 *p, *ie;
 	u8 bssid[ETH_ALEN];
 	bool bssid_known;
@@ -3566,18 +3569,22 @@
 			wpa_find_assoc_pmkid(wpa_s,
 					     data->assoc_info.authorized);
 		}
+#ifndef CONFIG_NO_WPA
 		if (!found_x && p[0] == WLAN_EID_RSNX) {
 			if (wpa_sm_set_assoc_rsnxe(wpa_s->wpa, p, len))
 				break;
 			found_x = 1;
 		}
+#endif /* CONFIG_NO_WPA */
 		l -= len;
 		p += len;
 	}
 	if (!found && data->assoc_info.req_ies)
 		wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0);
+#ifndef CONFIG_NO_WPA
 	if (!found_x && data->assoc_info.req_ies)
 		wpa_sm_set_assoc_rsnxe(wpa_s->wpa, NULL, 0);
+#endif /* CONFIG_NO_WPA */
 
 #if defined(CONFIG_DRIVER_NL80211_BRCM) || defined(CONFIG_DRIVER_NL80211_SYNA)
 	/* The WPA/RSN IE has been updated at this point. Since the Firmware could have roamed
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 1fb2628..2dc68b0 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -1222,6 +1222,7 @@
 #endif /* CONFIG_DPP */
 }
 
+#ifdef CONFIG_DPP
 void wpas_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s,
 	    enum dpp_status_error result)
 {
@@ -1232,6 +1233,7 @@
 	wpas_aidl_notify_dpp_connection_status_sent(wpa_s, result);
 #endif /* CONFIG_DPP2 */
 }
+#endif /* CONFIG_DPP */
 
 /* DPP Progress notifications */
 void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
@@ -1329,6 +1331,7 @@
 #endif /* CONFIG_DPP2 */
 }
 
+#ifdef CONFIG_DPP
 void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
 		enum dpp_status_error status, const char *ssid,
 		const char *channel_list, unsigned short band_list[], int size)
@@ -1337,6 +1340,7 @@
 	wpas_aidl_notify_dpp_conn_status(wpa_s, status, ssid, channel_list, band_list, size);
 #endif /* CONFIG_DPP2 */
 }
+#endif /* CONFIG_DPP */
 
 void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s)
 {
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index 85326da..4e172de 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -190,8 +190,10 @@
 void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
 		struct wpa_ssid *ssid, bool conn_status_requested);
 void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s);
+#ifdef CONFIG_DPP
 void wpas_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s,
 		enum dpp_status_error result);
+#endif /* CONFIG_DPP */
 void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s);
 void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s);
 void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s);
@@ -201,9 +203,11 @@
 void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s);
 void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s);
 void wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s);
+#ifdef CONFIG_DPP
 void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
 		enum dpp_status_error status, const char *ssid,
 		const char *channel_list, unsigned short band_list[], int size);
+#endif /* CONFIG_DPP */
 void wpas_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s);
 void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s);
 void wpas_notify_transition_disable(struct wpa_supplicant *wpa_s,
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 982ff6c..e3ed858 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -422,7 +422,9 @@
 	wpa_sm_set_ap_rsne_override_2(wpa_s->wpa, NULL, 0);
 	wpa_sm_set_ap_rsnxe_override(wpa_s->wpa, NULL, 0);
 	wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0);
+#ifndef CONFIG_NO_WPA
 	wpa_sm_set_assoc_rsnxe(wpa_s->wpa, NULL, 0);
+#endif /* CONFIG_NO_WPA */
 	wpa_s->rsnxe_len = 0;
 	wpa_s->pairwise_cipher = WPA_CIPHER_NONE;
 	wpa_s->group_cipher = WPA_CIPHER_NONE;
@@ -2167,6 +2169,7 @@
 			return -1;
 		}
 
+#ifndef CONFIG_NO_WPA
 		wpa_s->rsnxe_len = sizeof(wpa_s->rsnxe);
 		if (wpa_sm_set_assoc_rsnxe_default(wpa_s->wpa, wpa_s->rsnxe,
 						   &wpa_s->rsnxe_len)) {
@@ -2174,6 +2177,7 @@
 				"RSN: Failed to generate RSNXE");
 			return -1;
 		}
+#endif /* CONFIG_NO_WPA */
 	}
 
 	if (0) {
@@ -4296,7 +4300,9 @@
 	/* Starting new association, so clear the possibly used WPA IE from the
 	 * previous association. */
 	wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0);
+#ifndef CONFIG_NO_WPA
 	wpa_sm_set_assoc_rsnxe(wpa_s->wpa, NULL, 0);
+#endif /* CONFIG_NO_WPA */
 	wpa_s->rsnxe_len = 0;
 #ifndef CONFIG_NO_ROBUST_AV
 	wpa_s->mscs_setup_done = false;
@@ -4768,8 +4774,10 @@
 	}
 
 	wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);
+#ifndef CONFIG_NO_WPA
 	if (bss)
 		wpa_sm_set_ssid(wpa_s->wpa, bss->ssid, bss->ssid_len);
+#endif /* CONFIG_NO_WPA */
 	wpa_supplicant_initiate_eapol(wpa_s);
 	if (old_ssid != wpa_s->current_ssid)
 		wpas_notify_network_changed(wpa_s);
@@ -7524,9 +7532,11 @@
 #ifdef CONFIG_PASN
 	wpa_pasn_sm_set_caps(wpa_s->wpa, wpa_s->drv_flags2);
 #endif /* CONFIG_PASN */
+#ifndef CONFIG_NO_WPA
 	wpa_sm_set_driver_bss_selection(wpa_s->wpa,
 					!!(wpa_s->drv_flags &
 					   WPA_DRIVER_FLAGS_BSS_SELECTION));
+#endif /* CONFIG_NO_WPA */
 	if (wpa_s->max_remain_on_chan == 0)
 		wpa_s->max_remain_on_chan = 1000;