From 001ac3976ad77d446fa21b49d5aac1d5f73d4247 Mon Sep 17 00:00:00 2001 From: Maochen Wang Date: Wed, 22 May 2024 12:11:34 +0800 Subject: [PATCH] modules: hostap: fix hostap compile error and support enterprise Fix compile error when enable enterprise security mode. Signed-off-by: Maochen Wang --- include/zephyr/net/ethernet.h | 3 ++ include/zephyr/net/wifi_mgmt.h | 2 +- modules/hostap/CMakeLists.txt | 50 +++++++++++++++++++++++----------- modules/hostap/Kconfig | 7 +++++ modules/hostap/src/wpa_cli.c | 2 +- 5 files changed, 46 insertions(+), 18 deletions(-) diff --git a/include/zephyr/net/ethernet.h b/include/zephyr/net/ethernet.h index 5918f5ddf82..be9ed7cea29 100644 --- a/include/zephyr/net/ethernet.h +++ b/include/zephyr/net/ethernet.h @@ -92,6 +92,9 @@ struct net_eth_addr { #if !defined(ETH_P_ECAT) #define ETH_P_ECAT NET_ETH_PTYPE_ECAT #endif +#if !defined(ETH_P_EAPOL) +#define ETH_P_EAPOL NET_ETH_PTYPE_EAPOL +#endif #if !defined(ETH_P_IEEE802154) #define ETH_P_IEEE802154 NET_ETH_PTYPE_IEEE802154 #endif diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 616541776e0..3c385994b3b 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -971,7 +971,7 @@ struct net_wifi_mgmt_offload { #if defined(CONFIG_WIFI_NM_WPA_SUPPLICANT) || defined(__DOXYGEN__) /** Wi-Fi supplicant driver API */ - void *wifi_drv_ops; + const void *wifi_drv_ops; #endif }; diff --git a/modules/hostap/CMakeLists.txt b/modules/hostap/CMakeLists.txt index a7e3aa334bd..543f13506fe 100644 --- a/modules/hostap/CMakeLists.txt +++ b/modules/hostap/CMakeLists.txt @@ -16,9 +16,19 @@ set(CMAKE_EXE_LINKER_FLAGS "--specs=nosys.specs -lnosys") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMISSING_SYSCALL_NAMES") zephyr_include_directories( + src/ ${HOSTAP_BASE}/ ${WIFI_NM_WPA_SUPPLICANT_BASE}/ ${HOSTAP_SRC_BASE}/ + ${HOSTAP_SRC_BASE}/utils/ + ${HOSTAP_SRC_BASE}/common/ + ${HOSTAP_SRC_BASE}/eap_common + ${HOSTAP_SRC_BASE}/eap_server + ${HOSTAP_SRC_BASE}/radius + ${HOSTAP_SRC_BASE}/crypto/ + ${HOSTAP_SRC_BASE}/ap/ + ${HOSTAP_SRC_BASE}/drivers/ + ${HOSTAP_SRC_BASE}/rsn_supp ) zephyr_library_compile_definitions( @@ -28,6 +38,8 @@ zephyr_library_compile_definitions( CONFIG_CTRL_IFACE CONFIG_NO_RANDOM_POOL CONFIG_SHA256 + CONFIG_SHA384 + CONFIG_SHA512 CONFIG_CTRL_IFACE_ZEPHYR CONFIG_SUITEB192 ) @@ -88,6 +100,7 @@ zephyr_library_sources( ${HOSTAP_SRC_BASE}/drivers/driver_common.c ${HOSTAP_SRC_BASE}/drivers/drivers.c + ${HOSTAP_SRC_BASE}/utils/crc32.c ${HOSTAP_SRC_BASE}/utils/base64.c ${HOSTAP_SRC_BASE}/utils/common.c ${HOSTAP_SRC_BASE}/utils/wpabuf.c @@ -154,6 +167,7 @@ zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_AP ${HOSTAP_SRC_BASE}/ap/bss_load.c ${HOSTAP_SRC_BASE}/ap/dfs.c ${HOSTAP_SRC_BASE}/ap/drv_callbacks.c + ${HOSTAP_SRC_BASE}/ap/ctrl_iface_ap.c ${HOSTAP_SRC_BASE}/ap/eap_user_db.c ${HOSTAP_SRC_BASE}/ap/hostapd.c ${HOSTAP_SRC_BASE}/ap/hw_features.c @@ -333,21 +347,25 @@ zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE ) zephyr_library_compile_definitions_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - CONFIG_EAP_TLS - CONFIG_IEEE8021X_EAPOL - CONFIG_EAP_PEAP - CONFIG_EAP_TTLS - CONFIG_EAP_MD5 - CONFIG_EAP_MSCHAPv2 - CONFIG_EAP_LEAP - CONFIG_EAP_PSK - CONFIG_EAP_FAST - CONFIG_EAP_PAX - CONFIG_EAP_SAKE - CONFIG_EAP_GPSK - CONFIG_EAP_PWD - CONFIG_EAP_EKE - CONFIG_EAP_IKEv2 + EAP_TLS + IEEE8021X_EAPOL + EAP_PEAP + EAP_TTLS + EAP_MD5 + EAP_MSCHAPv2 + EAP_LEAP + EAP_PSK + EAP_FAST + EAP_PAX + EAP_SAKE + EAP_GPSK + EAP_PWD + EAP_EKE + EAP_IKEv2 +) + +zephyr_library_compile_definitions_ifndef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE + CONFIG_NO_CONFIG_BLOBS ) zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_EAPOL @@ -359,7 +377,7 @@ zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_EAPOL ) zephyr_library_compile_definitions_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_EAPOL - CONFIG_IEEE8021X_EAPOL + IEEE8021X_EAPOL ) zephyr_library_compile_definitions_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_NW_SEL_RELIABILITY diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index f90ab2c0b88..e935b4b642a 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -10,6 +10,7 @@ config WIFI_NM_WPA_SUPPLICANT select POSIX_TIMERS select POSIX_SIGNALS select POSIX_API + select FILE_SYSTEM select NET_SOCKETS select NET_SOCKETS_PACKET select NET_SOCKETPAIR @@ -372,6 +373,12 @@ config SAE config SHA256 bool +config SHA384 + bool + +config SHA512 + bool + config SUITEB192 bool diff --git a/modules/hostap/src/wpa_cli.c b/modules/hostap/src/wpa_cli.c index cbd66b1279d..1ea6be54a5d 100644 --- a/modules/hostap/src/wpa_cli.c +++ b/modules/hostap/src/wpa_cli.c @@ -29,7 +29,7 @@ static int cmd_wpa_cli(const struct shell *sh, argc++; /* Remove wpa_cli from the argument list */ - return z_wpa_ctrl_zephyr_cmd(argc - 1, &argv[1]); + return zephyr_wpa_ctrl_zephyr_cmd(argc - 1, &argv[1]); } /* Persisting with "wpa_cli" naming for compatibility with Wi-Fi