[PATCH 2/2] wpa_supplicant: Fix CONFIG_NO_WPA stub declarations

Chaitanya Tata chaitanya.mgit at gmail.com
Thu Sep 10 12:43:07 PDT 2026


The CONFIG_NO_WPA build compiles out src/rsn_supp/wpa.c and relies
entirely on the static inline stubs in the #else branch of wpa.h.
That branch has fallen out of sync with the real API in a few
places:

- wpa_sm_set_ptk_kck_kek()'s stub kept the pre-existing signature
  (missing the hash parameter that was added to the real
  declaration), causing an incompatible-pointer-types/int-conversion
  build error at its events.c call site.
- wpa_sm_get_pmksa_cache(), wpa_sm_set_cur_pmksa(),
  wpa_sm_get_auth_addr(), wpa_sm_known_sta_identification(),
  wpa_sm_install_mlo_group_keys(), wpa_sm_pmksa_privacy_supported()
  and wpa_sm_get_pmk() are all declared unconditionally and are
  called from sme.c/events.c regardless of CONFIG_NO_WPA, but have no
  CONFIG_NO_WPA stub, causing undefined references when wpa.c is not
  built.

Move all of these under the #ifndef CONFIG_NO_WPA / #else split and
add matching no-op stubs. Verified that wpa_supplicant now builds
with CONFIG_NO_WPA=y (it previously failed with the errors above).

Signed-off-by: Chaitanya Tata <Chaitanya.Tata at nordicsemi.no>
---
 src/rsn_supp/wpa.h | 66 ++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 55 insertions(+), 11 deletions(-)

diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index bcb2c93ce..68be29fcd 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -299,6 +299,17 @@ int wpa_sm_set_mlo_params(struct wpa_sm *sm, const struct wpa_sm_mlo *mlo);
 void wpa_sm_set_driver_bss_selection(struct wpa_sm *sm,
 				     bool driver_bss_selection);
 bool wpa_sm_uses_spp_amsdu(struct wpa_sm *sm);
+struct rsn_pmksa_cache * wpa_sm_get_pmksa_cache(struct wpa_sm *sm);
+void wpa_sm_set_cur_pmksa(struct wpa_sm *sm,
+			  struct rsn_pmksa_cache_entry *entry);
+const u8 * wpa_sm_get_auth_addr(struct wpa_sm *sm);
+struct wpabuf * wpa_sm_known_sta_identification(struct wpa_sm *sm, const u8 *aa,
+						u64 timestamp);
+int wpa_sm_install_mlo_group_keys(struct wpa_sm *sm, const u8 *key_data,
+				  size_t key_data_len, u16 added_links_bitmap);
+bool wpa_sm_pmksa_privacy_supported(struct wpa_sm *sm);
+const u8 * wpa_sm_get_pmk(struct wpa_sm *sm, const u8 *addr, const u8 *pmkid,
+			  size_t *pmk_len);
 
 #else /* CONFIG_NO_WPA */
 
@@ -545,7 +556,9 @@ static inline void wpa_sm_set_rx_replay_ctr(struct wpa_sm *sm,
 {
 }
 
-static inline void wpa_sm_set_ptk_kck_kek(struct wpa_sm *sm, const u8 *ptk_kck,
+static inline void wpa_sm_set_ptk_kck_kek(struct wpa_sm *sm,
+					  enum rsn_hash_alg hash,
+					  const u8 *ptk_kck,
 					  size_t ptk_kck_len,
 					  const u8 *ptk_kek, size_t ptk_kek_len)
 {
@@ -586,6 +599,47 @@ static inline bool wpa_sm_uses_spp_amsdu(struct wpa_sm *sm)
 	return false;
 }
 
+static inline struct rsn_pmksa_cache * wpa_sm_get_pmksa_cache(struct wpa_sm *sm)
+{
+	return NULL;
+}
+
+static inline void wpa_sm_set_cur_pmksa(struct wpa_sm *sm,
+					struct rsn_pmksa_cache_entry *entry)
+{
+}
+
+static inline const u8 * wpa_sm_get_auth_addr(struct wpa_sm *sm)
+{
+	return NULL;
+}
+
+static inline struct wpabuf *
+wpa_sm_known_sta_identification(struct wpa_sm *sm, const u8 *aa,
+				u64 timestamp)
+{
+	return NULL;
+}
+
+static inline int wpa_sm_install_mlo_group_keys(struct wpa_sm *sm,
+						 const u8 *key_data,
+						 size_t key_data_len,
+						 u16 added_links_bitmap)
+{
+	return -1;
+}
+
+static inline bool wpa_sm_pmksa_privacy_supported(struct wpa_sm *sm)
+{
+	return false;
+}
+
+static inline const u8 * wpa_sm_get_pmk(struct wpa_sm *sm, const u8 *addr,
+					const u8 *pmkid, size_t *pmk_len)
+{
+	return NULL;
+}
+
 #endif /* CONFIG_NO_WPA */
 
 #ifdef CONFIG_IEEE80211R
@@ -724,16 +778,6 @@ void wpa_sm_set_reset_fils_completed(struct wpa_sm *sm, int set);
 void wpa_sm_set_fils_cache_id(struct wpa_sm *sm, const u8 *fils_cache_id);
 void wpa_sm_set_dpp_z(struct wpa_sm *sm, const struct wpabuf *z);
 void wpa_pasn_sm_set_caps(struct wpa_sm *sm, unsigned int flags2);
-struct rsn_pmksa_cache * wpa_sm_get_pmksa_cache(struct wpa_sm *sm);
-
-void wpa_sm_set_cur_pmksa(struct wpa_sm *sm,
-			  struct rsn_pmksa_cache_entry *entry);
-const u8 * wpa_sm_get_auth_addr(struct wpa_sm *sm);
-struct wpabuf * wpa_sm_known_sta_identification(struct wpa_sm *sm, const u8 *aa,
-						u64 timestamp);
-int wpa_sm_install_mlo_group_keys(struct wpa_sm *sm, const u8 *key_data,
-				  size_t key_data_len, u16 added_links_bitmap);
-bool wpa_sm_pmksa_privacy_supported(struct wpa_sm *sm);
 
 void wpa_sm_set_802_1x_auth_caps(struct wpa_sm *sm, u64 flags2);
 
-- 
2.43.0




More information about the Hostap mailing list