Skip to content

Commit 5272369

Browse files
sr1dh48rkrishna T
authored andcommitted
hostap: Add support for Zephyr RTOS (#1)
Modifications for building supplicant on Zephyr RTOS. Signed-off-by: Sridhar Nuvusetty <[email protected]> Signed-off-by: Sachin Kulkarni <[email protected]> Signed-off-by: Ravi Dondaputi <[email protected]> Signed-off-by: Krishna T <[email protected]> Co-authored-by: krishna T <[email protected]>
1 parent 7b6d763 commit 5272369

File tree

4 files changed

+567
-0
lines changed

4 files changed

+567
-0
lines changed

modules/hostap/CMakeLists.txt

Lines changed: 325 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,325 @@
1+
#
2+
# Copyright (c) 2022 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
if(CONFIG_WPA_SUPP)
8+
9+
zephyr_library()
10+
11+
set(HOSTAP_BASE ${CMAKE_CURRENT_SOURCE_DIR}/../)
12+
set(WPA_SUPPLICANT_BASE ${HOSTAP_BASE}/wpa_supplicant)
13+
set(COMMON_SRC_BASE ${HOSTAP_BASE}/src)
14+
15+
set(CMAKE_EXE_LINKER_FLAGS "--specs=nosys.specs -lnosys")
16+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMISSING_SYSCALL_NAMES")
17+
18+
zephyr_compile_definitions(
19+
CONFIG_ZEPHYR
20+
)
21+
22+
zephyr_include_directories(
23+
${CMAKE_CURRENT_SOURCE_DIR}/
24+
${WPA_SUPPLICANT_BASE}/
25+
${COMMON_SRC_BASE}/
26+
)
27+
28+
zephyr_library_compile_definitions(
29+
TLS_DEFAULT_CIPHERS=\""DEFAULT:!EXP:!LOW"\"
30+
CONFIG_SHA256
31+
CONFIG_SME
32+
CONFIG_NO_CONFIG_WRITE
33+
CONFIG_NO_CONFIG_BLOBS
34+
CONFIG_WPA_S_ZEPHYR_L2_WIFI_MGMT
35+
#CONFIG_NO_STDOUT_DEBUG
36+
CONFIG_CTRL_IFACE
37+
CONFIG_CTRL_IFACE_UDP
38+
CONFIG_NO_RANDOM_POOL
39+
)
40+
41+
zephyr_library_include_directories(
42+
${HOSTAP_BASE}/
43+
${COMMON_SRC_BASE}/utils
44+
${COMMON_SRC_BASE}/drivers
45+
${HOSTAP_BASE}/src
46+
${ZEPHYR_BASE}/include
47+
${ZEPHYR_BASE}/include/net
48+
)
49+
50+
zephyr_library_sources(
51+
${COMMON_SRC_BASE}/common/wpa_common.c
52+
${COMMON_SRC_BASE}/common/ieee802_11_common.c
53+
${COMMON_SRC_BASE}/common/hw_features_common.c
54+
${COMMON_SRC_BASE}/common/wpa_ctrl.c
55+
${COMMON_SRC_BASE}/common/cli.c
56+
57+
${COMMON_SRC_BASE}/drivers/driver_common.c
58+
${COMMON_SRC_BASE}/drivers/drivers.c
59+
${COMMON_SRC_BASE}/l2_packet/l2_packet_zephyr.c
60+
${COMMON_SRC_BASE}/drivers/driver_zephyr.c
61+
${COMMON_SRC_BASE}/utils/base64.c
62+
${COMMON_SRC_BASE}/utils/common.c
63+
${COMMON_SRC_BASE}/utils/wpa_debug.c
64+
${COMMON_SRC_BASE}/utils/wpabuf.c
65+
${COMMON_SRC_BASE}/utils/bitfield.c
66+
${COMMON_SRC_BASE}/utils/eloop.c
67+
${COMMON_SRC_BASE}/utils/os_zephyr.c
68+
${COMMON_SRC_BASE}/utils/radiotap.c
69+
#${COMMON_SRC_BASE}/utils/edit_simple.c
70+
${WPA_SUPPLICANT_BASE}/config.c
71+
${WPA_SUPPLICANT_BASE}/notify.c
72+
${WPA_SUPPLICANT_BASE}/bss.c
73+
${WPA_SUPPLICANT_BASE}/eap_register.c
74+
${WPA_SUPPLICANT_BASE}/op_classes.c
75+
${WPA_SUPPLICANT_BASE}/rrm.c
76+
${WPA_SUPPLICANT_BASE}/wmm_ac.c
77+
${WPA_SUPPLICANT_BASE}/config_none.c
78+
${WPA_SUPPLICANT_BASE}/sme.c
79+
${WPA_SUPPLICANT_BASE}/wpa_supplicant.c
80+
${WPA_SUPPLICANT_BASE}/events.c
81+
${WPA_SUPPLICANT_BASE}/bssid_ignore.c
82+
${WPA_SUPPLICANT_BASE}/wpas_glue.c
83+
${WPA_SUPPLICANT_BASE}/scan.c
84+
${WPA_SUPPLICANT_BASE}/robust_av.c
85+
${WPA_SUPPLICANT_BASE}/ctrl_iface.c
86+
${WPA_SUPPLICANT_BASE}/ctrl_iface_udp.c
87+
${WPA_SUPPLICANT_BASE}/wpa_cli.c
88+
# Zephyr main
89+
src/supp_main.c
90+
)
91+
zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_AP
92+
${WPA_SUPPLICANT_BASE}/ap.c
93+
${COMMON_SRC_BASE}/ap/ap_config.c
94+
${COMMON_SRC_BASE}/ap/ap_drv_ops.c
95+
${COMMON_SRC_BASE}/ap/ap_list.c
96+
${COMMON_SRC_BASE}/ap/ap_mlme.c
97+
${COMMON_SRC_BASE}/ap/authsrv.c
98+
${COMMON_SRC_BASE}/ap/beacon.c
99+
${COMMON_SRC_BASE}/ap/bss_load.c
100+
${COMMON_SRC_BASE}/ap/dfs.c
101+
${COMMON_SRC_BASE}/ap/drv_callbacks.c
102+
${COMMON_SRC_BASE}/ap/eap_user_db.c
103+
${COMMON_SRC_BASE}/ap/hostapd.c
104+
${COMMON_SRC_BASE}/ap/hw_features.c
105+
${COMMON_SRC_BASE}/ap/ieee802_11_auth.c
106+
${COMMON_SRC_BASE}/ap/ieee802_11.c
107+
${COMMON_SRC_BASE}/ap/ieee802_11_he.c
108+
${COMMON_SRC_BASE}/ap/ieee802_11_ht.c
109+
${COMMON_SRC_BASE}/ap/ieee802_11_shared.c
110+
${COMMON_SRC_BASE}/ap/ieee802_11_vht.c
111+
${COMMON_SRC_BASE}/ap/ieee802_1x.c
112+
${COMMON_SRC_BASE}/ap/neighbor_db.c
113+
${COMMON_SRC_BASE}/ap/p2p_hostapd.c
114+
${COMMON_SRC_BASE}/ap/pmksa_cache_auth.c
115+
${COMMON_SRC_BASE}/ap/preauth_auth.c
116+
${COMMON_SRC_BASE}/ap/rrm.c
117+
${COMMON_SRC_BASE}/ap/sta_info.c
118+
${COMMON_SRC_BASE}/ap/tkip_countermeasures.c
119+
${COMMON_SRC_BASE}/ap/utils.c
120+
${COMMON_SRC_BASE}/ap/wmm.c
121+
122+
${COMMON_SRC_BASE}/ap/wpa_auth.c
123+
${COMMON_SRC_BASE}/ap/wpa_auth_ie.c
124+
${COMMON_SRC_BASE}/ap/wpa_auth_ft.c
125+
${COMMON_SRC_BASE}/ap/wpa_auth_glue.c
126+
127+
${COMMON_SRC_BASE}/eap_common/eap_common.c
128+
${COMMON_SRC_BASE}/eap_server/eap_server.c
129+
${COMMON_SRC_BASE}/eap_server/eap_server_identity.c
130+
${COMMON_SRC_BASE}/eap_server/eap_server_methods.c
131+
${COMMON_SRC_BASE}/eapol_auth/eapol_auth_sm.c
132+
)
133+
134+
zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_AP
135+
CONFIG_AP
136+
CONFIG_NO_RADIUS
137+
CONFIG_NO_VLAN
138+
CONFIG_NO_ACCOUNTING
139+
CONFIG_NEED_AP_MLME
140+
CONFIG_IEEE80211AX
141+
CONFIG_EAP_SERVER
142+
CONFIG_EAP_SERVER_IDENTITY
143+
)
144+
145+
146+
zephyr_library_sources_ifndef(CONFIG_WPA_SUPP_CRYPTO
147+
${COMMON_SRC_BASE}/crypto/crypto_none.c
148+
)
149+
150+
zephyr_library_compile_definitions_ifndef(CONFIG_WPA_SUPP_CRYPTO
151+
CONFIG_NO_WPA
152+
CONFIG_CRYPTO_INTERNAL
153+
)
154+
155+
zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_CRYPTO
156+
CONFIG_WEP
157+
)
158+
159+
zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_CRYPTO
160+
${COMMON_SRC_BASE}/common/wpa_common.c
161+
${COMMON_SRC_BASE}/rsn_supp/wpa.c
162+
${COMMON_SRC_BASE}/rsn_supp/preauth.c
163+
${COMMON_SRC_BASE}/rsn_supp/pmksa_cache.c
164+
${COMMON_SRC_BASE}/rsn_supp/wpa_ie.c
165+
166+
${COMMON_SRC_BASE}/crypto/crypto_mbedtls-bignum.c
167+
${COMMON_SRC_BASE}/crypto/crypto_mbedtls-ec.c
168+
${COMMON_SRC_BASE}/crypto/crypto_mbedtls.c
169+
${COMMON_SRC_BASE}/crypto/tls_mbedtls.c
170+
${COMMON_SRC_BASE}/crypto/aes-wrap.c
171+
${COMMON_SRC_BASE}/crypto/aes-unwrap.c
172+
${COMMON_SRC_BASE}/crypto/rc4.c
173+
#${COMMON_SRC_BASE}/crypto/random.c
174+
${COMMON_SRC_BASE}/crypto/sha1-prf.c
175+
${COMMON_SRC_BASE}/crypto/sha256-prf.c
176+
${COMMON_SRC_BASE}/crypto/sha256-prf.c
177+
${COMMON_SRC_BASE}/crypto/sha384-prf.c
178+
)
179+
180+
181+
zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_WPA3
182+
${COMMON_SRC_BASE}/common/sae.c
183+
${COMMON_SRC_BASE}/common/dragonfly.c
184+
185+
${COMMON_SRC_BASE}/crypto/dh_groups.c
186+
${COMMON_SRC_BASE}/crypto/sha256-kdf.c
187+
)
188+
189+
zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_WPA3
190+
CONFIG_SAE
191+
CONFIG_ECC
192+
)
193+
194+
zephyr_library_include_directories_ifdef(CONFIG_WPA_SUPP_CRYPTO
195+
${CMAKE_SOURCE_DIR}
196+
)
197+
198+
zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_P2P
199+
${WPA_SUPPLICANT_BASE}/p2p_supplicant.c
200+
${WPA_SUPPLICANT_BASE}/p2p_supplicant_sd.c
201+
${COMMON_SRC_BASE}/p2p/p2p.c
202+
${COMMON_SRC_BASE}/p2p/p2p_utils.c
203+
${COMMON_SRC_BASE}/p2p/p2p_parse.c
204+
${COMMON_SRC_BASE}/p2p/p2p_build.c
205+
${COMMON_SRC_BASE}/p2p/p2p_go_neg.c
206+
${COMMON_SRC_BASE}/p2p/p2p_sd.c
207+
${COMMON_SRC_BASE}/p2p/p2p_pd.c
208+
${COMMON_SRC_BASE}/p2p/p2p_invitation.c
209+
${COMMON_SRC_BASE}/p2p/p2p_dev_disc.c
210+
${COMMON_SRC_BASE}/p2p/p2p_group.c
211+
${COMMON_SRC_BASE}/ap/p2p_hostapd.c
212+
${COMMON_SRC_BASE}/common/gas.c
213+
${WPA_SUPPLICANT_BASE}/gas_query.c
214+
${WPA_SUPPLICANT_BASE}/offchannel.c
215+
)
216+
zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_WPS
217+
${WPA_SUPPLICANT_BASE}/wps_supplicant.c
218+
${COMMON_SRC_BASE}/utils/uuid.c
219+
${COMMON_SRC_BASE}/eap_peer/eap_wsc.c
220+
${COMMON_SRC_BASE}/eap_common/eap_wsc_common.c
221+
${COMMON_SRC_BASE}/wps/wps.c
222+
${COMMON_SRC_BASE}/ap/wps_hostapd.c
223+
${COMMON_SRC_BASE}/wps/wps_common.c
224+
${COMMON_SRC_BASE}/wps/wps_attr_parse.c
225+
${COMMON_SRC_BASE}/wps/wps_attr_build.c
226+
${COMMON_SRC_BASE}/wps/wps_attr_process.c
227+
${COMMON_SRC_BASE}/wps/wps_dev_attr.c
228+
${COMMON_SRC_BASE}/wps/wps_enrollee.c
229+
${COMMON_SRC_BASE}/wps/wps_registrar.c
230+
${COMMON_SRC_BASE}/eapol_supp/eapol_supp_sm.c
231+
${COMMON_SRC_BASE}/eap_peer/eap.c
232+
${COMMON_SRC_BASE}/eap_peer/eap_methods.c
233+
${COMMON_SRC_BASE}/eap_common/eap_common.c
234+
${COMMON_SRC_BASE}/crypto/dh_groups.c
235+
${COMMON_SRC_BASE}/crypto/dh_group5.c
236+
)
237+
238+
zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_P2P
239+
CONFIG_P2P
240+
CONFIG_GAS
241+
CONFIG_OFFCHANNEL
242+
)
243+
244+
zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_WPS
245+
CONFIG_WPS
246+
CONFIG_EAP_WSC
247+
CONFIG_IEEE8021X_EAPOL
248+
)
249+
250+
zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE
251+
${COMMON_SRC_BASE}/eap_peer/eap_tls.c
252+
${COMMON_SRC_BASE}/eap_peer/eap_tls_common.c
253+
254+
${COMMON_SRC_BASE}/eapol_supp/eapol_supp_sm.c
255+
${COMMON_SRC_BASE}/eap_peer/eap.c
256+
${COMMON_SRC_BASE}/eap_peer/eap_methods.c
257+
${COMMON_SRC_BASE}/eap_common/eap_common.c
258+
259+
${COMMON_SRC_BASE}/eap_peer/eap_peap.c
260+
${COMMON_SRC_BASE}/eap_common/eap_peap_common.c
261+
${COMMON_SRC_BASE}/eap_peer/eap_ttls.c
262+
${COMMON_SRC_BASE}/eap_peer/eap_md5.c
263+
${COMMON_SRC_BASE}/eap_peer/eap_mschapv2.c
264+
${COMMON_SRC_BASE}/eap_common/chap.c
265+
${COMMON_SRC_BASE}/eap_peer/mschapv2.c
266+
${COMMON_SRC_BASE}/eap_peer/eap_leap.c
267+
268+
${COMMON_SRC_BASE}/eap_peer/eap_psk.c
269+
${COMMON_SRC_BASE}/eap_common/eap_psk_common.c
270+
271+
${COMMON_SRC_BASE}/eap_peer/eap_fast.c
272+
${COMMON_SRC_BASE}/eap_peer/eap_fast_pac.c
273+
${COMMON_SRC_BASE}/eap_common/eap_fast_common.c
274+
275+
${COMMON_SRC_BASE}/eap_peer/eap_pax.c
276+
${COMMON_SRC_BASE}/eap_common/eap_pax_common.c
277+
278+
${COMMON_SRC_BASE}/eap_peer/eap_sake.c
279+
${COMMON_SRC_BASE}/eap_common/eap_sake_common.c
280+
281+
${COMMON_SRC_BASE}/eap_peer/eap_gpsk.c
282+
${COMMON_SRC_BASE}/eap_common/eap_gpsk_common.c
283+
284+
${COMMON_SRC_BASE}/eap_peer/eap_pwd.c
285+
${COMMON_SRC_BASE}/eap_common/eap_pwd_common.c
286+
287+
${COMMON_SRC_BASE}/eap_peer/eap_eke.c
288+
${COMMON_SRC_BASE}/eap_common/eap_eke_common.c
289+
290+
${COMMON_SRC_BASE}/eap_peer/eap_ikev2.c
291+
${COMMON_SRC_BASE}/eap_peer/ikev2.c
292+
${COMMON_SRC_BASE}/eap_common/eap_ikev2_common.c
293+
${COMMON_SRC_BASE}/eap_common/ikev2_common.c
294+
295+
# common
296+
${COMMON_SRC_BASE}/crypto/sha384-tlsprf.c
297+
${COMMON_SRC_BASE}/crypto/sha256-tlsprf.c
298+
${COMMON_SRC_BASE}/crypto/sha1-tlsprf.c
299+
${COMMON_SRC_BASE}/crypto/sha1-tprf.c
300+
${COMMON_SRC_BASE}/crypto/ms_funcs.c
301+
${COMMON_SRC_BASE}/crypto/aes-eax.c
302+
# MD4 removed from MbedTLS
303+
${COMMON_SRC_BASE}/crypto/md4-internal
304+
${COMMON_SRC_BASE}/crypto/aes-encblock.c
305+
306+
)
307+
308+
zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE
309+
CONFIG_EAP_TLS
310+
CONFIG_IEEE8021X_EAPOL
311+
CONFIG_EAP_PEAP
312+
CONFIG_EAP_TTLS
313+
CONFIG_EAP_MD5
314+
CONFIG_EAP_MSCHAPv2
315+
CONFIG_EAP_LEAP
316+
CONFIG_EAP_PSK
317+
CONFIG_EAP_FAST
318+
CONFIG_EAP_PAX
319+
CONFIG_EAP_SAKE
320+
CONFIG_EAP_GPSK
321+
CONFIG_EAP_PWD
322+
CONFIG_EAP_EKE
323+
CONFIG_EAP_IKEv2
324+
)
325+
endif()

