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