1# Copyright (C) 2008 The Android Open Source Project
2#
3# This software may be distributed under the terms of the BSD license.
4# See README for more details.
5#
6
7LOCAL_PATH := $(call my-dir)
8
9WPA_BUILD_HOSTAPD := false
10ifneq ($(BOARD_HOSTAPD_DRIVER),)
11  WPA_BUILD_HOSTAPD := true
12  CONFIG_DRIVER_$(BOARD_HOSTAPD_DRIVER) := y
13endif
14
15ifeq ($(WPA_BUILD_HOSTAPD),true)
16
17include $(LOCAL_PATH)/android.config
18
19# To ignore possible wrong network configurations
20L_CFLAGS = -DWPA_IGNORE_CONFIG_ERRORS
21
22L_CFLAGS += -DVERSION_STR_POSTFIX=\"-$(PLATFORM_VERSION)\"
23
24# Set Android log name
25L_CFLAGS += -DANDROID_LOG_NAME=\"hostapd\"
26
27# Disable unused parameter warnings
28L_CFLAGS += -Wno-unused-parameter
29
30# Set Android extended P2P functionality
31L_CFLAGS += -DANDROID_P2P
32
33ifeq ($(BOARD_HOSTAPD_PRIVATE_LIB),)
34L_CFLAGS += -DANDROID_LIB_STUB
35endif
36
37ifneq ($(BOARD_HOSTAPD_PRIVATE_LIB_EVENT),)
38L_CFLAGS += -DANDROID_LIB_EVENT
39endif
40
41# Use Android specific directory for control interface sockets
42L_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/misc/wifi/sockets\"
43L_CFLAGS += -DCONFIG_CTRL_IFACE_DIR=\"/data/system/hostapd\"
44
45# Use Android specific directory for hostapd_cli command completion history
46L_CFLAGS += -DCONFIG_HOSTAPD_CLI_HISTORY_DIR=\"/data/misc/wifi\"
47
48# To force sizeof(enum) = 4
49ifeq ($(TARGET_ARCH),arm)
50L_CFLAGS += -mabi=aapcs-linux
51endif
52
53INCLUDES = $(LOCAL_PATH)
54INCLUDES += $(LOCAL_PATH)/src
55INCLUDES += $(LOCAL_PATH)/src/utils
56INCLUDES += system/security/keystore/include
57ifdef CONFIG_DRIVER_NL80211
58ifneq ($(wildcard external/libnl),)
59INCLUDES += external/libnl/include
60else
61INCLUDES += external/libnl-headers
62endif
63endif
64
65
66ifndef CONFIG_OS
67ifdef CONFIG_NATIVE_WINDOWS
68CONFIG_OS=win32
69else
70CONFIG_OS=unix
71endif
72endif
73
74ifeq ($(CONFIG_OS), internal)
75L_CFLAGS += -DOS_NO_C_LIB_DEFINES
76endif
77
78ifdef CONFIG_NATIVE_WINDOWS
79L_CFLAGS += -DCONFIG_NATIVE_WINDOWS
80LIBS += -lws2_32
81endif
82
83OBJS = main.c
84OBJS += config_file.c
85
86OBJS += src/ap/hostapd.c
87OBJS += src/ap/wpa_auth_glue.c
88OBJS += src/ap/drv_callbacks.c
89OBJS += src/ap/ap_drv_ops.c
90OBJS += src/ap/utils.c
91OBJS += src/ap/authsrv.c
92OBJS += src/ap/ieee802_1x.c
93OBJS += src/ap/ap_config.c
94OBJS += src/ap/eap_user_db.c
95OBJS += src/ap/ieee802_11_auth.c
96OBJS += src/ap/sta_info.c
97OBJS += src/ap/wpa_auth.c
98OBJS += src/ap/tkip_countermeasures.c
99OBJS += src/ap/ap_mlme.c
100OBJS += src/ap/wpa_auth_ie.c
101OBJS += src/ap/preauth_auth.c
102OBJS += src/ap/pmksa_cache_auth.c
103OBJS += src/ap/ieee802_11_shared.c
104OBJS += src/ap/beacon.c
105OBJS += src/ap/bss_load.c
106OBJS += src/ap/neighbor_db.c
107OBJS += src/ap/rrm.c
108OBJS_d =
109OBJS_p =
110LIBS =
111LIBS_c =
112HOBJS =
113LIBS_h =
114
115NEED_RC4=y
116NEED_AES=y
117NEED_MD5=y
118NEED_SHA1=y
119
120OBJS += src/drivers/drivers.c
121L_CFLAGS += -DHOSTAPD
122
123ifdef CONFIG_WPA_TRACE
124L_CFLAGS += -DWPA_TRACE
125OBJS += src/utils/trace.c
126HOBJS += src/utils/trace.c
127LDFLAGS += -rdynamic
128L_CFLAGS += -funwind-tables
129ifdef CONFIG_WPA_TRACE_BFD
130L_CFLAGS += -DWPA_TRACE_BFD
131LIBS += -lbfd
132LIBS_c += -lbfd
133LIBS_h += -lbfd
134endif
135endif
136
137OBJS += src/utils/eloop.c
138
139ifdef CONFIG_ELOOP_POLL
140L_CFLAGS += -DCONFIG_ELOOP_POLL
141endif
142
143ifdef CONFIG_ELOOP_EPOLL
144L_CFLAGS += -DCONFIG_ELOOP_EPOLL
145endif
146
147OBJS += src/utils/common.c
148OBJS += src/utils/wpa_debug.c
149OBJS += src/utils/wpabuf.c
150OBJS += src/utils/os_$(CONFIG_OS).c
151OBJS += src/utils/ip_addr.c
152OBJS += src/utils/crc32.c
153
154OBJS += src/common/ieee802_11_common.c
155OBJS += src/common/wpa_common.c
156OBJS += src/common/hw_features_common.c
157
158OBJS += src/eapol_auth/eapol_auth_sm.c
159
160
161ifndef CONFIG_NO_DUMP_STATE
162# define HOSTAPD_DUMP_STATE to include support for dumping internal state
163# through control interface commands (undefine it, if you want to save in
164# binary size)
165L_CFLAGS += -DHOSTAPD_DUMP_STATE
166OBJS += src/eapol_auth/eapol_auth_dump.c
167endif
168
169ifdef CONFIG_NO_RADIUS
170L_CFLAGS += -DCONFIG_NO_RADIUS
171CONFIG_NO_ACCOUNTING=y
172else
173OBJS += src/radius/radius.c
174OBJS += src/radius/radius_client.c
175OBJS += src/radius/radius_das.c
176endif
177
178ifdef CONFIG_NO_ACCOUNTING
179L_CFLAGS += -DCONFIG_NO_ACCOUNTING
180else
181OBJS += src/ap/accounting.c
182endif
183
184ifdef CONFIG_NO_VLAN
185L_CFLAGS += -DCONFIG_NO_VLAN
186else
187OBJS += src/ap/vlan_init.c
188OBJS += src/ap/vlan_ifconfig.c
189OBJS += src/ap/vlan.c
190ifdef CONFIG_FULL_DYNAMIC_VLAN
191# Define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges
192# and VLAN interfaces for the VLAN feature.
193L_CFLAGS += -DCONFIG_FULL_DYNAMIC_VLAN
194OBJS += src/ap/vlan_full.c
195ifdef CONFIG_VLAN_NETLINK
196OBJS += src/ap/vlan_util.c
197else
198OBJS += src/ap/vlan_ioctl.c
199endif
200endif
201endif
202
203ifdef CONFIG_NO_CTRL_IFACE
204L_CFLAGS += -DCONFIG_NO_CTRL_IFACE
205else
206OBJS += src/common/ctrl_iface_common.c
207OBJS += ctrl_iface.c
208OBJS += src/ap/ctrl_iface_ap.c
209endif
210
211L_CFLAGS += -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX
212
213ifdef CONFIG_RSN_PREAUTH
214L_CFLAGS += -DCONFIG_RSN_PREAUTH
215CONFIG_L2_PACKET=y
216endif
217
218ifdef CONFIG_HS20
219CONFIG_PROXYARP=y
220endif
221
222ifdef CONFIG_PROXYARP
223CONFIG_L2_PACKET=y
224endif
225
226ifdef CONFIG_SUITEB
227L_CFLAGS += -DCONFIG_SUITEB
228endif
229
230ifdef CONFIG_SUITEB192
231L_CFLAGS += -DCONFIG_SUITEB192
232NEED_SHA384=y
233endif
234
235ifdef CONFIG_OCV
236L_CFLAGS += -DCONFIG_OCV
237OBJS += src/common/ocv.c
238endif
239
240ifdef CONFIG_IEEE80211R
241L_CFLAGS += -DCONFIG_IEEE80211R -DCONFIG_IEEE80211R_AP
242OBJS += src/ap/wpa_auth_ft.c
243NEED_AES_UNWRAP=y
244NEED_AES_SIV=y
245NEED_ETH_P_OUI=y
246NEED_HMAC_SHA256_KDF=y
247endif
248
249ifdef NEED_ETH_P_OUI
250L_CFLAGS += -DCONFIG_ETH_P_OUI
251OBJS += src/ap/eth_p_oui.c
252endif
253
254ifdef CONFIG_SAE
255L_CFLAGS += -DCONFIG_SAE
256OBJS += src/common/sae.c
257ifdef CONFIG_SAE_PK
258L_CFLAGS += -DCONFIG_SAE_PK
259OBJS += src/common/sae_pk.c
260endif
261NEED_ECC=y
262NEED_DH_GROUPS=y
263NEED_HMAC_SHA256_KDF=y
264NEED_DRAGONFLY=y
265endif
266
267ifdef CONFIG_OWE
268L_CFLAGS += -DCONFIG_OWE
269NEED_ECC=y
270NEED_HMAC_SHA256_KDF=y
271NEED_HMAC_SHA384_KDF=y
272NEED_HMAC_SHA512_KDF=y
273NEED_SHA384=y
274NEED_SHA512=y
275endif
276
277ifdef CONFIG_FILS
278L_CFLAGS += -DCONFIG_FILS
279OBJS += src/ap/fils_hlp.c
280NEED_SHA384=y
281NEED_AES_SIV=y
282ifdef CONFIG_FILS_SK_PFS
283L_CFLAGS += -DCONFIG_FILS_SK_PFS
284NEED_ECC=y
285endif
286endif
287
288ifdef CONFIG_WNM
289L_CFLAGS += -DCONFIG_WNM -DCONFIG_WNM_AP
290OBJS += src/ap/wnm_ap.c
291endif
292
293ifdef CONFIG_IEEE80211AC
294L_CFLAGS += -DCONFIG_IEEE80211AC
295endif
296
297ifdef CONFIG_IEEE80211AX
298L_CFLAGS += -DCONFIG_IEEE80211AX
299endif
300
301ifdef CONFIG_MBO
302L_CFLAGS += -DCONFIG_MBO
303OBJS += src/ap/mbo_ap.c
304endif
305
306ifdef CONFIG_FST
307L_CFLAGS += -DCONFIG_FST
308OBJS += src/fst/fst.c
309OBJS += src/fst/fst_group.c
310OBJS += src/fst/fst_iface.c
311OBJS += src/fst/fst_session.c
312OBJS += src/fst/fst_ctrl_aux.c
313ifdef CONFIG_FST_TEST
314L_CFLAGS += -DCONFIG_FST_TEST
315endif
316ifndef CONFIG_NO_CTRL_IFACE
317OBJS += src/fst/fst_ctrl_iface.c
318endif
319endif
320
321ifdef CONFIG_WEP
322L_CFLAGS += -DCONFIG_WEP
323endif
324
325ifdef CONFIG_NO_TKIP
326L_CFLAGS += -DCONFIG_NO_TKIP
327endif
328
329
330include $(LOCAL_PATH)/src/drivers/drivers.mk
331
332OBJS += $(DRV_AP_OBJS)
333L_CFLAGS += $(DRV_AP_CFLAGS)
334LDFLAGS += $(DRV_AP_LDFLAGS)
335LIBS += $(DRV_AP_LIBS)
336
337ifdef CONFIG_L2_PACKET
338ifdef CONFIG_DNET_PCAP
339ifdef CONFIG_L2_FREEBSD
340LIBS += -lpcap
341OBJS += src/l2_packet/l2_packet_freebsd.c
342else
343LIBS += -ldnet -lpcap
344OBJS += src/l2_packet/l2_packet_pcap.c
345endif
346else
347OBJS += src/l2_packet/l2_packet_linux.c
348endif
349else
350OBJS += src/l2_packet/l2_packet_none.c
351endif
352
353
354ifdef CONFIG_EAP_MD5
355L_CFLAGS += -DEAP_SERVER_MD5
356OBJS += src/eap_server/eap_server_md5.c
357CHAP=y
358endif
359
360ifdef CONFIG_EAP_TLS
361L_CFLAGS += -DEAP_SERVER_TLS
362OBJS += src/eap_server/eap_server_tls.c
363TLS_FUNCS=y
364endif
365
366ifdef CONFIG_EAP_UNAUTH_TLS
367L_CFLAGS += -DEAP_SERVER_UNAUTH_TLS
368ifndef CONFIG_EAP_TLS
369OBJS += src/eap_server/eap_server_tls.c
370TLS_FUNCS=y
371endif
372endif
373
374ifdef CONFIG_EAP_PEAP
375L_CFLAGS += -DEAP_SERVER_PEAP
376OBJS += src/eap_server/eap_server_peap.c
377OBJS += src/eap_common/eap_peap_common.c
378TLS_FUNCS=y
379CONFIG_EAP_MSCHAPV2=y
380endif
381
382ifdef CONFIG_EAP_TTLS
383L_CFLAGS += -DEAP_SERVER_TTLS
384OBJS += src/eap_server/eap_server_ttls.c
385TLS_FUNCS=y
386CHAP=y
387endif
388
389ifdef CONFIG_EAP_MSCHAPV2
390L_CFLAGS += -DEAP_SERVER_MSCHAPV2
391OBJS += src/eap_server/eap_server_mschapv2.c
392MS_FUNCS=y
393endif
394
395ifdef CONFIG_EAP_GTC
396L_CFLAGS += -DEAP_SERVER_GTC
397OBJS += src/eap_server/eap_server_gtc.c
398endif
399
400ifdef CONFIG_EAP_SIM
401L_CFLAGS += -DEAP_SERVER_SIM
402OBJS += src/eap_server/eap_server_sim.c
403CONFIG_EAP_SIM_COMMON=y
404NEED_AES_CBC=y
405endif
406
407ifdef CONFIG_EAP_AKA
408L_CFLAGS += -DEAP_SERVER_AKA
409OBJS += src/eap_server/eap_server_aka.c
410CONFIG_EAP_SIM_COMMON=y
411NEED_AES_CBC=y
412endif
413
414ifdef CONFIG_EAP_AKA_PRIME
415L_CFLAGS += -DEAP_SERVER_AKA_PRIME
416endif
417
418ifdef CONFIG_EAP_SIM_COMMON
419OBJS += src/eap_common/eap_sim_common.c
420# Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be
421# replaced with another file implementing the interface specified in
422# eap_sim_db.h.
423OBJS += src/eap_server/eap_sim_db.c
424NEED_FIPS186_2_PRF=y
425endif
426
427ifdef CONFIG_EAP_PAX
428L_CFLAGS += -DEAP_SERVER_PAX
429OBJS += src/eap_server/eap_server_pax.c src/eap_common/eap_pax_common.c
430endif
431
432ifdef CONFIG_EAP_PSK
433L_CFLAGS += -DEAP_SERVER_PSK
434OBJS += src/eap_server/eap_server_psk.c src/eap_common/eap_psk_common.c
435NEED_AES_ENCBLOCK=y
436NEED_AES_EAX=y
437endif
438
439ifdef CONFIG_EAP_SAKE
440L_CFLAGS += -DEAP_SERVER_SAKE
441OBJS += src/eap_server/eap_server_sake.c src/eap_common/eap_sake_common.c
442endif
443
444ifdef CONFIG_EAP_GPSK
445L_CFLAGS += -DEAP_SERVER_GPSK
446OBJS += src/eap_server/eap_server_gpsk.c src/eap_common/eap_gpsk_common.c
447ifdef CONFIG_EAP_GPSK_SHA256
448L_CFLAGS += -DEAP_GPSK_SHA256
449endif
450endif
451
452ifdef CONFIG_EAP_PWD
453L_CFLAGS += -DEAP_SERVER_PWD
454OBJS += src/eap_server/eap_server_pwd.c src/eap_common/eap_pwd_common.c
455NEED_ECC=y
456NEED_DRAGONFLY=y
457endif
458
459ifdef CONFIG_EAP_EKE
460L_CFLAGS += -DEAP_SERVER_EKE
461OBJS += src/eap_server/eap_server_eke.c src/eap_common/eap_eke_common.c
462NEED_DH_GROUPS=y
463NEED_DH_GROUPS_ALL=y
464endif
465
466ifdef CONFIG_EAP_VENDOR_TEST
467L_CFLAGS += -DEAP_SERVER_VENDOR_TEST
468OBJS += src/eap_server/eap_server_vendor_test.c
469endif
470
471ifdef CONFIG_EAP_FAST
472L_CFLAGS += -DEAP_SERVER_FAST
473OBJS += src/eap_server/eap_server_fast.c
474OBJS += src/eap_common/eap_fast_common.c
475TLS_FUNCS=y
476NEED_T_PRF=y
477NEED_AES_UNWRAP=y
478endif
479
480ifdef CONFIG_EAP_TEAP
481L_CFLAGS += -DEAP_SERVER_TEAP
482OBJS += src/eap_server/eap_server_teap.c
483OBJS += src/eap_common/eap_teap_common.c
484TLS_FUNCS=y
485NEED_T_PRF=y
486NEED_SHA384=y
487NEED_TLS_PRF_SHA256=y
488NEED_TLS_PRF_SHA384=y
489NEED_AES_UNWRAP=y
490endif
491
492ifdef CONFIG_WPS
493L_CFLAGS += -DCONFIG_WPS -DEAP_SERVER_WSC
494OBJS += src/utils/uuid.c
495OBJS += src/ap/wps_hostapd.c
496OBJS += src/eap_server/eap_server_wsc.c src/eap_common/eap_wsc_common.c
497OBJS += src/wps/wps.c
498OBJS += src/wps/wps_common.c
499OBJS += src/wps/wps_attr_parse.c
500OBJS += src/wps/wps_attr_build.c
501OBJS += src/wps/wps_attr_process.c
502OBJS += src/wps/wps_dev_attr.c
503OBJS += src/wps/wps_enrollee.c
504OBJS += src/wps/wps_registrar.c
505NEED_DH_GROUPS=y
506NEED_BASE64=y
507NEED_AES_CBC=y
508NEED_MODEXP=y
509CONFIG_EAP=y
510
511ifdef CONFIG_WPS_NFC
512L_CFLAGS += -DCONFIG_WPS_NFC
513OBJS += src/wps/ndef.c
514NEED_WPS_OOB=y
515endif
516
517ifdef NEED_WPS_OOB
518L_CFLAGS += -DCONFIG_WPS_OOB
519endif
520
521ifdef CONFIG_WPS_UPNP
522L_CFLAGS += -DCONFIG_WPS_UPNP
523OBJS += src/wps/wps_upnp.c
524OBJS += src/wps/wps_upnp_ssdp.c
525OBJS += src/wps/wps_upnp_web.c
526OBJS += src/wps/wps_upnp_event.c
527OBJS += src/wps/wps_upnp_ap.c
528OBJS += src/wps/upnp_xml.c
529OBJS += src/wps/httpread.c
530OBJS += src/wps/http_client.c
531OBJS += src/wps/http_server.c
532endif
533
534ifdef CONFIG_WPS_STRICT
535L_CFLAGS += -DCONFIG_WPS_STRICT
536OBJS += src/wps/wps_validate.c
537endif
538
539ifdef CONFIG_WPS_TESTING
540L_CFLAGS += -DCONFIG_WPS_TESTING
541endif
542
543endif
544
545ifdef CONFIG_DPP
546L_CFLAGS += -DCONFIG_DPP
547OBJS += src/common/dpp.c
548OBJS += src/common/dpp_auth.c
549OBJS += src/common/dpp_backup.c
550OBJS += src/common/dpp_crypto.c
551OBJS += src/common/dpp_pkex.c
552OBJS += src/common/dpp_reconfig.c
553OBJS += src/common/dpp_tcp.c
554OBJS += src/ap/dpp_hostapd.c
555OBJS += src/ap/gas_query_ap.c
556NEED_AES_SIV=y
557NEED_HMAC_SHA256_KDF=y
558NEED_HMAC_SHA384_KDF=y
559NEED_HMAC_SHA512_KDF=y
560NEED_SHA384=y
561NEED_SHA512=y
562NEED_ECC=y
563NEED_JSON=y
564NEED_GAS=y
565NEED_BASE64=y
566NEED_ASN1=y
567ifdef CONFIG_DPP2
568L_CFLAGS += -DCONFIG_DPP2
569endif
570ifdef CONFIG_DPP3
571L_CFLAGS += -DCONFIG_DPP3
572endif
573endif
574
575ifdef CONFIG_PASN
576L_CFLAGS += -DCONFIG_PASN
577L_CFLAGS += -DCONFIG_PTKSA_CACHE
578NEED_HMAC_SHA256_KDF=y
579NEED_HMAC_SHA384_KDF=y
580NEED_SHA256=y
581NEED_SHA384=y
582OBJS += src/common/ptksa_cache.c
583endif
584
585ifdef CONFIG_EAP_IKEV2
586L_CFLAGS += -DEAP_SERVER_IKEV2
587OBJS += src/eap_server/eap_server_ikev2.c src/eap_server/ikev2.c
588OBJS += src/eap_common/eap_ikev2_common.c src/eap_common/ikev2_common.c
589NEED_DH_GROUPS=y
590NEED_DH_GROUPS_ALL=y
591NEED_MODEXP=y
592NEED_CIPHER=y
593endif
594
595ifdef CONFIG_EAP_TNC
596L_CFLAGS += -DEAP_SERVER_TNC
597OBJS += src/eap_server/eap_server_tnc.c
598OBJS += src/eap_server/tncs.c
599NEED_BASE64=y
600ifndef CONFIG_DRIVER_BSD
601LIBS += -ldl
602endif
603endif
604
605# Basic EAP functionality is needed for EAPOL
606OBJS += eap_register.c
607OBJS += src/eap_server/eap_server.c
608OBJS += src/eap_common/eap_common.c
609OBJS += src/eap_server/eap_server_methods.c
610OBJS += src/eap_server/eap_server_identity.c
611L_CFLAGS += -DEAP_SERVER_IDENTITY
612
613ifdef CONFIG_EAP
614L_CFLAGS += -DEAP_SERVER
615endif
616
617ifdef CONFIG_PKCS12
618L_CFLAGS += -DPKCS12_FUNCS
619endif
620
621ifdef NEED_DRAGONFLY
622OBJS += src/common/dragonfly.c
623endif
624
625ifdef MS_FUNCS
626OBJS += src/crypto/ms_funcs.c
627NEED_DES=y
628NEED_MD4=y
629endif
630
631ifdef CHAP
632OBJS += src/eap_common/chap.c
633endif
634
635ifdef TLS_FUNCS
636NEED_DES=y
637# Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS)
638L_CFLAGS += -DEAP_TLS_FUNCS
639OBJS += src/eap_server/eap_server_tls_common.c
640NEED_TLS_PRF=y
641endif
642
643ifndef CONFIG_TLS
644CONFIG_TLS=openssl
645endif
646
647ifdef CONFIG_TLSV11
648L_CFLAGS += -DCONFIG_TLSV11
649endif
650
651ifdef CONFIG_TLSV12
652L_CFLAGS += -DCONFIG_TLSV12
653endif
654
655ifeq ($(CONFIG_TLS), openssl)
656ifdef TLS_FUNCS
657OBJS += src/crypto/tls_openssl.c
658OBJS += src/crypto/tls_openssl_ocsp.c
659LIBS += -lssl
660endif
661OBJS += src/crypto/crypto_openssl.c
662HOBJS += src/crypto/crypto_openssl.c
663ifdef NEED_FIPS186_2_PRF
664OBJS += src/crypto/fips_prf_openssl.c
665endif
666NEED_TLS_PRF_SHA256=y
667LIBS += -lcrypto
668LIBS_h += -lcrypto
669ifndef CONFIG_TLS_DEFAULT_CIPHERS
670CONFIG_TLS_DEFAULT_CIPHERS = "DEFAULT:!EXP:!LOW"
671endif
672L_CFLAGS += -DTLS_DEFAULT_CIPHERS=\"$(CONFIG_TLS_DEFAULT_CIPHERS)\"
673endif
674
675ifeq ($(CONFIG_TLS), gnutls)
676ifndef CONFIG_CRYPTO
677# default to libgcrypt
678CONFIG_CRYPTO=gnutls
679endif
680ifdef TLS_FUNCS
681OBJS += src/crypto/tls_gnutls.c
682LIBS += -lgnutls -lgpg-error
683endif
684OBJS += src/crypto/crypto_$(CONFIG_CRYPTO).c
685HOBJS += src/crypto/crypto_$(CONFIG_CRYPTO).c
686ifdef NEED_FIPS186_2_PRF
687OBJS += src/crypto/fips_prf_internal.c
688OBJS += src/crypto/sha1-internal.c
689endif
690ifeq ($(CONFIG_CRYPTO), gnutls)
691LIBS += -lgcrypt
692LIBS_h += -lgcrypt
693CONFIG_INTERNAL_RC4=y
694CONFIG_INTERNAL_DH_GROUP5=y
695endif
696ifeq ($(CONFIG_CRYPTO), nettle)
697LIBS += -lnettle -lgmp
698LIBS_p += -lnettle -lgmp
699CONFIG_INTERNAL_RC4=y
700CONFIG_INTERNAL_DH_GROUP5=y
701endif
702endif
703
704ifeq ($(CONFIG_TLS), internal)
705ifndef CONFIG_CRYPTO
706CONFIG_CRYPTO=internal
707endif
708ifdef TLS_FUNCS
709OBJS += src/crypto/crypto_internal-rsa.c
710OBJS += src/crypto/tls_internal.c
711OBJS += src/tls/tlsv1_common.c
712OBJS += src/tls/tlsv1_record.c
713OBJS += src/tls/tlsv1_cred.c
714OBJS += src/tls/tlsv1_server.c
715OBJS += src/tls/tlsv1_server_write.c
716OBJS += src/tls/tlsv1_server_read.c
717OBJS += src/tls/rsa.c
718OBJS += src/tls/x509v3.c
719OBJS += src/tls/pkcs1.c
720OBJS += src/tls/pkcs5.c
721OBJS += src/tls/pkcs8.c
722NEED_ASN1=y
723NEED_BASE64=y
724NEED_TLS_PRF=y
725ifdef CONFIG_TLSV12
726NEED_TLS_PRF_SHA256=y
727endif
728NEED_MODEXP=y
729NEED_CIPHER=y
730L_CFLAGS += -DCONFIG_TLS_INTERNAL
731L_CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER
732endif
733ifdef NEED_CIPHER
734NEED_DES=y
735OBJS += src/crypto/crypto_internal-cipher.c
736endif
737ifdef NEED_MODEXP
738OBJS += src/crypto/crypto_internal-modexp.c
739OBJS += src/tls/bignum.c
740endif
741ifeq ($(CONFIG_CRYPTO), libtomcrypt)
742OBJS += src/crypto/crypto_libtomcrypt.c
743LIBS += -ltomcrypt -ltfm
744LIBS_h += -ltomcrypt -ltfm
745CONFIG_INTERNAL_SHA256=y
746CONFIG_INTERNAL_RC4=y
747CONFIG_INTERNAL_DH_GROUP5=y
748endif
749ifeq ($(CONFIG_CRYPTO), internal)
750OBJS += src/crypto/crypto_internal.c
751NEED_AES_DEC=y
752L_CFLAGS += -DCONFIG_CRYPTO_INTERNAL
753ifdef CONFIG_INTERNAL_LIBTOMMATH
754L_CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
755ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST
756L_CFLAGS += -DLTM_FAST
757endif
758else
759LIBS += -ltommath
760LIBS_h += -ltommath
761endif
762CONFIG_INTERNAL_AES=y
763CONFIG_INTERNAL_DES=y
764CONFIG_INTERNAL_SHA1=y
765CONFIG_INTERNAL_MD4=y
766CONFIG_INTERNAL_MD5=y
767CONFIG_INTERNAL_SHA256=y
768CONFIG_INTERNAL_SHA384=y
769CONFIG_INTERNAL_SHA512=y
770CONFIG_INTERNAL_RC4=y
771CONFIG_INTERNAL_DH_GROUP5=y
772endif
773ifeq ($(CONFIG_CRYPTO), cryptoapi)
774OBJS += src/crypto/crypto_cryptoapi.c
775OBJS_p += src/crypto/crypto_cryptoapi.c
776L_CFLAGS += -DCONFIG_CRYPTO_CRYPTOAPI
777CONFIG_INTERNAL_SHA256=y
778CONFIG_INTERNAL_RC4=y
779endif
780endif
781
782ifeq ($(CONFIG_TLS), none)
783ifdef TLS_FUNCS
784OBJS += src/crypto/tls_none.c
785L_CFLAGS += -DEAP_TLS_NONE
786CONFIG_INTERNAL_AES=y
787CONFIG_INTERNAL_SHA1=y
788CONFIG_INTERNAL_MD5=y
789endif
790OBJS += src/crypto/crypto_none.c
791OBJS_p += src/crypto/crypto_none.c
792CONFIG_INTERNAL_SHA256=y
793CONFIG_INTERNAL_RC4=y
794endif
795
796ifndef TLS_FUNCS
797OBJS += src/crypto/tls_none.c
798ifeq ($(CONFIG_TLS), internal)
799CONFIG_INTERNAL_AES=y
800CONFIG_INTERNAL_SHA1=y
801CONFIG_INTERNAL_MD5=y
802CONFIG_INTERNAL_RC4=y
803endif
804endif
805
806AESOBJS = # none so far
807ifdef CONFIG_INTERNAL_AES
808AESOBJS += src/crypto/aes-internal.c src/crypto/aes-internal-enc.c
809endif
810
811ifneq ($(CONFIG_TLS), openssl)
812AESOBJS += src/crypto/aes-wrap.c
813endif
814ifdef NEED_AES_EAX
815AESOBJS += src/crypto/aes-eax.c
816NEED_AES_CTR=y
817endif
818ifdef NEED_AES_SIV
819AESOBJS += src/crypto/aes-siv.c
820NEED_AES_CTR=y
821endif
822ifdef NEED_AES_CTR
823AESOBJS += src/crypto/aes-ctr.c
824endif
825ifdef NEED_AES_ENCBLOCK
826AESOBJS += src/crypto/aes-encblock.c
827endif
828AESOBJS += src/crypto/aes-omac1.c
829ifdef NEED_AES_UNWRAP
830ifneq ($(CONFIG_TLS), openssl)
831NEED_AES_DEC=y
832AESOBJS += src/crypto/aes-unwrap.c
833endif
834endif
835ifdef NEED_AES_CBC
836NEED_AES_DEC=y
837ifneq ($(CONFIG_TLS), openssl)
838AESOBJS += src/crypto/aes-cbc.c
839endif
840endif
841ifdef NEED_AES_DEC
842ifdef CONFIG_INTERNAL_AES
843AESOBJS += src/crypto/aes-internal-dec.c
844endif
845endif
846ifdef NEED_AES
847OBJS += $(AESOBJS)
848endif
849
850SHA1OBJS =
851ifdef NEED_SHA1
852ifneq ($(CONFIG_TLS), openssl)
853ifneq ($(CONFIG_TLS), gnutls)
854SHA1OBJS += src/crypto/sha1.c
855endif
856endif
857SHA1OBJS += src/crypto/sha1-prf.c
858ifdef CONFIG_INTERNAL_SHA1
859SHA1OBJS += src/crypto/sha1-internal.c
860ifdef NEED_FIPS186_2_PRF
861SHA1OBJS += src/crypto/fips_prf_internal.c
862endif
863endif
864ifneq ($(CONFIG_TLS), openssl)
865SHA1OBJS += src/crypto/sha1-pbkdf2.c
866endif
867ifdef NEED_T_PRF
868SHA1OBJS += src/crypto/sha1-tprf.c
869endif
870ifdef NEED_TLS_PRF
871SHA1OBJS += src/crypto/sha1-tlsprf.c
872endif
873endif
874
875ifdef NEED_SHA1
876OBJS += $(SHA1OBJS)
877endif
878
879ifneq ($(CONFIG_TLS), openssl)
880ifneq ($(CONFIG_TLS), gnutls)
881OBJS += src/crypto/md5.c
882endif
883endif
884
885ifdef NEED_MD5
886ifdef CONFIG_INTERNAL_MD5
887OBJS += src/crypto/md5-internal.c
888HOBJS += src/crypto/md5-internal.c
889endif
890endif
891
892ifdef NEED_MD4
893ifdef CONFIG_INTERNAL_MD4
894OBJS += src/crypto/md4-internal.c
895endif
896endif
897
898ifdef NEED_DES
899ifdef CONFIG_INTERNAL_DES
900OBJS += src/crypto/des-internal.c
901endif
902endif
903
904ifdef CONFIG_NO_RC4
905L_CFLAGS += -DCONFIG_NO_RC4
906endif
907
908ifdef NEED_RC4
909ifdef CONFIG_INTERNAL_RC4
910ifndef CONFIG_NO_RC4
911OBJS += src/crypto/rc4.c
912endif
913endif
914endif
915
916L_CFLAGS += -DCONFIG_SHA256
917ifneq ($(CONFIG_TLS), openssl)
918ifneq ($(CONFIG_TLS), gnutls)
919OBJS += src/crypto/sha256.c
920endif
921endif
922OBJS += src/crypto/sha256-prf.c
923ifdef CONFIG_INTERNAL_SHA256
924OBJS += src/crypto/sha256-internal.c
925endif
926ifdef NEED_TLS_PRF_SHA256
927OBJS += src/crypto/sha256-tlsprf.c
928endif
929ifdef NEED_TLS_PRF_SHA384
930OBJS += src/crypto/sha384-tlsprf.c
931endif
932ifdef NEED_HMAC_SHA256_KDF
933OBJS += src/crypto/sha256-kdf.c
934endif
935ifdef NEED_HMAC_SHA384_KDF
936OBJS += src/crypto/sha384-kdf.c
937endif
938ifdef NEED_HMAC_SHA512_KDF
939OBJS += src/crypto/sha512-kdf.c
940endif
941ifdef NEED_SHA384
942L_CFLAGS += -DCONFIG_SHA384
943ifneq ($(CONFIG_TLS), openssl)
944ifneq ($(CONFIG_TLS), gnutls)
945OBJS += src/crypto/sha384.c
946endif
947endif
948OBJS += src/crypto/sha384-prf.c
949endif
950ifdef NEED_SHA512
951L_CFLAGS += -DCONFIG_SHA512
952ifneq ($(CONFIG_TLS), openssl)
953ifneq ($(CONFIG_TLS), linux)
954ifneq ($(CONFIG_TLS), gnutls)
955OBJS += src/crypto/sha512.c
956endif
957endif
958endif
959OBJS += src/crypto/sha512-prf.c
960endif
961
962ifdef CONFIG_INTERNAL_SHA384
963L_CFLAGS += -DCONFIG_INTERNAL_SHA384
964OBJS += src/crypto/sha384-internal.c
965endif
966
967ifdef CONFIG_INTERNAL_SHA512
968L_CFLAGS += -DCONFIG_INTERNAL_SHA512
969OBJS += src/crypto/sha512-internal.c
970endif
971
972ifdef NEED_ASN1
973OBJS += src/tls/asn1.c
974endif
975
976ifdef NEED_DH_GROUPS
977OBJS += src/crypto/dh_groups.c
978endif
979ifdef NEED_DH_GROUPS_ALL
980L_CFLAGS += -DALL_DH_GROUPS
981endif
982ifdef CONFIG_INTERNAL_DH_GROUP5
983ifdef NEED_DH_GROUPS
984OBJS += src/crypto/dh_group5.c
985endif
986endif
987
988ifdef NEED_ECC
989L_CFLAGS += -DCONFIG_ECC
990endif
991
992ifdef CONFIG_NO_RANDOM_POOL
993L_CFLAGS += -DCONFIG_NO_RANDOM_POOL
994else
995OBJS += src/crypto/random.c
996HOBJS += src/crypto/random.c
997HOBJS += src/utils/eloop.c
998HOBJS += $(SHA1OBJS)
999ifneq ($(CONFIG_TLS), openssl)
1000HOBJS += src/crypto/md5.c
1001endif
1002endif
1003
1004ifdef CONFIG_RADIUS_SERVER
1005L_CFLAGS += -DRADIUS_SERVER
1006OBJS += src/radius/radius_server.c
1007endif
1008
1009ifdef CONFIG_IPV6
1010L_CFLAGS += -DCONFIG_IPV6
1011endif
1012
1013ifdef CONFIG_DRIVER_RADIUS_ACL
1014L_CFLAGS += -DCONFIG_DRIVER_RADIUS_ACL
1015endif
1016
1017ifdef NEED_BASE64
1018OBJS += src/utils/base64.c
1019endif
1020
1021ifdef NEED_JSON
1022OBJS += src/utils/json.c
1023L_CFLAGS += -DCONFIG_JSON
1024endif
1025
1026ifdef NEED_AP_MLME
1027OBJS += src/ap/wmm.c
1028OBJS += src/ap/ap_list.c
1029OBJS += src/ap/ieee802_11.c
1030OBJS += src/ap/hw_features.c
1031OBJS += src/ap/dfs.c
1032L_CFLAGS += -DNEED_AP_MLME
1033endif
1034OBJS += src/ap/ieee802_11_ht.c
1035
1036ifdef CONFIG_IEEE80211AC
1037OBJS += src/ap/ieee802_11_vht.c
1038endif
1039
1040ifdef CONFIG_IEEE80211AX
1041OBJS += src/ap/ieee802_11_he.c
1042endif
1043
1044ifdef CONFIG_P2P_MANAGER
1045L_CFLAGS += -DCONFIG_P2P_MANAGER
1046OBJS += src/ap/p2p_hostapd.c
1047endif
1048
1049ifdef CONFIG_HS20
1050L_CFLAGS += -DCONFIG_HS20
1051OBJS += src/ap/hs20.c
1052CONFIG_INTERWORKING=y
1053endif
1054
1055ifdef CONFIG_INTERWORKING
1056L_CFLAGS += -DCONFIG_INTERWORKING
1057NEED_GAS=y
1058endif
1059
1060ifdef NEED_GAS
1061OBJS += src/common/gas.c
1062OBJS += src/ap/gas_serv.c
1063endif
1064
1065ifdef CONFIG_PROXYARP
1066L_CFLAGS += -DCONFIG_PROXYARP
1067OBJS += src/ap/x_snoop.c
1068OBJS += src/ap/dhcp_snoop.c
1069ifdef CONFIG_IPV6
1070OBJS += src/ap/ndisc_snoop.c
1071endif
1072endif
1073
1074OBJS += src/drivers/driver_common.c
1075
1076ifdef CONFIG_ACS
1077L_CFLAGS += -DCONFIG_ACS
1078OBJS += src/ap/acs.c
1079LIBS += -lm
1080endif
1081
1082ifdef CONFIG_NO_STDOUT_DEBUG
1083L_CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
1084endif
1085
1086ifdef CONFIG_DEBUG_SYSLOG
1087L_CFLAGS += -DCONFIG_DEBUG_SYSLOG
1088endif
1089
1090ifdef CONFIG_DEBUG_LINUX_TRACING
1091L_CFLAGS += -DCONFIG_DEBUG_LINUX_TRACING
1092endif
1093
1094ifdef CONFIG_DEBUG_FILE
1095L_CFLAGS += -DCONFIG_DEBUG_FILE
1096endif
1097
1098ifdef CONFIG_ANDROID_LOG
1099L_CFLAGS += -DCONFIG_ANDROID_LOG
1100endif
1101
1102OBJS_c = hostapd_cli.c
1103OBJS_c += src/common/wpa_ctrl.c
1104OBJS_c += src/utils/os_$(CONFIG_OS).c
1105OBJS_c += src/common/cli.c
1106OBJS_c += src/utils/eloop.c
1107OBJS_c += src/utils/common.c
1108ifdef CONFIG_WPA_TRACE
1109OBJS_c += src/utils/trace.c
1110endif
1111OBJS_c += src/utils/wpa_debug.c
1112ifdef CONFIG_WPA_CLI_EDIT
1113OBJS_c += src/utils/edit.c
1114else
1115OBJS_c += src/utils/edit_simple.c
1116endif
1117
1118########################
1119
1120include $(CLEAR_VARS)
1121LOCAL_MODULE := hostapd_cli
1122LOCAL_MODULE_TAGS := debug
1123LOCAL_PROPRIETARY_MODULE := true
1124LOCAL_SHARED_LIBRARIES := libc libcutils liblog
1125LOCAL_CFLAGS := $(L_CFLAGS)
1126LOCAL_SRC_FILES := $(OBJS_c)
1127LOCAL_C_INCLUDES := $(INCLUDES)
1128include $(BUILD_EXECUTABLE)
1129
1130########################
1131include $(CLEAR_VARS)
1132LOCAL_MODULE := hostapd
1133LOCAL_MODULE_TAGS := optional
1134LOCAL_PROPRIETARY_MODULE := true
1135ifdef CONFIG_DRIVER_CUSTOM
1136LOCAL_STATIC_LIBRARIES := libCustomWifi
1137endif
1138ifneq ($(BOARD_HOSTAPD_PRIVATE_LIB),)
1139LOCAL_STATIC_LIBRARIES += $(BOARD_HOSTAPD_PRIVATE_LIB)
1140endif
1141LOCAL_SHARED_LIBRARIES := libc libcutils liblog libcrypto libssl
1142ifdef CONFIG_DRIVER_NL80211
1143ifneq ($(wildcard external/libnl),)
1144LOCAL_SHARED_LIBRARIES += libnl
1145else
1146LOCAL_STATIC_LIBRARIES += libnl_2
1147endif
1148endif
1149LOCAL_CFLAGS := $(L_CFLAGS)
1150LOCAL_SRC_FILES := $(OBJS)
1151LOCAL_C_INCLUDES := $(INCLUDES)
1152LOCAL_INIT_RC := hostapd.android.rc
1153include $(BUILD_EXECUTABLE)
1154
1155endif # ifeq ($(WPA_BUILD_HOSTAPD),true)
1156