modules/hostap/Kconfig

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Nordic WiFi driver for nRF52840 and nRF5340
2+
#
3+
# Copyright (c) 2022 Nordic Semiconductor
4+
#
5+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
6+
#
7+
8+
config WPA_SUPP
9+
bool "WPA WPA_SUPP"
10+
depends on NET_SOCKETS
11+
depends on NET_SOCKETS_POSIX_NAMES || POSIX_API
12+
select NET_SOCKETS_PACKET
13+
select NET_MGMT
14+
select NET_MGMT_EVENT
15+
select NET_MGMT_EVENT_INFO
16+
help
17+
WPA WPA_SUPP
18+
19+
config WPA_SUPP_THREAD_STACK_SIZE
20+
int "Stack size for wpa_supplicant thread"
21+
default 8192
22+
23+
config WPA_SUPP_CRYPTO
24+
bool "Crypto support for WiFi"
25+
default y
26+
27+
config WPA_SUPP_CRYPTO_ENTERPRISE
28+
bool "Enterprise Crypto support for WiFi"
29+
30+
config WPA_SUPP_WPA3
31+
bool "WPA3 support"
32+
select WPA_SUPP_CRYPTO
33+
default y
34+
35+
config WPA_SUPP_AP
36+
bool "AP mode support"
37+
select WPA_SUPP_CRYPTO
38+
39+
config WPA_SUPP_WPS
40+
bool "WPS support"
41+
42+
config WPA_SUPP_P2P
43+
bool "P2P mode support"
44+
select WPA_SUPP_AP
45+
select WPA_SUPP_WPS
46+
47+
config WPA_SUPP_DEBUG_LEVEL
48+
string "Debug level for prints"
49+
default "INFO"

modules/hostap/module.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build:
2+
cmake: ./zephyr
3+
kconfig: ./zephyr/Kconfig

0 commit comments

Comments
 (0)