• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("//third_party/wpa_supplicant/wpa_supplicant-2.9_standard/wpa.gni")
16
17WPA_ROOT_DIR = "//third_party/wpa_supplicant/wpa_supplicant-2.9_standard"
18
19declare_args() {
20  wpa_supplicant_driver_nl80211_hisi = false
21  wpa_supplicant_driver_nl80211 = false
22  wpa_supplicant_ohos_certmgr = true
23}
24
25if (wpa_supplicant_driver_nl80211_hisi) {
26  CONFIG_HISI = "true"
27} else {
28  CONFIG_HISI = "false"
29}
30if (wpa_supplicant_driver_nl80211) {
31  CONFIG_DRIVER = "nl80211"
32} else {
33  CONFIG_DRIVER = "hdf"
34}
35
36CONFIG_OS = "unix"
37CONFIG_ELOOP = "eloop"
38if ("${CONFIG_DRIVER}" == "nl80211") {
39  CONFIG_L2_PACKET = "linux"
40} else {
41  CONFIG_L2_PACKET = "rtos"
42}
43
44CONFIG_MAIN = "main"
45
46config("wpa_warnings") {
47  cflags = [ "-Wno-error=sign-compare" ]
48  ldflags = [
49    "-flto",
50    "-fsanitize=cfi",
51    "-Wl,-plugin-opt,O1",
52  ]
53}
54
55ohos_shared_library("wpa_client") {
56  sanitize = {
57    cfi = true
58    debug = false
59    blocklist = "./wpa_blocklist.txt"
60  }
61
62  output_name = "wpa_client"
63  sources = [
64    "$WPA_ROOT_DIR/src/common/wpa_ctrl.c",
65    "$WPA_ROOT_DIR/src/utils/common.c",
66    "$WPA_ROOT_DIR/src/utils/os_${CONFIG_OS}.c",
67    "$WPA_ROOT_DIR/src/utils/wpa_debug.c",
68  ]
69
70  include_dirs = [
71    "$WPA_ROOT_DIR/src",
72    "$WPA_ROOT_DIR/src/utils",
73    "$WPA_ROOT_DIR/src/drivers",
74    "$WPA_ROOT_DIR/wpa_supplicant",
75    "$WPA_ROOT_DIR/build/include",
76    "//drivers/peripheral/wlan/client/include",
77    "//third_party/bounds_checking_function/include",
78    "//base/hiviewdfxhilog/interfaces/native/innerkits/include",
79    "//base/startup/init/interfaces/innerkits/include/syspara",
80  ]
81
82  cflags = [
83    "-UANDROID",
84    "-fsigned-char",
85    "-DCONFIG_IEEE80211W",
86    "-DCONFIG_NO_VLAN",
87    "-DCONFIG_NO_RADIUS",
88    "-DCONFIG_NO_RANDOM_POOL",
89    "-DCONFIG_SHA256",
90    "-DCONFIG_CRYPTO_INTERNAL",
91    "-DCONFIG_INTERNAL_LIBTOMMATH",
92    "-DCONFIG_INTERNAL_SHA384",
93    "-DCONFIG_INTERNAL_SHA512",
94    "-DCONFIG_CTRL_IFACE",
95    "-DCONFIG_IBSS_RSN",
96    "-DIEEE8021X_EAPOL",
97    "-DCONFIG_BACEND_FILE",
98    "-DCONFIG_NO_CONFIG_BLOBS",
99    "-DUSERSPACE_CLIENT_SUPPORT",
100    "-DCONFIG_DEBUG_FILE",
101    "-DCONFIG_OPEN_HARMONY_PATCH",
102  ]
103  if ("${CONFIG_CTRL_IFACE}" == "udp") {
104    cflags += [ "-DCONFIG_CTRL_IFACE_UDP" ]
105  } else {
106    cflags += [ "-DCONFIG_CTRL_IFACE_UNIX" ]
107  }
108
109  deps = [
110    "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog",
111    "//base/startup/init/interfaces/innerkits:libbegetutil",
112  ]
113
114  if ("${CONFIG_DRIVER}" == "nl80211") {
115    include_dirs += [ "$WPA_ROOT_DIR/libnl/include/libnl3" ]
116    cflags += [
117      "-DCONFIG_DRIVER_NL80211",
118      "-DCONFIG_LIBNL32",
119    ]
120  } else {
121    cflags += [
122      "-DCONFIG_DRIVER_HDF",
123      "-DCONFIG_OHOS_P2P",
124    ]
125  }
126  configs = [ ":wpa_warnings" ]
127  part_name = "wpa_supplicant-2.9"
128  subsystem_name = "wpa_supplicant-2.9"
129}
130
131ohos_shared_library("wpa") {
132  sanitize = {
133    cfi = true
134    debug = false
135    blocklist = "./wpa_blocklist.txt"
136  }
137  output_name = "wpa"
138  sources = [
139    # wpa & hostapd
140    "$WPA_ROOT_DIR/hostapd/ap_config_file.c",
141    "$WPA_ROOT_DIR/hostapd/ap_ctrl_iface.c",
142    "$WPA_ROOT_DIR/hostapd/ap_eap_register.c",
143
144    # hostapd
145    "$WPA_ROOT_DIR/hostapd/ap_main.c",
146    "$WPA_ROOT_DIR/src/ap/ap_config.c",
147    "$WPA_ROOT_DIR/src/ap/ap_drv_ops.c",
148    "$WPA_ROOT_DIR/src/ap/ap_list.c",
149    "$WPA_ROOT_DIR/src/ap/ap_mlme.c",
150    "$WPA_ROOT_DIR/src/ap/ap_rrm.c",
151    "$WPA_ROOT_DIR/src/ap/authsrv.c",
152    "$WPA_ROOT_DIR/src/ap/beacon.c",
153    "$WPA_ROOT_DIR/src/ap/bss_load.c",
154    "$WPA_ROOT_DIR/src/ap/ctrl_iface_ap.c",
155    "$WPA_ROOT_DIR/src/ap/dfs.c",
156    "$WPA_ROOT_DIR/src/ap/drv_callbacks.c",
157    "$WPA_ROOT_DIR/src/ap/eap_user_db.c",
158    "$WPA_ROOT_DIR/src/ap/hostapd.c",
159    "$WPA_ROOT_DIR/src/ap/hw_features.c",
160    "$WPA_ROOT_DIR/src/ap/ieee802_11.c",
161    "$WPA_ROOT_DIR/src/ap/ieee802_11_auth.c",
162    "$WPA_ROOT_DIR/src/ap/ieee802_11_ht.c",
163    "$WPA_ROOT_DIR/src/ap/ieee802_11_shared.c",
164    "$WPA_ROOT_DIR/src/ap/ieee802_1x.c",
165    "$WPA_ROOT_DIR/src/ap/neighbor_db.c",
166    "$WPA_ROOT_DIR/src/ap/pmksa_cache_auth.c",
167    "$WPA_ROOT_DIR/src/ap/preauth_auth.c",
168    "$WPA_ROOT_DIR/src/ap/sta_info.c",
169    "$WPA_ROOT_DIR/src/ap/tkip_countermeasures.c",
170    "$WPA_ROOT_DIR/src/ap/utils.c",
171    "$WPA_ROOT_DIR/src/ap/wmm.c",
172    "$WPA_ROOT_DIR/src/ap/wpa_auth.c",
173    "$WPA_ROOT_DIR/src/ap/wpa_auth_glue.c",
174    "$WPA_ROOT_DIR/src/ap/wpa_auth_ie.c",
175    "$WPA_ROOT_DIR/src/common/ctrl_iface_common.c",
176    "$WPA_ROOT_DIR/src/common/hw_features_common.c",
177    "$WPA_ROOT_DIR/src/common/ieee802_11_common.c",
178    "$WPA_ROOT_DIR/src/common/wpa_common.c",
179    "$WPA_ROOT_DIR/src/crypto/aes-internal.c",
180    "$WPA_ROOT_DIR/src/crypto/aes-omac1.c",
181    "$WPA_ROOT_DIR/src/crypto/sha1-prf.c",
182    "$WPA_ROOT_DIR/src/crypto/sha256-prf.c",
183    "$WPA_ROOT_DIR/src/drivers/driver_common.c",
184    "$WPA_ROOT_DIR/src/drivers/drivers.c",
185    "$WPA_ROOT_DIR/src/eap_common/eap_common.c",
186    "$WPA_ROOT_DIR/src/eap_peer/eap.c",
187    "$WPA_ROOT_DIR/src/eap_peer/eap_methods.c",
188    "$WPA_ROOT_DIR/src/eap_server/eap_server.c",
189    "$WPA_ROOT_DIR/src/eap_server/eap_server_identity.c",
190    "$WPA_ROOT_DIR/src/eap_server/eap_server_methods.c",
191    "$WPA_ROOT_DIR/src/eapol_auth/eapol_auth_sm.c",
192    "$WPA_ROOT_DIR/src/eapol_supp/eapol_supp_sm.c",
193    "$WPA_ROOT_DIR/src/l2_packet/l2_packet_${CONFIG_L2_PACKET}.c",
194    "$WPA_ROOT_DIR/src/rsn_supp/pmksa_cache.c",
195    "$WPA_ROOT_DIR/src/rsn_supp/preauth.c",
196    "$WPA_ROOT_DIR/src/rsn_supp/wpa.c",
197    "$WPA_ROOT_DIR/src/rsn_supp/wpa_i.h",
198    "$WPA_ROOT_DIR/src/rsn_supp/wpa_ie.c",
199    "$WPA_ROOT_DIR/src/utils/${CONFIG_ELOOP}.c",
200    "$WPA_ROOT_DIR/src/utils/bitfield.c",
201    "$WPA_ROOT_DIR/src/utils/common.c",
202    "$WPA_ROOT_DIR/src/utils/ip_addr.c",
203    "$WPA_ROOT_DIR/src/utils/os_${CONFIG_OS}.c",
204    "$WPA_ROOT_DIR/src/utils/radiotap.c",
205    "$WPA_ROOT_DIR/src/utils/wpa_debug.c",
206    "$WPA_ROOT_DIR/src/utils/wpabuf.c",
207    "$WPA_ROOT_DIR/wpa_supplicant/${CONFIG_MAIN}.c",
208    "$WPA_ROOT_DIR/wpa_supplicant/bss.c",
209    "$WPA_ROOT_DIR/wpa_supplicant/bssid_ignore.c",
210
211    # wpa_supplicant
212    "$WPA_ROOT_DIR/wpa_supplicant/config.c",
213    "$WPA_ROOT_DIR/wpa_supplicant/config_file.c",
214    "$WPA_ROOT_DIR/wpa_supplicant/ctrl_iface.c",
215    "$WPA_ROOT_DIR/wpa_supplicant/ctrl_iface_${CONFIG_CTRL_IFACE}.c",
216    "$WPA_ROOT_DIR/wpa_supplicant/eap_register.c",
217    "$WPA_ROOT_DIR/wpa_supplicant/events.c",
218    "$WPA_ROOT_DIR/wpa_supplicant/ibss_rsn.c",
219    "$WPA_ROOT_DIR/wpa_supplicant/notify.c",
220    "$WPA_ROOT_DIR/wpa_supplicant/op_classes.c",
221    "$WPA_ROOT_DIR/wpa_supplicant/robust_av.c",
222    "$WPA_ROOT_DIR/wpa_supplicant/rrm.c",
223    "$WPA_ROOT_DIR/wpa_supplicant/scan.c",
224    "$WPA_ROOT_DIR/wpa_supplicant/wmm_ac.c",
225    "$WPA_ROOT_DIR/wpa_supplicant/wpa_supplicant.c",
226    "$WPA_ROOT_DIR/wpa_supplicant/wpas_glue.c",
227
228    #sae
229    "$WPA_ROOT_DIR/src/common/sae.c",
230    "$WPA_ROOT_DIR/wpa_supplicant/sme.c",
231
232    #p2p
233    "$WPA_ROOT_DIR/src/ap/p2p_hostapd.c",
234    "$WPA_ROOT_DIR/src/ap/wps_hostapd.c",
235    "$WPA_ROOT_DIR/src/common/dragonfly.c",
236    "$WPA_ROOT_DIR/src/common/gas.c",
237    "$WPA_ROOT_DIR/src/crypto/crypto_openssl.c",
238    "$WPA_ROOT_DIR/src/crypto/dh_groups.c",
239    "$WPA_ROOT_DIR/src/crypto/fips_prf_openssl.c",
240    "$WPA_ROOT_DIR/src/crypto/ms_funcs.c",
241    "$WPA_ROOT_DIR/src/crypto/sha1-tlsprf.c",
242    "$WPA_ROOT_DIR/src/crypto/sha256-kdf.c",
243    "$WPA_ROOT_DIR/src/crypto/tls_openssl.c",
244    "$WPA_ROOT_DIR/src/crypto/tls_openssl_ocsp.c",
245    "$WPA_ROOT_DIR/src/eap_common/chap.c",
246    "$WPA_ROOT_DIR/src/eap_common/eap_peap_common.c",
247    "$WPA_ROOT_DIR/src/eap_common/eap_pwd_common.c",
248    "$WPA_ROOT_DIR/src/eap_common/eap_sim_common.c",
249    "$WPA_ROOT_DIR/src/eap_common/eap_wsc_common.c",
250    "$WPA_ROOT_DIR/src/eap_peer/eap_aka.c",
251    "$WPA_ROOT_DIR/src/eap_peer/eap_mschapv2.c",
252    "$WPA_ROOT_DIR/src/eap_peer/eap_peap.c",
253    "$WPA_ROOT_DIR/src/eap_peer/eap_pwd.c",
254    "$WPA_ROOT_DIR/src/eap_peer/eap_sim.c",
255    "$WPA_ROOT_DIR/src/eap_peer/eap_tls.c",
256    "$WPA_ROOT_DIR/src/eap_peer/eap_tls_common.c",
257    "$WPA_ROOT_DIR/src/eap_peer/eap_ttls.c",
258    "$WPA_ROOT_DIR/src/eap_peer/eap_wsc.c",
259    "$WPA_ROOT_DIR/src/eap_peer/mschapv2.c",
260    "$WPA_ROOT_DIR/src/eap_server/eap_server_wsc.c",
261    "$WPA_ROOT_DIR/src/p2p/p2p.c",
262    "$WPA_ROOT_DIR/src/p2p/p2p_build.c",
263    "$WPA_ROOT_DIR/src/p2p/p2p_dev_disc.c",
264    "$WPA_ROOT_DIR/src/p2p/p2p_go_neg.c",
265    "$WPA_ROOT_DIR/src/p2p/p2p_group.c",
266    "$WPA_ROOT_DIR/src/p2p/p2p_invitation.c",
267    "$WPA_ROOT_DIR/src/p2p/p2p_parse.c",
268    "$WPA_ROOT_DIR/src/p2p/p2p_pd.c",
269    "$WPA_ROOT_DIR/src/p2p/p2p_sd.c",
270    "$WPA_ROOT_DIR/src/p2p/p2p_utils.c",
271    "$WPA_ROOT_DIR/src/tls/bignum.c",
272    "$WPA_ROOT_DIR/src/utils/base64.c",
273    "$WPA_ROOT_DIR/src/utils/config.c",
274    "$WPA_ROOT_DIR/src/utils/crc32.c",
275    "$WPA_ROOT_DIR/src/utils/uuid.c",
276    "$WPA_ROOT_DIR/src/wps/wps.c",
277    "$WPA_ROOT_DIR/src/wps/wps_attr_build.c",
278    "$WPA_ROOT_DIR/src/wps/wps_attr_parse.c",
279    "$WPA_ROOT_DIR/src/wps/wps_attr_process.c",
280    "$WPA_ROOT_DIR/src/wps/wps_common.c",
281    "$WPA_ROOT_DIR/src/wps/wps_dev_attr.c",
282    "$WPA_ROOT_DIR/src/wps/wps_enrollee.c",
283    "$WPA_ROOT_DIR/src/wps/wps_registrar.c",
284    "$WPA_ROOT_DIR/wpa_supplicant/ap.c",
285    "$WPA_ROOT_DIR/wpa_supplicant/gas_query.c",
286    "$WPA_ROOT_DIR/wpa_supplicant/offchannel.c",
287    "$WPA_ROOT_DIR/wpa_supplicant/p2p_supplicant.c",
288    "$WPA_ROOT_DIR/wpa_supplicant/p2p_supplicant_sd.c",
289    "$WPA_ROOT_DIR/wpa_supplicant/wps_supplicant.c",
290    "$WPA_ROOT_DIR/wpa_supplicant_lib/wpa_magiclink.c",
291  ]
292
293  include_dirs = [
294    "$WPA_ROOT_DIR/src",
295    "$WPA_ROOT_DIR/src/utils",
296    "$WPA_ROOT_DIR/src/drivers",
297    "$WPA_ROOT_DIR/wpa_supplicant",
298    "$WPA_ROOT_DIR/build/include",
299    "$WPA_ROOT_DIR/wpa_supplicant_lib",
300    "//third_party/libnl/include",
301    "//drivers/peripheral/wlan/client/include",
302    "//third_party/bounds_checking_function/include",
303    "//third_party/openssl/include",
304    "$WPA_ROOT_DIR/src/crypto",
305    "$WPA_ROOT_DIR/src/eap_common",
306    "//base/hiviewdfxhilog/interfaces/native/innerkits/include",
307  ]
308
309  cflags = [
310    "-UANDROID",
311    "-fsigned-char",
312    "-DCONFIG_IEEE80211W",
313    "-DCONFIG_NO_VLAN",
314    "-DCONFIG_NO_RADIUS",
315    "-DCONFIG_NO_RANDOM_POOL",
316    "-DCONFIG_SHA256",
317    "-DCONFIG_CRYPTO_INTERNAL",
318    "-DCONFIG_INTERNAL_LIBTOMMATH",
319    "-DCONFIG_INTERNAL_SHA384",
320    "-DCONFIG_INTERNAL_SHA512",
321    "-DCONFIG_CTRL_IFACE",
322    "-DCONFIG_IBSS_RSN",
323    "-DIEEE8021X_EAPOL",
324    "-DUSERSPACE_CLIENT_SUPPORT",
325    "-DCONFIG_BACKEND_FILE",
326    "-DCONFIG_NO_CONFIG_BLOBS",
327    "-DCONFIG_NO_ACCOUNTING",
328    "-DEAP_SERVER_IDENTITY",
329    "-DCONFIG_IEEE80211N",
330    "-DHOSTAPD",
331    "-DNEED_AP_MLME",
332    "-DCONFIG_WPS",
333    "-DCONFIG_AP",
334    "-DCONFIG_P2P",
335    "-DEAP_WSC",
336    "-DEAP_SERVER_WSC",
337    "-DEAP_SERVER",
338    "-DCONFIG_GAS",
339    "-DCONFIG_OFFCHANNEL",
340    "-DCONFIG_MAGICLINK",
341    "-DCONFIG_OPEN_HARMONY_PATCH",
342    "-DEAP_MSCHAPV2",
343    "-DEAP_TLS",
344    "-DEAP_PEAP",
345    "-DEAP_TTLS",
346    "-DEAP_SIM",
347    "-DEAP_PWD",
348    "-DEAP_MSCHAPv2",
349    "-DCONFIG_SHA256",
350    "-DCONFIG_ECC",
351    "-DEAP_AKA",
352    "-DEAP_AKA_PRIME",
353    "-DEAP_TLS_OPENSSL",
354    "-DCONFIG_SAE",
355    "-DCONFIG_SME",
356    "-DCONFIG_WEP",
357  ]
358  if ("${CONFIG_CTRL_IFACE}" == "udp") {
359    cflags += [ "-DCONFIG_CTRL_IFACE_UDP" ]
360  } else {
361    cflags += [ "-DCONFIG_CTRL_IFACE_UNIX" ]
362  }
363
364  defines = [ "TLS_DEFAULT_CIPHERS = \"DEFAULT:!EXP:!LOW\"" ]
365
366  deps = [
367    "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog",
368    "//drivers/peripheral/wlan/client:wifi_driver_client",
369    "//third_party/bounds_checking_function:libsec_static",
370    "//third_party/openssl:libcrypto_shared",
371    "//third_party/openssl:libssl_shared",
372  ]
373  external_deps = [ "init:libbegetutil" ]
374
375  if ("${CONFIG_DRIVER}" == "nl80211") {
376    sources += [
377      "$WPA_ROOT_DIR/src/ap/ieee802_11_he.c",
378      "$WPA_ROOT_DIR/src/ap/ieee802_11_vht.c",
379      "$WPA_ROOT_DIR/src/drivers/driver_nl80211.c",
380      "$WPA_ROOT_DIR/src/drivers/driver_nl80211_capa.c",
381      "$WPA_ROOT_DIR/src/drivers/driver_nl80211_event.c",
382      "$WPA_ROOT_DIR/src/drivers/driver_nl80211_monitor.c",
383      "$WPA_ROOT_DIR/src/drivers/driver_nl80211_scan.c",
384      "$WPA_ROOT_DIR/src/drivers/linux_ioctl.c",
385      "$WPA_ROOT_DIR/src/drivers/netlink.c",
386      "$WPA_ROOT_DIR/src/drivers/rfkill.c",
387    ]
388    include_dirs += [
389      "$WPA_ROOT_DIR/libnl/include/libnl3",
390      "$WPA_ROOT_DIR/wpa_supplicant_lib",
391    ]
392
393    cflags += [
394      "-DCONFIG_DRIVER_NL80211",
395      "-DCONFIG_LIBNL32",
396      "-DCONFIG_LIBNL20",
397      "-DCONFIG_DEBUG_FILE",
398      "-DCONFIG_IEEE80211AC",
399      "-DCONFIG_IEEE80211AX",
400    ]
401    deps += [ "//third_party/libnl:libnl_share" ]
402  } else {
403    sources += [
404      "$WPA_ROOT_DIR/src/drivers/wpa_hal.c",
405      "$WPA_ROOT_DIR/src/drivers/wpa_hal_event.c",
406    ]
407    cflags += [
408      "-DCONFIG_DRIVER_HDF",
409      "-DCONFIG_OHOS_P2P",
410    ]
411  }
412  if ("${CONFIG_HISI}" == "true") {
413    sources += [ "$WPA_ROOT_DIR/wpa_supplicant_lib/driver_nl80211_hisi.c" ]
414    cflags += [ "-DCONFIG_DRIVER_NL80211_HISI" ]
415    if (use_musl) {
416      cflags += [ "-DCONFIG_DRIVER_NL80211_HISI_TRUNK" ]
417    }
418  }
419
420  if (wpa_supplicant_ohos_certmgr) {
421    sources += [ "$WPA_ROOT_DIR/wpa_supplicant_lib/wpa_evp_key.c" ]
422    deps += [ "//base/security/certificate_manager/interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk" ]
423    include_dirs += [
424      "//base/security/certificate_manager/frameworks/cert_manager_standard/main/common/include",
425      "//base/security/certificate_manager/interfaces/innerkits/cert_manager_standard/main/include",
426      "//third_party/openssl",
427    ]
428    defines += [ "CONFIG_OHOS_CERTMGR" ]
429  }
430
431  configs = [ ":wpa_warnings" ]
432  part_name = "wpa_supplicant-2.9"
433  subsystem_name = "wpa_supplicant-2.9"
434}
435
436ohos_executable("wpa_cli") {
437  sources = [
438    "$WPA_ROOT_DIR/src/common/cli.c",
439    "$WPA_ROOT_DIR/src/common/wpa_ctrl.c",
440    "$WPA_ROOT_DIR/src/utils/${CONFIG_ELOOP}.c",
441    "$WPA_ROOT_DIR/src/utils/common.c",
442    "$WPA_ROOT_DIR/src/utils/edit_simple.c",
443    "$WPA_ROOT_DIR/src/utils/os_${CONFIG_OS}.c",
444    "$WPA_ROOT_DIR/src/utils/wpa_debug.c",
445    "$WPA_ROOT_DIR/wpa_supplicant/wpa_cli.c",
446  ]
447
448  include_dirs = [
449    "$WPA_ROOT_DIR/src",
450    "$WPA_ROOT_DIR/src/utils",
451    "$WPA_ROOT_DIR/src/drivers",
452    "$WPA_ROOT_DIR/wpa_supplicant",
453    "$WPA_ROOT_DIR/build/include",
454    "//base/hiviewdfxhilog/interfaces/native/innerkits/include",
455    "//base/startup/init/interfaces/innerkits/include/syspara",
456  ]
457
458  cflags = [
459    "-UANDROID",
460    "-fsigned-char",
461    "-DCONFIG_IEEE80211W",
462    "-DCONFIG_NO_VLAN",
463    "-DCONFIG_NO_RADIUS",
464    "-DCONFIG_NO_RANDOM_POOL",
465    "-DCONFIG_SHA256",
466    "-DCONFIG_CRYPTO_INTERNAL",
467    "-DCONFIG_INTERNAL_LIBTOMMATH",
468    "-DCONFIG_INTERNAL_SHA384",
469    "-DCONFIG_INTERNAL_SHA512",
470    "-DCONFIG_CTRL_IFACE",
471    "-DCONFIG_IBSS_RSN",
472    "-DIEEE8021X_EAPOL",
473    "-DUSERSPACE_CLIENT_SUPPORT",
474    "-DCONFIG_BACKEND_FILE",
475    "-DCONFIG_NO_CONFIG_BLOBS",
476    "-DCONFIG_WPS",
477    "-DCONFIG_AP",
478    "-DCONFIG_P2P",
479    "-DEAP_WSC",
480    "-DEAP_SERVER_WSC",
481    "-DEAP_SERVER",
482    "-DCONFIG_GAS",
483    "-DCONFIG_OFFCHANNEL",
484    "-DCONFIG_MAGICLINK",
485    "-DCONFIG_DEBUG_FILE",
486    "-DCONFIG_OPEN_HARMONY_PATCH",
487  ]
488  if ("${CONFIG_CTRL_IFACE}" == "udp") {
489    cflags += [ "-DCONFIG_CTRL_IFACE_UDP" ]
490  } else {
491    cflags += [ "-DCONFIG_CTRL_IFACE_UNIX" ]
492  }
493
494  if ("${CONFIG_DRIVER}" == "nl80211") {
495    include_dirs += [ "$WPA_ROOT_DIR/libnl/include/libnl3" ]
496    cflags += [
497      "-DCONFIG_DRIVER_NL80211",
498      "-DCONFIG_LIBNL32",
499    ]
500  } else {
501    cflags += [
502      "-DCONFIG_DRIVER_HDF",
503      "-DCONFIG_OHOS_P2P",
504    ]
505  }
506
507  deps = [
508    "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog",
509    "//base/startup/init/interfaces/innerkits:libbegetutil",
510  ]
511
512  configs = [ ":wpa_warnings" ]
513  part_name = "wpa_supplicant-2.9"
514  subsystem_name = "wpa_supplicant-2.9"
515}
516
517ohos_executable("hostapd_cli") {
518  sources = [
519    "$WPA_ROOT_DIR/hostapd/hostapd_cli.c",
520    "$WPA_ROOT_DIR/src/common/cli.c",
521    "$WPA_ROOT_DIR/src/common/wpa_ctrl.c",
522    "$WPA_ROOT_DIR/src/utils/${CONFIG_ELOOP}.c",
523    "$WPA_ROOT_DIR/src/utils/common.c",
524    "$WPA_ROOT_DIR/src/utils/edit_simple.c",
525    "$WPA_ROOT_DIR/src/utils/os_${CONFIG_OS}.c",
526    "$WPA_ROOT_DIR/src/utils/wpa_debug.c",
527  ]
528
529  include_dirs = [
530    "$WPA_ROOT_DIR/src",
531    "$WPA_ROOT_DIR/src/utils",
532    "$WPA_ROOT_DIR/src/drivers",
533    "$WPA_ROOT_DIR/wpa_supplicant",
534    "$WPA_ROOT_DIR/build/include",
535    "$WPA_ROOT_DIR/libnl/include/libnl3",
536    "//base/hiviewdfxhilog/interfaces/native/innerkits/include",
537    "//base/startup/init/interfaces/innerkits/include/syspara",
538  ]
539
540  cflags = [
541    "-UANDROID",
542    "-fsigned-char",
543    "-DCONFIG_IEEE80211W",
544    "-DCONFIG_NO_VLAN",
545    "-DCONFIG_NO_RADIUS",
546    "-DCONFIG_NO_RANDOM_POOL",
547    "-DCONFIG_SHA256",
548    "-DCONFIG_CRYPTO_INTERNAL",
549    "-DCONFIG_INTERNAL_LIBTOMMATH",
550    "-DCONFIG_INTERNAL_SHA384",
551    "-DCONFIG_INTERNAL_SHA512",
552    "-DCONFIG_CTRL_IFACE",
553    "-DCONFIG_IBSS_RSN",
554    "-DIEEE8021X_EAPOL",
555    "-DUSERSPACE_CLIENT_SUPPORT",
556    "-DCONFIG_BACKEND_FILE",
557    "-DCONFIG_NO_CONFIG_BLOBS",
558    "-DCONFIG_NO_ACCOUNTING",
559    "-DEAP_SERVER_IDENTITY",
560    "-DCONFIG_IEEE80211N",
561    "-DHOSTAPD",
562    "-DNEED_AP_MLME",
563    "-DCONFIG_WPS",
564    "-DCONFIG_AP",
565    "-DCONFIG_P2P",
566    "-DEAP_WSC",
567    "-DEAP_SERVER_WSC",
568    "-DEAP_SERVER",
569    "-DCONFIG_GAS",
570    "-DCONFIG_OFFCHANNEL",
571    "-DCONFIG_DEBUG_FILE",
572    "-DCONFIG_OPEN_HARMONY_PATCH",
573  ]
574  if ("${CONFIG_CTRL_IFACE}" == "udp") {
575    cflags += [ "-DCONFIG_CTRL_IFACE_UDP" ]
576  } else {
577    cflags += [ "-DCONFIG_CTRL_IFACE_UNIX" ]
578  }
579
580  deps = [
581    "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog",
582    "//base/startup/init/interfaces/innerkits:libbegetutil",
583  ]
584
585  if ("${CONFIG_DRIVER}" == "nl80211") {
586    cflags += [
587      "-DCONFIG_DRIVER_NL80211",
588      "-DCONFIG_LIBNL32",
589    ]
590  } else {
591    cflags += [
592      "-DCONFIG_DRIVER_HDF",
593      "-DCONFIG_OHOS_P2P",
594    ]
595  }
596  configs = [ ":wpa_warnings" ]
597  part_name = "wpa_supplicant-2.9"
598  subsystem_name = "wpa_supplicant-2.9"
599}
600
601ohos_executable("wpa_supplicant") {
602  sources = [ "$WPA_ROOT_DIR/wpa_test/wpa_sample.c" ]
603
604  include_dirs = [ "$WPA_ROOT_DIR/build/include" ]
605
606  deps = [ "//third_party/wpa_supplicant/wpa_supplicant-2.9_standard:wpa" ]
607  configs = [ ":wpa_warnings" ]
608  cflags = [
609    "-DCONFIG_DEBUG_FILE",
610    "-DCONFIG_OPEN_HARMONY_PATCH",
611  ]
612  part_name = "wpa_supplicant-2.9"
613  subsystem_name = "wpa_supplicant-2.9"
614}
615
616ohos_executable("hostapd") {
617  sources = [ "$WPA_ROOT_DIR/hostapd_test/hostapd_sample.c" ]
618
619  include_dirs = [ "$WPA_ROOT_DIR/build/include" ]
620
621  deps = [ "//third_party/wpa_supplicant/wpa_supplicant-2.9_standard:wpa" ]
622
623  configs = [ ":wpa_warnings" ]
624  cflags = [
625    "-DCONFIG_DEBUG_FILE",
626    "-DCONFIG_OPEN_HARMONY_PATCH",
627  ]
628  part_name = "wpa_supplicant-2.9"
629  subsystem_name = "wpa_supplicant-2.9"
630}
631