Makefile 22 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087
  1. ifndef CC
  2. CC=gcc
  3. endif
  4. ifndef CFLAGS
  5. CFLAGS = -MMD -O2 -Wall -g
  6. endif
  7. ifdef LIBS
  8. # If LIBS is set with some global build system defaults, clone those for
  9. # LIBS_c, LIBS_h, and LIBS_n to cover hostapd_cli, hlr_auc_gw, and
  10. # nt_password_hash as well.
  11. ifndef LIBS_c
  12. LIBS_c := $(LIBS)
  13. endif
  14. ifndef LIBS_h
  15. LIBS_h := $(LIBS)
  16. endif
  17. ifndef LIBS_n
  18. LIBS_n := $(LIBS)
  19. endif
  20. endif
  21. CFLAGS += $(EXTRA_CFLAGS)
  22. CFLAGS += -I$(abspath ../src)
  23. CFLAGS += -I$(abspath ../src/utils)
  24. export BINDIR ?= /usr/local/bin/
  25. # Uncomment following line and set the path to your kernel tree include
  26. # directory if your C library does not include all header files.
  27. # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
  28. -include .config
  29. ifndef CONFIG_NO_GITVER
  30. # Add VERSION_STR postfix for builds from a git repository
  31. ifeq ($(wildcard ../.git),../.git)
  32. GITVER := $(shell git describe --dirty=+)
  33. ifneq ($(GITVER),)
  34. CFLAGS += -DGIT_VERSION_STR_POSTFIX=\"-$(GITVER)\"
  35. endif
  36. endif
  37. endif
  38. ifdef CONFIG_TESTING_OPTIONS
  39. CFLAGS += -DCONFIG_TESTING_OPTIONS
  40. CONFIG_WPS_TESTING=y
  41. endif
  42. ifndef CONFIG_OS
  43. ifdef CONFIG_NATIVE_WINDOWS
  44. CONFIG_OS=win32
  45. else
  46. CONFIG_OS=unix
  47. endif
  48. endif
  49. ifeq ($(CONFIG_OS), internal)
  50. CFLAGS += -DOS_NO_C_LIB_DEFINES
  51. endif
  52. ifdef CONFIG_NATIVE_WINDOWS
  53. CFLAGS += -DCONFIG_NATIVE_WINDOWS
  54. LIBS += -lws2_32
  55. endif
  56. OBJS += main.o
  57. OBJS += config_file.o
  58. OBJS += ../src/ap/hostapd.o
  59. OBJS += ../src/ap/wpa_auth_glue.o
  60. OBJS += ../src/ap/drv_callbacks.o
  61. OBJS += ../src/ap/ap_drv_ops.o
  62. OBJS += ../src/ap/utils.o
  63. OBJS += ../src/ap/authsrv.o
  64. OBJS += ../src/ap/ieee802_1x.o
  65. OBJS += ../src/ap/ap_config.o
  66. OBJS += ../src/ap/eap_user_db.o
  67. OBJS += ../src/ap/ieee802_11_auth.o
  68. OBJS += ../src/ap/sta_info.o
  69. OBJS += ../src/ap/wpa_auth.o
  70. OBJS += ../src/ap/tkip_countermeasures.o
  71. OBJS += ../src/ap/ap_mlme.o
  72. OBJS += ../src/ap/wpa_auth_ie.o
  73. OBJS += ../src/ap/preauth_auth.o
  74. OBJS += ../src/ap/pmksa_cache_auth.o
  75. OBJS += ../src/ap/ieee802_11_shared.o
  76. OBJS += ../src/ap/beacon.o
  77. OBJS += ../src/ap/bss_load.o
  78. OBJS_c = hostapd_cli.o ../src/common/wpa_ctrl.o ../src/utils/os_$(CONFIG_OS).o
  79. NEED_RC4=y
  80. NEED_AES=y
  81. NEED_MD5=y
  82. NEED_SHA1=y
  83. OBJS += ../src/drivers/drivers.o
  84. CFLAGS += -DHOSTAPD
  85. ifdef CONFIG_MODULE_TESTS
  86. CFLAGS += -DCONFIG_MODULE_TESTS
  87. OBJS += hapd_module_tests.o
  88. endif
  89. ifdef CONFIG_WPA_TRACE
  90. CFLAGS += -DWPA_TRACE
  91. OBJS += ../src/utils/trace.o
  92. HOBJS += ../src/utils/trace.o
  93. LDFLAGS += -rdynamic
  94. CFLAGS += -funwind-tables
  95. ifdef CONFIG_WPA_TRACE_BFD
  96. CFLAGS += -DPACKAGE="hostapd" -DWPA_TRACE_BFD
  97. LIBS += -lbfd -ldl -liberty -lz
  98. LIBS_c += -lbfd -ldl -liberty -lz
  99. LIBS_h += -lbfd -ldl -liberty -lz
  100. endif
  101. endif
  102. ifndef CONFIG_ELOOP
  103. CONFIG_ELOOP=eloop
  104. endif
  105. OBJS += ../src/utils/$(CONFIG_ELOOP).o
  106. OBJS_c += ../src/utils/$(CONFIG_ELOOP).o
  107. ifeq ($(CONFIG_ELOOP), eloop)
  108. # Using glibc < 2.17 requires -lrt for clock_gettime()
  109. LIBS += -lrt
  110. LIBS_c += -lrt
  111. LIBS_h += -lrt
  112. LIBS_n += -lrt
  113. endif
  114. ifdef CONFIG_ELOOP_POLL
  115. CFLAGS += -DCONFIG_ELOOP_POLL
  116. endif
  117. ifdef CONFIG_ELOOP_EPOLL
  118. CFLAGS += -DCONFIG_ELOOP_EPOLL
  119. endif
  120. ifdef CONFIG_ELOOP_KQUEUE
  121. CFLAGS += -DCONFIG_ELOOP_KQUEUE
  122. endif
  123. OBJS += ../src/utils/common.o
  124. OBJS_c += ../src/utils/common.o
  125. OBJS += ../src/utils/wpa_debug.o
  126. OBJS_c += ../src/utils/wpa_debug.o
  127. OBJS += ../src/utils/wpabuf.o
  128. OBJS += ../src/utils/os_$(CONFIG_OS).o
  129. OBJS += ../src/utils/ip_addr.o
  130. OBJS += ../src/common/ieee802_11_common.o
  131. OBJS += ../src/common/wpa_common.o
  132. OBJS += ../src/common/hw_features_common.o
  133. OBJS += ../src/eapol_auth/eapol_auth_sm.o
  134. ifdef CONFIG_CODE_COVERAGE
  135. CFLAGS += -O0 -fprofile-arcs -ftest-coverage
  136. LIBS += -lgcov
  137. LIBS_c += -lgcov
  138. LIBS_h += -lgcov
  139. LIBS_n += -lgcov
  140. endif
  141. ifndef CONFIG_NO_DUMP_STATE
  142. # define HOSTAPD_DUMP_STATE to include support for dumping internal state
  143. # through control interface commands (undefine it, if you want to save in
  144. # binary size)
  145. CFLAGS += -DHOSTAPD_DUMP_STATE
  146. OBJS += ../src/eapol_auth/eapol_auth_dump.o
  147. endif
  148. ifdef CONFIG_NO_RADIUS
  149. CFLAGS += -DCONFIG_NO_RADIUS
  150. CONFIG_NO_ACCOUNTING=y
  151. else
  152. OBJS += ../src/radius/radius.o
  153. OBJS += ../src/radius/radius_client.o
  154. OBJS += ../src/radius/radius_das.o
  155. endif
  156. ifdef CONFIG_NO_ACCOUNTING
  157. CFLAGS += -DCONFIG_NO_ACCOUNTING
  158. else
  159. OBJS += ../src/ap/accounting.o
  160. endif
  161. ifdef CONFIG_NO_VLAN
  162. CFLAGS += -DCONFIG_NO_VLAN
  163. else
  164. OBJS += ../src/ap/vlan_init.o
  165. OBJS += ../src/ap/vlan.o
  166. ifdef CONFIG_VLAN_NETLINK
  167. ifdef CONFIG_FULL_DYNAMIC_VLAN
  168. OBJS += ../src/ap/vlan_util.o
  169. endif
  170. CFLAGS += -DCONFIG_VLAN_NETLINK
  171. endif
  172. endif
  173. ifdef CONFIG_NO_CTRL_IFACE
  174. CFLAGS += -DCONFIG_NO_CTRL_IFACE
  175. else
  176. OBJS += ctrl_iface.o
  177. OBJS += ../src/ap/ctrl_iface_ap.o
  178. endif
  179. CFLAGS += -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX
  180. ifdef CONFIG_IAPP
  181. CFLAGS += -DCONFIG_IAPP
  182. OBJS += ../src/ap/iapp.o
  183. endif
  184. ifdef CONFIG_RSN_PREAUTH
  185. CFLAGS += -DCONFIG_RSN_PREAUTH
  186. CONFIG_L2_PACKET=y
  187. endif
  188. ifdef CONFIG_PEERKEY
  189. CFLAGS += -DCONFIG_PEERKEY
  190. OBJS += ../src/ap/peerkey_auth.o
  191. endif
  192. ifdef CONFIG_HS20
  193. NEED_AES_OMAC1=y
  194. CONFIG_PROXYARP=y
  195. endif
  196. ifdef CONFIG_PROXYARP
  197. CONFIG_L2_PACKET=y
  198. endif
  199. ifdef CONFIG_SUITEB
  200. CFLAGS += -DCONFIG_SUITEB
  201. NEED_SHA256=y
  202. NEED_AES_OMAC1=y
  203. endif
  204. ifdef CONFIG_SUITEB192
  205. CFLAGS += -DCONFIG_SUITEB192
  206. NEED_SHA384=y
  207. endif
  208. ifdef CONFIG_IEEE80211W
  209. CFLAGS += -DCONFIG_IEEE80211W
  210. NEED_SHA256=y
  211. NEED_AES_OMAC1=y
  212. endif
  213. ifdef CONFIG_IEEE80211R
  214. CFLAGS += -DCONFIG_IEEE80211R
  215. OBJS += ../src/ap/wpa_auth_ft.o
  216. NEED_SHA256=y
  217. NEED_AES_OMAC1=y
  218. NEED_AES_UNWRAP=y
  219. endif
  220. ifdef CONFIG_SAE
  221. CFLAGS += -DCONFIG_SAE
  222. OBJS += ../src/common/sae.o
  223. NEED_ECC=y
  224. NEED_DH_GROUPS=y
  225. NEED_AP_MLME=y
  226. endif
  227. ifdef CONFIG_WNM
  228. CFLAGS += -DCONFIG_WNM
  229. OBJS += ../src/ap/wnm_ap.o
  230. endif
  231. ifdef CONFIG_IEEE80211N
  232. CFLAGS += -DCONFIG_IEEE80211N
  233. endif
  234. ifdef CONFIG_IEEE80211AC
  235. CFLAGS += -DCONFIG_IEEE80211AC
  236. endif
  237. include ../src/drivers/drivers.mak
  238. OBJS += $(DRV_AP_OBJS)
  239. CFLAGS += $(DRV_AP_CFLAGS)
  240. LDFLAGS += $(DRV_AP_LDFLAGS)
  241. LIBS += $(DRV_AP_LIBS)
  242. ifdef CONFIG_L2_PACKET
  243. ifdef CONFIG_DNET_PCAP
  244. ifdef CONFIG_L2_FREEBSD
  245. LIBS += -lpcap
  246. OBJS += ../src/l2_packet/l2_packet_freebsd.o
  247. else
  248. LIBS += -ldnet -lpcap
  249. OBJS += ../src/l2_packet/l2_packet_pcap.o
  250. endif
  251. else
  252. OBJS += ../src/l2_packet/l2_packet_linux.o
  253. endif
  254. else
  255. OBJS += ../src/l2_packet/l2_packet_none.o
  256. endif
  257. ifdef CONFIG_ERP
  258. CFLAGS += -DCONFIG_ERP
  259. NEED_SHA256=y
  260. NEED_HMAC_SHA256_KDF=y
  261. endif
  262. ifdef CONFIG_EAP_MD5
  263. CFLAGS += -DEAP_SERVER_MD5
  264. OBJS += ../src/eap_server/eap_server_md5.o
  265. CHAP=y
  266. endif
  267. ifdef CONFIG_EAP_TLS
  268. CFLAGS += -DEAP_SERVER_TLS
  269. OBJS += ../src/eap_server/eap_server_tls.o
  270. TLS_FUNCS=y
  271. endif
  272. ifdef CONFIG_EAP_UNAUTH_TLS
  273. CFLAGS += -DEAP_SERVER_UNAUTH_TLS
  274. ifndef CONFIG_EAP_TLS
  275. OBJS += ../src/eap_server/eap_server_tls.o
  276. TLS_FUNCS=y
  277. endif
  278. endif
  279. ifdef CONFIG_EAP_PEAP
  280. CFLAGS += -DEAP_SERVER_PEAP
  281. OBJS += ../src/eap_server/eap_server_peap.o
  282. OBJS += ../src/eap_common/eap_peap_common.o
  283. TLS_FUNCS=y
  284. CONFIG_EAP_MSCHAPV2=y
  285. endif
  286. ifdef CONFIG_EAP_TTLS
  287. CFLAGS += -DEAP_SERVER_TTLS
  288. OBJS += ../src/eap_server/eap_server_ttls.o
  289. TLS_FUNCS=y
  290. CHAP=y
  291. endif
  292. ifdef CONFIG_EAP_MSCHAPV2
  293. CFLAGS += -DEAP_SERVER_MSCHAPV2
  294. OBJS += ../src/eap_server/eap_server_mschapv2.o
  295. MS_FUNCS=y
  296. endif
  297. ifdef CONFIG_EAP_GTC
  298. CFLAGS += -DEAP_SERVER_GTC
  299. OBJS += ../src/eap_server/eap_server_gtc.o
  300. endif
  301. ifdef CONFIG_EAP_SIM
  302. CFLAGS += -DEAP_SERVER_SIM
  303. OBJS += ../src/eap_server/eap_server_sim.o
  304. CONFIG_EAP_SIM_COMMON=y
  305. NEED_AES_CBC=y
  306. endif
  307. ifdef CONFIG_EAP_AKA
  308. CFLAGS += -DEAP_SERVER_AKA
  309. OBJS += ../src/eap_server/eap_server_aka.o
  310. CONFIG_EAP_SIM_COMMON=y
  311. NEED_SHA256=y
  312. NEED_AES_CBC=y
  313. endif
  314. ifdef CONFIG_EAP_AKA_PRIME
  315. CFLAGS += -DEAP_SERVER_AKA_PRIME
  316. endif
  317. ifdef CONFIG_EAP_SIM_COMMON
  318. OBJS += ../src/eap_common/eap_sim_common.o
  319. # Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be
  320. # replaced with another file implementating the interface specified in
  321. # eap_sim_db.h.
  322. OBJS += ../src/eap_server/eap_sim_db.o
  323. NEED_FIPS186_2_PRF=y
  324. endif
  325. ifdef CONFIG_EAP_PAX
  326. CFLAGS += -DEAP_SERVER_PAX
  327. OBJS += ../src/eap_server/eap_server_pax.o ../src/eap_common/eap_pax_common.o
  328. endif
  329. ifdef CONFIG_EAP_PSK
  330. CFLAGS += -DEAP_SERVER_PSK
  331. OBJS += ../src/eap_server/eap_server_psk.o ../src/eap_common/eap_psk_common.o
  332. NEED_AES_OMAC1=y
  333. NEED_AES_ENCBLOCK=y
  334. NEED_AES_EAX=y
  335. endif
  336. ifdef CONFIG_EAP_SAKE
  337. CFLAGS += -DEAP_SERVER_SAKE
  338. OBJS += ../src/eap_server/eap_server_sake.o ../src/eap_common/eap_sake_common.o
  339. endif
  340. ifdef CONFIG_EAP_GPSK
  341. CFLAGS += -DEAP_SERVER_GPSK
  342. OBJS += ../src/eap_server/eap_server_gpsk.o ../src/eap_common/eap_gpsk_common.o
  343. ifdef CONFIG_EAP_GPSK_SHA256
  344. CFLAGS += -DEAP_GPSK_SHA256
  345. endif
  346. NEED_SHA256=y
  347. NEED_AES_OMAC1=y
  348. endif
  349. ifdef CONFIG_EAP_PWD
  350. CFLAGS += -DEAP_SERVER_PWD
  351. OBJS += ../src/eap_server/eap_server_pwd.o ../src/eap_common/eap_pwd_common.o
  352. NEED_SHA256=y
  353. endif
  354. ifdef CONFIG_EAP_EKE
  355. CFLAGS += -DEAP_SERVER_EKE
  356. OBJS += ../src/eap_server/eap_server_eke.o ../src/eap_common/eap_eke_common.o
  357. NEED_DH_GROUPS=y
  358. NEED_DH_GROUPS_ALL=y
  359. endif
  360. ifdef CONFIG_EAP_VENDOR_TEST
  361. CFLAGS += -DEAP_SERVER_VENDOR_TEST
  362. OBJS += ../src/eap_server/eap_server_vendor_test.o
  363. endif
  364. ifdef CONFIG_EAP_FAST
  365. CFLAGS += -DEAP_SERVER_FAST
  366. OBJS += ../src/eap_server/eap_server_fast.o
  367. OBJS += ../src/eap_common/eap_fast_common.o
  368. TLS_FUNCS=y
  369. NEED_T_PRF=y
  370. NEED_AES_UNWRAP=y
  371. endif
  372. ifdef CONFIG_WPS
  373. CFLAGS += -DCONFIG_WPS -DEAP_SERVER_WSC
  374. OBJS += ../src/utils/uuid.o
  375. OBJS += ../src/ap/wps_hostapd.o
  376. OBJS += ../src/eap_server/eap_server_wsc.o ../src/eap_common/eap_wsc_common.o
  377. OBJS += ../src/wps/wps.o
  378. OBJS += ../src/wps/wps_common.o
  379. OBJS += ../src/wps/wps_attr_parse.o
  380. OBJS += ../src/wps/wps_attr_build.o
  381. OBJS += ../src/wps/wps_attr_process.o
  382. OBJS += ../src/wps/wps_dev_attr.o
  383. OBJS += ../src/wps/wps_enrollee.o
  384. OBJS += ../src/wps/wps_registrar.o
  385. NEED_DH_GROUPS=y
  386. NEED_SHA256=y
  387. NEED_BASE64=y
  388. NEED_AES_CBC=y
  389. NEED_MODEXP=y
  390. CONFIG_EAP=y
  391. ifdef CONFIG_WPS_NFC
  392. CFLAGS += -DCONFIG_WPS_NFC
  393. OBJS += ../src/wps/ndef.o
  394. NEED_WPS_OOB=y
  395. endif
  396. ifdef NEED_WPS_OOB
  397. CFLAGS += -DCONFIG_WPS_OOB
  398. endif
  399. ifdef CONFIG_WPS_UPNP
  400. CFLAGS += -DCONFIG_WPS_UPNP
  401. OBJS += ../src/wps/wps_upnp.o
  402. OBJS += ../src/wps/wps_upnp_ssdp.o
  403. OBJS += ../src/wps/wps_upnp_web.o
  404. OBJS += ../src/wps/wps_upnp_event.o
  405. OBJS += ../src/wps/wps_upnp_ap.o
  406. OBJS += ../src/wps/upnp_xml.o
  407. OBJS += ../src/wps/httpread.o
  408. OBJS += ../src/wps/http_client.o
  409. OBJS += ../src/wps/http_server.o
  410. endif
  411. ifdef CONFIG_WPS_STRICT
  412. CFLAGS += -DCONFIG_WPS_STRICT
  413. OBJS += ../src/wps/wps_validate.o
  414. endif
  415. ifdef CONFIG_WPS_TESTING
  416. CFLAGS += -DCONFIG_WPS_TESTING
  417. endif
  418. endif
  419. ifdef CONFIG_EAP_IKEV2
  420. CFLAGS += -DEAP_SERVER_IKEV2
  421. OBJS += ../src/eap_server/eap_server_ikev2.o ../src/eap_server/ikev2.o
  422. OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
  423. NEED_DH_GROUPS=y
  424. NEED_DH_GROUPS_ALL=y
  425. NEED_MODEXP=y
  426. NEED_CIPHER=y
  427. endif
  428. ifdef CONFIG_EAP_TNC
  429. CFLAGS += -DEAP_SERVER_TNC
  430. OBJS += ../src/eap_server/eap_server_tnc.o
  431. OBJS += ../src/eap_server/tncs.o
  432. NEED_BASE64=y
  433. ifndef CONFIG_DRIVER_BSD
  434. LIBS += -ldl
  435. endif
  436. endif
  437. # Basic EAP functionality is needed for EAPOL
  438. OBJS += eap_register.o
  439. OBJS += ../src/eap_server/eap_server.o
  440. OBJS += ../src/eap_common/eap_common.o
  441. OBJS += ../src/eap_server/eap_server_methods.o
  442. OBJS += ../src/eap_server/eap_server_identity.o
  443. CFLAGS += -DEAP_SERVER_IDENTITY
  444. ifdef CONFIG_EAP
  445. CFLAGS += -DEAP_SERVER
  446. endif
  447. ifdef CONFIG_PKCS12
  448. CFLAGS += -DPKCS12_FUNCS
  449. endif
  450. ifdef MS_FUNCS
  451. OBJS += ../src/crypto/ms_funcs.o
  452. NEED_DES=y
  453. NEED_MD4=y
  454. endif
  455. ifdef CHAP
  456. OBJS += ../src/eap_common/chap.o
  457. endif
  458. ifdef TLS_FUNCS
  459. NEED_DES=y
  460. # Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS)
  461. CFLAGS += -DEAP_TLS_FUNCS
  462. OBJS += ../src/eap_server/eap_server_tls_common.o
  463. NEED_TLS_PRF=y
  464. endif
  465. ifndef CONFIG_TLS
  466. CONFIG_TLS=openssl
  467. endif
  468. ifdef CONFIG_TLSV11
  469. CFLAGS += -DCONFIG_TLSV11
  470. endif
  471. ifdef CONFIG_TLSV12
  472. CFLAGS += -DCONFIG_TLSV12
  473. NEED_SHA256=y
  474. endif
  475. ifeq ($(CONFIG_TLS), openssl)
  476. ifdef TLS_FUNCS
  477. OBJS += ../src/crypto/tls_openssl.o
  478. OBJS += ../src/crypto/tls_openssl_ocsp.o
  479. LIBS += -lssl
  480. endif
  481. OBJS += ../src/crypto/crypto_openssl.o
  482. HOBJS += ../src/crypto/crypto_openssl.o
  483. ifdef NEED_FIPS186_2_PRF
  484. OBJS += ../src/crypto/fips_prf_openssl.o
  485. endif
  486. NEED_SHA256=y
  487. NEED_TLS_PRF_SHA256=y
  488. LIBS += -lcrypto
  489. LIBS_h += -lcrypto
  490. ifdef CONFIG_TLS_ADD_DL
  491. LIBS += -ldl
  492. LIBS_h += -ldl
  493. endif
  494. endif
  495. ifeq ($(CONFIG_TLS), gnutls)
  496. ifdef TLS_FUNCS
  497. OBJS += ../src/crypto/tls_gnutls.o
  498. LIBS += -lgnutls -lgpg-error
  499. endif
  500. OBJS += ../src/crypto/crypto_gnutls.o
  501. HOBJS += ../src/crypto/crypto_gnutls.o
  502. ifdef NEED_FIPS186_2_PRF
  503. OBJS += ../src/crypto/fips_prf_internal.o
  504. SHA1OBJS += ../src/crypto/sha1-internal.o
  505. endif
  506. LIBS += -lgcrypt
  507. LIBS_h += -lgcrypt
  508. CONFIG_INTERNAL_SHA256=y
  509. CONFIG_INTERNAL_RC4=y
  510. CONFIG_INTERNAL_DH_GROUP5=y
  511. endif
  512. ifeq ($(CONFIG_TLS), internal)
  513. ifndef CONFIG_CRYPTO
  514. CONFIG_CRYPTO=internal
  515. endif
  516. ifdef TLS_FUNCS
  517. OBJS += ../src/crypto/crypto_internal-rsa.o
  518. OBJS += ../src/crypto/tls_internal.o
  519. OBJS += ../src/tls/tlsv1_common.o
  520. OBJS += ../src/tls/tlsv1_record.o
  521. OBJS += ../src/tls/tlsv1_cred.o
  522. OBJS += ../src/tls/tlsv1_server.o
  523. OBJS += ../src/tls/tlsv1_server_write.o
  524. OBJS += ../src/tls/tlsv1_server_read.o
  525. OBJS += ../src/tls/asn1.o
  526. OBJS += ../src/tls/rsa.o
  527. OBJS += ../src/tls/x509v3.o
  528. OBJS += ../src/tls/pkcs1.o
  529. OBJS += ../src/tls/pkcs5.o
  530. OBJS += ../src/tls/pkcs8.o
  531. NEED_SHA256=y
  532. NEED_BASE64=y
  533. NEED_TLS_PRF=y
  534. ifdef CONFIG_TLSV12
  535. NEED_TLS_PRF_SHA256=y
  536. endif
  537. NEED_MODEXP=y
  538. NEED_CIPHER=y
  539. CFLAGS += -DCONFIG_TLS_INTERNAL
  540. CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER
  541. endif
  542. ifdef NEED_CIPHER
  543. NEED_DES=y
  544. OBJS += ../src/crypto/crypto_internal-cipher.o
  545. endif
  546. ifdef NEED_MODEXP
  547. OBJS += ../src/crypto/crypto_internal-modexp.o
  548. OBJS += ../src/tls/bignum.o
  549. endif
  550. ifeq ($(CONFIG_CRYPTO), libtomcrypt)
  551. OBJS += ../src/crypto/crypto_libtomcrypt.o
  552. LIBS += -ltomcrypt -ltfm
  553. LIBS_h += -ltomcrypt -ltfm
  554. CONFIG_INTERNAL_SHA256=y
  555. CONFIG_INTERNAL_RC4=y
  556. CONFIG_INTERNAL_DH_GROUP5=y
  557. endif
  558. ifeq ($(CONFIG_CRYPTO), internal)
  559. OBJS += ../src/crypto/crypto_internal.o
  560. NEED_AES_DEC=y
  561. CFLAGS += -DCONFIG_CRYPTO_INTERNAL
  562. ifdef CONFIG_INTERNAL_LIBTOMMATH
  563. CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
  564. ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST
  565. CFLAGS += -DLTM_FAST
  566. endif
  567. else
  568. LIBS += -ltommath
  569. LIBS_h += -ltommath
  570. endif
  571. CONFIG_INTERNAL_AES=y
  572. CONFIG_INTERNAL_DES=y
  573. CONFIG_INTERNAL_SHA1=y
  574. CONFIG_INTERNAL_MD4=y
  575. CONFIG_INTERNAL_MD5=y
  576. CONFIG_INTERNAL_SHA256=y
  577. CONFIG_INTERNAL_SHA384=y
  578. CONFIG_INTERNAL_SHA512=y
  579. CONFIG_INTERNAL_RC4=y
  580. CONFIG_INTERNAL_DH_GROUP5=y
  581. endif
  582. ifeq ($(CONFIG_CRYPTO), cryptoapi)
  583. OBJS += ../src/crypto/crypto_cryptoapi.o
  584. OBJS_p += ../src/crypto/crypto_cryptoapi.o
  585. CFLAGS += -DCONFIG_CRYPTO_CRYPTOAPI
  586. CONFIG_INTERNAL_SHA256=y
  587. CONFIG_INTERNAL_RC4=y
  588. endif
  589. endif
  590. ifeq ($(CONFIG_TLS), none)
  591. ifdef TLS_FUNCS
  592. OBJS += ../src/crypto/tls_none.o
  593. CFLAGS += -DEAP_TLS_NONE
  594. CONFIG_INTERNAL_AES=y
  595. CONFIG_INTERNAL_SHA1=y
  596. CONFIG_INTERNAL_MD5=y
  597. endif
  598. OBJS += ../src/crypto/crypto_none.o
  599. OBJS_p += ../src/crypto/crypto_none.o
  600. CONFIG_INTERNAL_SHA256=y
  601. CONFIG_INTERNAL_RC4=y
  602. endif
  603. ifndef TLS_FUNCS
  604. OBJS += ../src/crypto/tls_none.o
  605. ifeq ($(CONFIG_TLS), internal)
  606. CONFIG_INTERNAL_AES=y
  607. CONFIG_INTERNAL_SHA1=y
  608. CONFIG_INTERNAL_MD5=y
  609. CONFIG_INTERNAL_RC4=y
  610. endif
  611. endif
  612. AESOBJS = # none so far
  613. ifdef CONFIG_INTERNAL_AES
  614. AESOBJS += ../src/crypto/aes-internal.o ../src/crypto/aes-internal-enc.o
  615. endif
  616. ifneq ($(CONFIG_TLS), openssl)
  617. AESOBJS += ../src/crypto/aes-wrap.o
  618. endif
  619. ifdef NEED_AES_EAX
  620. AESOBJS += ../src/crypto/aes-eax.o
  621. NEED_AES_CTR=y
  622. endif
  623. ifdef NEED_AES_CTR
  624. AESOBJS += ../src/crypto/aes-ctr.o
  625. endif
  626. ifdef NEED_AES_ENCBLOCK
  627. AESOBJS += ../src/crypto/aes-encblock.o
  628. endif
  629. ifdef NEED_AES_OMAC1
  630. AESOBJS += ../src/crypto/aes-omac1.o
  631. endif
  632. ifdef NEED_AES_UNWRAP
  633. ifneq ($(CONFIG_TLS), openssl)
  634. NEED_AES_DEC=y
  635. AESOBJS += ../src/crypto/aes-unwrap.o
  636. endif
  637. endif
  638. ifdef NEED_AES_CBC
  639. NEED_AES_DEC=y
  640. ifneq ($(CONFIG_TLS), openssl)
  641. AESOBJS += ../src/crypto/aes-cbc.o
  642. endif
  643. endif
  644. ifdef NEED_AES_DEC
  645. ifdef CONFIG_INTERNAL_AES
  646. AESOBJS += ../src/crypto/aes-internal-dec.o
  647. endif
  648. endif
  649. ifdef NEED_AES
  650. OBJS += $(AESOBJS)
  651. endif
  652. ifdef NEED_SHA1
  653. ifneq ($(CONFIG_TLS), openssl)
  654. SHA1OBJS += ../src/crypto/sha1.o
  655. endif
  656. SHA1OBJS += ../src/crypto/sha1-prf.o
  657. ifdef CONFIG_INTERNAL_SHA1
  658. SHA1OBJS += ../src/crypto/sha1-internal.o
  659. ifdef NEED_FIPS186_2_PRF
  660. SHA1OBJS += ../src/crypto/fips_prf_internal.o
  661. endif
  662. endif
  663. ifneq ($(CONFIG_TLS), openssl)
  664. SHA1OBJS += ../src/crypto/sha1-pbkdf2.o
  665. endif
  666. ifdef NEED_T_PRF
  667. SHA1OBJS += ../src/crypto/sha1-tprf.o
  668. endif
  669. ifdef NEED_TLS_PRF
  670. SHA1OBJS += ../src/crypto/sha1-tlsprf.o
  671. endif
  672. endif
  673. ifdef NEED_SHA1
  674. OBJS += $(SHA1OBJS)
  675. endif
  676. ifneq ($(CONFIG_TLS), openssl)
  677. OBJS += ../src/crypto/md5.o
  678. endif
  679. ifdef NEED_MD5
  680. ifdef CONFIG_INTERNAL_MD5
  681. OBJS += ../src/crypto/md5-internal.o
  682. HOBJS += ../src/crypto/md5-internal.o
  683. endif
  684. endif
  685. ifdef NEED_MD4
  686. ifdef CONFIG_INTERNAL_MD4
  687. OBJS += ../src/crypto/md4-internal.o
  688. endif
  689. endif
  690. ifdef NEED_DES
  691. ifdef CONFIG_INTERNAL_DES
  692. OBJS += ../src/crypto/des-internal.o
  693. endif
  694. endif
  695. ifdef CONFIG_NO_RC4
  696. CFLAGS += -DCONFIG_NO_RC4
  697. endif
  698. ifdef NEED_RC4
  699. ifdef CONFIG_INTERNAL_RC4
  700. ifndef CONFIG_NO_RC4
  701. OBJS += ../src/crypto/rc4.o
  702. endif
  703. endif
  704. endif
  705. ifdef NEED_SHA256
  706. CFLAGS += -DCONFIG_SHA256
  707. ifneq ($(CONFIG_TLS), openssl)
  708. OBJS += ../src/crypto/sha256.o
  709. endif
  710. OBJS += ../src/crypto/sha256-prf.o
  711. ifdef CONFIG_INTERNAL_SHA256
  712. OBJS += ../src/crypto/sha256-internal.o
  713. endif
  714. ifdef NEED_TLS_PRF_SHA256
  715. OBJS += ../src/crypto/sha256-tlsprf.o
  716. endif
  717. ifdef NEED_HMAC_SHA256_KDF
  718. OBJS += ../src/crypto/sha256-kdf.o
  719. endif
  720. endif
  721. ifdef NEED_SHA384
  722. CFLAGS += -DCONFIG_SHA384
  723. OBJS += ../src/crypto/sha384-prf.o
  724. endif
  725. ifdef CONFIG_INTERNAL_SHA384
  726. CFLAGS += -DCONFIG_INTERNAL_SHA384
  727. OBJS += ../src/crypto/sha384-internal.o
  728. endif
  729. ifdef CONFIG_INTERNAL_SHA512
  730. CFLAGS += -DCONFIG_INTERNAL_SHA512
  731. OBJS += ../src/crypto/sha512-internal.o
  732. endif
  733. ifdef NEED_DH_GROUPS
  734. OBJS += ../src/crypto/dh_groups.o
  735. endif
  736. ifdef NEED_DH_GROUPS_ALL
  737. CFLAGS += -DALL_DH_GROUPS
  738. endif
  739. ifdef CONFIG_INTERNAL_DH_GROUP5
  740. ifdef NEED_DH_GROUPS
  741. OBJS += ../src/crypto/dh_group5.o
  742. endif
  743. endif
  744. ifdef NEED_ECC
  745. CFLAGS += -DCONFIG_ECC
  746. endif
  747. ifdef CONFIG_NO_RANDOM_POOL
  748. CFLAGS += -DCONFIG_NO_RANDOM_POOL
  749. else
  750. OBJS += ../src/crypto/random.o
  751. HOBJS += ../src/crypto/random.o
  752. HOBJS += ../src/utils/eloop.o
  753. HOBJS += $(SHA1OBJS)
  754. ifneq ($(CONFIG_TLS), openssl)
  755. HOBJS += ../src/crypto/md5.o
  756. endif
  757. endif
  758. ifdef CONFIG_RADIUS_SERVER
  759. CFLAGS += -DRADIUS_SERVER
  760. OBJS += ../src/radius/radius_server.o
  761. endif
  762. ifdef CONFIG_IPV6
  763. CFLAGS += -DCONFIG_IPV6
  764. endif
  765. ifdef CONFIG_DRIVER_RADIUS_ACL
  766. CFLAGS += -DCONFIG_DRIVER_RADIUS_ACL
  767. endif
  768. ifdef CONFIG_FULL_DYNAMIC_VLAN
  769. # define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges
  770. # and vlan interfaces for the vlan feature.
  771. CFLAGS += -DCONFIG_FULL_DYNAMIC_VLAN
  772. endif
  773. ifdef NEED_BASE64
  774. OBJS += ../src/utils/base64.o
  775. endif
  776. ifdef NEED_AP_MLME
  777. OBJS += ../src/ap/wmm.o
  778. OBJS += ../src/ap/ap_list.o
  779. OBJS += ../src/ap/ieee802_11.o
  780. OBJS += ../src/ap/hw_features.o
  781. OBJS += ../src/ap/dfs.o
  782. CFLAGS += -DNEED_AP_MLME
  783. endif
  784. ifdef CONFIG_IEEE80211N
  785. OBJS += ../src/ap/ieee802_11_ht.o
  786. endif
  787. ifdef CONFIG_IEEE80211AC
  788. OBJS += ../src/ap/ieee802_11_vht.o
  789. endif
  790. ifdef CONFIG_P2P_MANAGER
  791. CFLAGS += -DCONFIG_P2P_MANAGER
  792. OBJS += ../src/ap/p2p_hostapd.o
  793. endif
  794. ifdef CONFIG_HS20
  795. CFLAGS += -DCONFIG_HS20
  796. OBJS += ../src/ap/hs20.o
  797. CONFIG_INTERWORKING=y
  798. endif
  799. ifdef CONFIG_INTERWORKING
  800. CFLAGS += -DCONFIG_INTERWORKING
  801. OBJS += ../src/common/gas.o
  802. OBJS += ../src/ap/gas_serv.o
  803. endif
  804. ifdef CONFIG_PROXYARP
  805. CFLAGS += -DCONFIG_PROXYARP
  806. OBJS += ../src/ap/x_snoop.o
  807. OBJS += ../src/ap/dhcp_snoop.o
  808. ifdef CONFIG_IPV6
  809. OBJS += ../src/ap/ndisc_snoop.o
  810. endif
  811. endif
  812. OBJS += ../src/drivers/driver_common.o
  813. ifdef CONFIG_WPA_CLI_EDIT
  814. OBJS_c += ../src/utils/edit.o
  815. else
  816. OBJS_c += ../src/utils/edit_simple.o
  817. endif
  818. ifdef CONFIG_ACS
  819. CFLAGS += -DCONFIG_ACS
  820. OBJS += ../src/ap/acs.o
  821. LIBS += -lm
  822. endif
  823. ifdef CONFIG_NO_STDOUT_DEBUG
  824. CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
  825. endif
  826. ifdef CONFIG_DEBUG_LINUX_TRACING
  827. CFLAGS += -DCONFIG_DEBUG_LINUX_TRACING
  828. endif
  829. ifdef CONFIG_DEBUG_FILE
  830. CFLAGS += -DCONFIG_DEBUG_FILE
  831. endif
  832. ifdef CONFIG_SQLITE
  833. CFLAGS += -DCONFIG_SQLITE
  834. LIBS += -lsqlite3
  835. LIBS_h += -lsqlite3
  836. endif
  837. ifdef CONFIG_FST
  838. CFLAGS += -DCONFIG_FST
  839. OBJS += ../src/fst/fst.o
  840. OBJS += ../src/fst/fst_group.o
  841. OBJS += ../src/fst/fst_iface.o
  842. OBJS += ../src/fst/fst_session.o
  843. OBJS += ../src/fst/fst_ctrl_aux.o
  844. ifdef CONFIG_FST_TEST
  845. CFLAGS += -DCONFIG_FST_TEST
  846. endif
  847. ifndef CONFIG_NO_CTRL_IFACE
  848. OBJS += ../src/fst/fst_ctrl_iface.o
  849. endif
  850. endif
  851. ALL=hostapd hostapd_cli
  852. all: verify_config $(ALL)
  853. Q=@
  854. E=echo
  855. ifeq ($(V), 1)
  856. Q=
  857. E=true
  858. endif
  859. ifeq ($(QUIET), 1)
  860. Q=@
  861. E=true
  862. endif
  863. ifdef CONFIG_CODE_COVERAGE
  864. %.o: %.c
  865. @$(E) " CC " $<
  866. $(Q)cd $(dir $@); $(CC) -c -o $(notdir $@) $(CFLAGS) $(notdir $<)
  867. else
  868. %.o: %.c
  869. $(Q)$(CC) -c -o $@ $(CFLAGS) $<
  870. @$(E) " CC " $<
  871. endif
  872. verify_config:
  873. @if [ ! -r .config ]; then \
  874. echo 'Building hostapd requires a configuration file'; \
  875. echo '(.config). See README for more instructions. You can'; \
  876. echo 'run "cp defconfig .config" to create an example'; \
  877. echo 'configuration.'; \
  878. exit 1; \
  879. fi
  880. $(DESTDIR)$(BINDIR)/%: %
  881. install -D $(<) $(@)
  882. install: $(addprefix $(DESTDIR)$(BINDIR)/,$(ALL))
  883. ../src/drivers/build.hostapd:
  884. @if [ -f ../src/drivers/build.wpa_supplicant ]; then \
  885. $(MAKE) -C ../src/drivers clean; \
  886. fi
  887. @touch ../src/drivers/build.hostapd
  888. BCHECK=../src/drivers/build.hostapd
  889. hostapd: $(BCHECK) $(OBJS)
  890. $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
  891. @$(E) " LD " $@
  892. ifdef CONFIG_WPA_TRACE
  893. OBJS_c += ../src/utils/trace.o
  894. endif
  895. hostapd_cli: $(OBJS_c)
  896. $(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c)
  897. @$(E) " LD " $@
  898. NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS)
  899. NOBJS += ../src/utils/common.o
  900. ifdef NEED_RC4
  901. ifdef CONFIG_INTERNAL_RC4
  902. ifndef CONFIG_NO_RC4
  903. NOBJS += ../src/crypto/rc4.o
  904. endif
  905. endif
  906. endif
  907. ifdef CONFIG_INTERNAL_MD5
  908. NOBJS += ../src/crypto/md5-internal.o
  909. endif
  910. NOBJS += ../src/crypto/crypto_openssl.o ../src/utils/os_$(CONFIG_OS).o
  911. NOBJS += ../src/utils/wpa_debug.o
  912. NOBJS += ../src/utils/wpabuf.o
  913. ifdef CONFIG_WPA_TRACE
  914. NOBJS += ../src/utils/trace.o
  915. LIBS_n += -lbfd
  916. endif
  917. ifdef TLS_FUNCS
  918. LIBS_n += -lcrypto
  919. endif
  920. HOBJS += hlr_auc_gw.o ../src/utils/common.o ../src/utils/wpa_debug.o ../src/utils/os_$(CONFIG_OS).o ../src/utils/wpabuf.o ../src/crypto/milenage.o
  921. HOBJS += ../src/crypto/aes-encblock.o
  922. ifdef CONFIG_INTERNAL_AES
  923. HOBJS += ../src/crypto/aes-internal.o
  924. HOBJS += ../src/crypto/aes-internal-enc.o
  925. endif
  926. nt_password_hash: $(NOBJS)
  927. $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
  928. @$(E) " LD " $@
  929. hlr_auc_gw: $(HOBJS)
  930. $(Q)$(CC) $(LDFLAGS) -o hlr_auc_gw $(HOBJS) $(LIBS_h)
  931. @$(E) " LD " $@
  932. lcov-html:
  933. lcov -c -d .. > lcov.info
  934. genhtml lcov.info --output-directory lcov-html
  935. clean:
  936. $(MAKE) -C ../src clean
  937. rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw
  938. rm -f *.d *.gcno *.gcda *.gcov
  939. rm -f lcov.info
  940. rm -rf lcov-html
  941. -include $(OBJS:%.o=%.d)