Makefile 22 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091
  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. ifdef CONFIG_MBO
  238. CFLAGS += -DCONFIG_MBO
  239. endif
  240. include ../src/drivers/drivers.mak
  241. OBJS += $(DRV_AP_OBJS)
  242. CFLAGS += $(DRV_AP_CFLAGS)
  243. LDFLAGS += $(DRV_AP_LDFLAGS)
  244. LIBS += $(DRV_AP_LIBS)
  245. ifdef CONFIG_L2_PACKET
  246. ifdef CONFIG_DNET_PCAP
  247. ifdef CONFIG_L2_FREEBSD
  248. LIBS += -lpcap
  249. OBJS += ../src/l2_packet/l2_packet_freebsd.o
  250. else
  251. LIBS += -ldnet -lpcap
  252. OBJS += ../src/l2_packet/l2_packet_pcap.o
  253. endif
  254. else
  255. OBJS += ../src/l2_packet/l2_packet_linux.o
  256. endif
  257. else
  258. OBJS += ../src/l2_packet/l2_packet_none.o
  259. endif
  260. ifdef CONFIG_ERP
  261. CFLAGS += -DCONFIG_ERP
  262. NEED_SHA256=y
  263. NEED_HMAC_SHA256_KDF=y
  264. endif
  265. ifdef CONFIG_EAP_MD5
  266. CFLAGS += -DEAP_SERVER_MD5
  267. OBJS += ../src/eap_server/eap_server_md5.o
  268. CHAP=y
  269. endif
  270. ifdef CONFIG_EAP_TLS
  271. CFLAGS += -DEAP_SERVER_TLS
  272. OBJS += ../src/eap_server/eap_server_tls.o
  273. TLS_FUNCS=y
  274. endif
  275. ifdef CONFIG_EAP_UNAUTH_TLS
  276. CFLAGS += -DEAP_SERVER_UNAUTH_TLS
  277. ifndef CONFIG_EAP_TLS
  278. OBJS += ../src/eap_server/eap_server_tls.o
  279. TLS_FUNCS=y
  280. endif
  281. endif
  282. ifdef CONFIG_EAP_PEAP
  283. CFLAGS += -DEAP_SERVER_PEAP
  284. OBJS += ../src/eap_server/eap_server_peap.o
  285. OBJS += ../src/eap_common/eap_peap_common.o
  286. TLS_FUNCS=y
  287. CONFIG_EAP_MSCHAPV2=y
  288. endif
  289. ifdef CONFIG_EAP_TTLS
  290. CFLAGS += -DEAP_SERVER_TTLS
  291. OBJS += ../src/eap_server/eap_server_ttls.o
  292. TLS_FUNCS=y
  293. CHAP=y
  294. endif
  295. ifdef CONFIG_EAP_MSCHAPV2
  296. CFLAGS += -DEAP_SERVER_MSCHAPV2
  297. OBJS += ../src/eap_server/eap_server_mschapv2.o
  298. MS_FUNCS=y
  299. endif
  300. ifdef CONFIG_EAP_GTC
  301. CFLAGS += -DEAP_SERVER_GTC
  302. OBJS += ../src/eap_server/eap_server_gtc.o
  303. endif
  304. ifdef CONFIG_EAP_SIM
  305. CFLAGS += -DEAP_SERVER_SIM
  306. OBJS += ../src/eap_server/eap_server_sim.o
  307. CONFIG_EAP_SIM_COMMON=y
  308. NEED_AES_CBC=y
  309. endif
  310. ifdef CONFIG_EAP_AKA
  311. CFLAGS += -DEAP_SERVER_AKA
  312. OBJS += ../src/eap_server/eap_server_aka.o
  313. CONFIG_EAP_SIM_COMMON=y
  314. NEED_SHA256=y
  315. NEED_AES_CBC=y
  316. endif
  317. ifdef CONFIG_EAP_AKA_PRIME
  318. CFLAGS += -DEAP_SERVER_AKA_PRIME
  319. endif
  320. ifdef CONFIG_EAP_SIM_COMMON
  321. OBJS += ../src/eap_common/eap_sim_common.o
  322. # Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be
  323. # replaced with another file implementating the interface specified in
  324. # eap_sim_db.h.
  325. OBJS += ../src/eap_server/eap_sim_db.o
  326. NEED_FIPS186_2_PRF=y
  327. endif
  328. ifdef CONFIG_EAP_PAX
  329. CFLAGS += -DEAP_SERVER_PAX
  330. OBJS += ../src/eap_server/eap_server_pax.o ../src/eap_common/eap_pax_common.o
  331. endif
  332. ifdef CONFIG_EAP_PSK
  333. CFLAGS += -DEAP_SERVER_PSK
  334. OBJS += ../src/eap_server/eap_server_psk.o ../src/eap_common/eap_psk_common.o
  335. NEED_AES_OMAC1=y
  336. NEED_AES_ENCBLOCK=y
  337. NEED_AES_EAX=y
  338. endif
  339. ifdef CONFIG_EAP_SAKE
  340. CFLAGS += -DEAP_SERVER_SAKE
  341. OBJS += ../src/eap_server/eap_server_sake.o ../src/eap_common/eap_sake_common.o
  342. endif
  343. ifdef CONFIG_EAP_GPSK
  344. CFLAGS += -DEAP_SERVER_GPSK
  345. OBJS += ../src/eap_server/eap_server_gpsk.o ../src/eap_common/eap_gpsk_common.o
  346. ifdef CONFIG_EAP_GPSK_SHA256
  347. CFLAGS += -DEAP_GPSK_SHA256
  348. endif
  349. NEED_SHA256=y
  350. NEED_AES_OMAC1=y
  351. endif
  352. ifdef CONFIG_EAP_PWD
  353. CFLAGS += -DEAP_SERVER_PWD
  354. OBJS += ../src/eap_server/eap_server_pwd.o ../src/eap_common/eap_pwd_common.o
  355. NEED_SHA256=y
  356. endif
  357. ifdef CONFIG_EAP_EKE
  358. CFLAGS += -DEAP_SERVER_EKE
  359. OBJS += ../src/eap_server/eap_server_eke.o ../src/eap_common/eap_eke_common.o
  360. NEED_DH_GROUPS=y
  361. NEED_DH_GROUPS_ALL=y
  362. endif
  363. ifdef CONFIG_EAP_VENDOR_TEST
  364. CFLAGS += -DEAP_SERVER_VENDOR_TEST
  365. OBJS += ../src/eap_server/eap_server_vendor_test.o
  366. endif
  367. ifdef CONFIG_EAP_FAST
  368. CFLAGS += -DEAP_SERVER_FAST
  369. OBJS += ../src/eap_server/eap_server_fast.o
  370. OBJS += ../src/eap_common/eap_fast_common.o
  371. TLS_FUNCS=y
  372. NEED_T_PRF=y
  373. NEED_AES_UNWRAP=y
  374. endif
  375. ifdef CONFIG_WPS
  376. CFLAGS += -DCONFIG_WPS -DEAP_SERVER_WSC
  377. OBJS += ../src/utils/uuid.o
  378. OBJS += ../src/ap/wps_hostapd.o
  379. OBJS += ../src/eap_server/eap_server_wsc.o ../src/eap_common/eap_wsc_common.o
  380. OBJS += ../src/wps/wps.o
  381. OBJS += ../src/wps/wps_common.o
  382. OBJS += ../src/wps/wps_attr_parse.o
  383. OBJS += ../src/wps/wps_attr_build.o
  384. OBJS += ../src/wps/wps_attr_process.o
  385. OBJS += ../src/wps/wps_dev_attr.o
  386. OBJS += ../src/wps/wps_enrollee.o
  387. OBJS += ../src/wps/wps_registrar.o
  388. NEED_DH_GROUPS=y
  389. NEED_SHA256=y
  390. NEED_BASE64=y
  391. NEED_AES_CBC=y
  392. NEED_MODEXP=y
  393. CONFIG_EAP=y
  394. ifdef CONFIG_WPS_NFC
  395. CFLAGS += -DCONFIG_WPS_NFC
  396. OBJS += ../src/wps/ndef.o
  397. NEED_WPS_OOB=y
  398. endif
  399. ifdef NEED_WPS_OOB
  400. CFLAGS += -DCONFIG_WPS_OOB
  401. endif
  402. ifdef CONFIG_WPS_UPNP
  403. CFLAGS += -DCONFIG_WPS_UPNP
  404. OBJS += ../src/wps/wps_upnp.o
  405. OBJS += ../src/wps/wps_upnp_ssdp.o
  406. OBJS += ../src/wps/wps_upnp_web.o
  407. OBJS += ../src/wps/wps_upnp_event.o
  408. OBJS += ../src/wps/wps_upnp_ap.o
  409. OBJS += ../src/wps/upnp_xml.o
  410. OBJS += ../src/wps/httpread.o
  411. OBJS += ../src/wps/http_client.o
  412. OBJS += ../src/wps/http_server.o
  413. endif
  414. ifdef CONFIG_WPS_STRICT
  415. CFLAGS += -DCONFIG_WPS_STRICT
  416. OBJS += ../src/wps/wps_validate.o
  417. endif
  418. ifdef CONFIG_WPS_TESTING
  419. CFLAGS += -DCONFIG_WPS_TESTING
  420. endif
  421. endif
  422. ifdef CONFIG_EAP_IKEV2
  423. CFLAGS += -DEAP_SERVER_IKEV2
  424. OBJS += ../src/eap_server/eap_server_ikev2.o ../src/eap_server/ikev2.o
  425. OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
  426. NEED_DH_GROUPS=y
  427. NEED_DH_GROUPS_ALL=y
  428. NEED_MODEXP=y
  429. NEED_CIPHER=y
  430. endif
  431. ifdef CONFIG_EAP_TNC
  432. CFLAGS += -DEAP_SERVER_TNC
  433. OBJS += ../src/eap_server/eap_server_tnc.o
  434. OBJS += ../src/eap_server/tncs.o
  435. NEED_BASE64=y
  436. ifndef CONFIG_DRIVER_BSD
  437. LIBS += -ldl
  438. endif
  439. endif
  440. # Basic EAP functionality is needed for EAPOL
  441. OBJS += eap_register.o
  442. OBJS += ../src/eap_server/eap_server.o
  443. OBJS += ../src/eap_common/eap_common.o
  444. OBJS += ../src/eap_server/eap_server_methods.o
  445. OBJS += ../src/eap_server/eap_server_identity.o
  446. CFLAGS += -DEAP_SERVER_IDENTITY
  447. ifdef CONFIG_EAP
  448. CFLAGS += -DEAP_SERVER
  449. endif
  450. ifdef CONFIG_PKCS12
  451. CFLAGS += -DPKCS12_FUNCS
  452. endif
  453. ifdef MS_FUNCS
  454. OBJS += ../src/crypto/ms_funcs.o
  455. NEED_DES=y
  456. NEED_MD4=y
  457. endif
  458. ifdef CHAP
  459. OBJS += ../src/eap_common/chap.o
  460. endif
  461. ifdef TLS_FUNCS
  462. NEED_DES=y
  463. # Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS)
  464. CFLAGS += -DEAP_TLS_FUNCS
  465. OBJS += ../src/eap_server/eap_server_tls_common.o
  466. NEED_TLS_PRF=y
  467. endif
  468. ifndef CONFIG_TLS
  469. CONFIG_TLS=openssl
  470. endif
  471. ifdef CONFIG_TLSV11
  472. CFLAGS += -DCONFIG_TLSV11
  473. endif
  474. ifdef CONFIG_TLSV12
  475. CFLAGS += -DCONFIG_TLSV12
  476. NEED_SHA256=y
  477. endif
  478. ifeq ($(CONFIG_TLS), openssl)
  479. ifdef TLS_FUNCS
  480. OBJS += ../src/crypto/tls_openssl.o
  481. OBJS += ../src/crypto/tls_openssl_ocsp.o
  482. LIBS += -lssl
  483. endif
  484. OBJS += ../src/crypto/crypto_openssl.o
  485. HOBJS += ../src/crypto/crypto_openssl.o
  486. ifdef NEED_FIPS186_2_PRF
  487. OBJS += ../src/crypto/fips_prf_openssl.o
  488. endif
  489. NEED_SHA256=y
  490. NEED_TLS_PRF_SHA256=y
  491. LIBS += -lcrypto
  492. LIBS_h += -lcrypto
  493. ifdef CONFIG_TLS_ADD_DL
  494. LIBS += -ldl
  495. LIBS_h += -ldl
  496. endif
  497. endif
  498. ifeq ($(CONFIG_TLS), gnutls)
  499. ifdef TLS_FUNCS
  500. OBJS += ../src/crypto/tls_gnutls.o
  501. LIBS += -lgnutls -lgpg-error
  502. endif
  503. OBJS += ../src/crypto/crypto_gnutls.o
  504. HOBJS += ../src/crypto/crypto_gnutls.o
  505. ifdef NEED_FIPS186_2_PRF
  506. OBJS += ../src/crypto/fips_prf_internal.o
  507. SHA1OBJS += ../src/crypto/sha1-internal.o
  508. endif
  509. LIBS += -lgcrypt
  510. LIBS_h += -lgcrypt
  511. CONFIG_INTERNAL_SHA256=y
  512. CONFIG_INTERNAL_RC4=y
  513. CONFIG_INTERNAL_DH_GROUP5=y
  514. endif
  515. ifeq ($(CONFIG_TLS), internal)
  516. ifndef CONFIG_CRYPTO
  517. CONFIG_CRYPTO=internal
  518. endif
  519. ifdef TLS_FUNCS
  520. OBJS += ../src/crypto/crypto_internal-rsa.o
  521. OBJS += ../src/crypto/tls_internal.o
  522. OBJS += ../src/tls/tlsv1_common.o
  523. OBJS += ../src/tls/tlsv1_record.o
  524. OBJS += ../src/tls/tlsv1_cred.o
  525. OBJS += ../src/tls/tlsv1_server.o
  526. OBJS += ../src/tls/tlsv1_server_write.o
  527. OBJS += ../src/tls/tlsv1_server_read.o
  528. OBJS += ../src/tls/asn1.o
  529. OBJS += ../src/tls/rsa.o
  530. OBJS += ../src/tls/x509v3.o
  531. OBJS += ../src/tls/pkcs1.o
  532. OBJS += ../src/tls/pkcs5.o
  533. OBJS += ../src/tls/pkcs8.o
  534. NEED_SHA256=y
  535. NEED_BASE64=y
  536. NEED_TLS_PRF=y
  537. ifdef CONFIG_TLSV12
  538. NEED_TLS_PRF_SHA256=y
  539. endif
  540. NEED_MODEXP=y
  541. NEED_CIPHER=y
  542. CFLAGS += -DCONFIG_TLS_INTERNAL
  543. CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER
  544. endif
  545. ifdef NEED_CIPHER
  546. NEED_DES=y
  547. OBJS += ../src/crypto/crypto_internal-cipher.o
  548. endif
  549. ifdef NEED_MODEXP
  550. OBJS += ../src/crypto/crypto_internal-modexp.o
  551. OBJS += ../src/tls/bignum.o
  552. endif
  553. ifeq ($(CONFIG_CRYPTO), libtomcrypt)
  554. OBJS += ../src/crypto/crypto_libtomcrypt.o
  555. LIBS += -ltomcrypt -ltfm
  556. LIBS_h += -ltomcrypt -ltfm
  557. CONFIG_INTERNAL_SHA256=y
  558. CONFIG_INTERNAL_RC4=y
  559. CONFIG_INTERNAL_DH_GROUP5=y
  560. endif
  561. ifeq ($(CONFIG_CRYPTO), internal)
  562. OBJS += ../src/crypto/crypto_internal.o
  563. NEED_AES_DEC=y
  564. CFLAGS += -DCONFIG_CRYPTO_INTERNAL
  565. ifdef CONFIG_INTERNAL_LIBTOMMATH
  566. CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
  567. ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST
  568. CFLAGS += -DLTM_FAST
  569. endif
  570. else
  571. LIBS += -ltommath
  572. LIBS_h += -ltommath
  573. endif
  574. CONFIG_INTERNAL_AES=y
  575. CONFIG_INTERNAL_DES=y
  576. CONFIG_INTERNAL_SHA1=y
  577. CONFIG_INTERNAL_MD4=y
  578. CONFIG_INTERNAL_MD5=y
  579. CONFIG_INTERNAL_SHA256=y
  580. CONFIG_INTERNAL_SHA384=y
  581. CONFIG_INTERNAL_SHA512=y
  582. CONFIG_INTERNAL_RC4=y
  583. CONFIG_INTERNAL_DH_GROUP5=y
  584. endif
  585. ifeq ($(CONFIG_CRYPTO), cryptoapi)
  586. OBJS += ../src/crypto/crypto_cryptoapi.o
  587. OBJS_p += ../src/crypto/crypto_cryptoapi.o
  588. CFLAGS += -DCONFIG_CRYPTO_CRYPTOAPI
  589. CONFIG_INTERNAL_SHA256=y
  590. CONFIG_INTERNAL_RC4=y
  591. endif
  592. endif
  593. ifeq ($(CONFIG_TLS), none)
  594. ifdef TLS_FUNCS
  595. OBJS += ../src/crypto/tls_none.o
  596. CFLAGS += -DEAP_TLS_NONE
  597. CONFIG_INTERNAL_AES=y
  598. CONFIG_INTERNAL_SHA1=y
  599. CONFIG_INTERNAL_MD5=y
  600. endif
  601. OBJS += ../src/crypto/crypto_none.o
  602. OBJS_p += ../src/crypto/crypto_none.o
  603. CONFIG_INTERNAL_SHA256=y
  604. CONFIG_INTERNAL_RC4=y
  605. endif
  606. ifndef TLS_FUNCS
  607. OBJS += ../src/crypto/tls_none.o
  608. ifeq ($(CONFIG_TLS), internal)
  609. CONFIG_INTERNAL_AES=y
  610. CONFIG_INTERNAL_SHA1=y
  611. CONFIG_INTERNAL_MD5=y
  612. CONFIG_INTERNAL_RC4=y
  613. endif
  614. endif
  615. AESOBJS = # none so far
  616. ifdef CONFIG_INTERNAL_AES
  617. AESOBJS += ../src/crypto/aes-internal.o ../src/crypto/aes-internal-enc.o
  618. endif
  619. ifneq ($(CONFIG_TLS), openssl)
  620. AESOBJS += ../src/crypto/aes-wrap.o
  621. endif
  622. ifdef NEED_AES_EAX
  623. AESOBJS += ../src/crypto/aes-eax.o
  624. NEED_AES_CTR=y
  625. endif
  626. ifdef NEED_AES_CTR
  627. AESOBJS += ../src/crypto/aes-ctr.o
  628. endif
  629. ifdef NEED_AES_ENCBLOCK
  630. AESOBJS += ../src/crypto/aes-encblock.o
  631. endif
  632. ifdef NEED_AES_OMAC1
  633. AESOBJS += ../src/crypto/aes-omac1.o
  634. endif
  635. ifdef NEED_AES_UNWRAP
  636. ifneq ($(CONFIG_TLS), openssl)
  637. NEED_AES_DEC=y
  638. AESOBJS += ../src/crypto/aes-unwrap.o
  639. endif
  640. endif
  641. ifdef NEED_AES_CBC
  642. NEED_AES_DEC=y
  643. ifneq ($(CONFIG_TLS), openssl)
  644. AESOBJS += ../src/crypto/aes-cbc.o
  645. endif
  646. endif
  647. ifdef NEED_AES_DEC
  648. ifdef CONFIG_INTERNAL_AES
  649. AESOBJS += ../src/crypto/aes-internal-dec.o
  650. endif
  651. endif
  652. ifdef NEED_AES
  653. OBJS += $(AESOBJS)
  654. endif
  655. ifdef NEED_SHA1
  656. ifneq ($(CONFIG_TLS), openssl)
  657. SHA1OBJS += ../src/crypto/sha1.o
  658. endif
  659. SHA1OBJS += ../src/crypto/sha1-prf.o
  660. ifdef CONFIG_INTERNAL_SHA1
  661. SHA1OBJS += ../src/crypto/sha1-internal.o
  662. ifdef NEED_FIPS186_2_PRF
  663. SHA1OBJS += ../src/crypto/fips_prf_internal.o
  664. endif
  665. endif
  666. ifneq ($(CONFIG_TLS), openssl)
  667. SHA1OBJS += ../src/crypto/sha1-pbkdf2.o
  668. endif
  669. ifdef NEED_T_PRF
  670. SHA1OBJS += ../src/crypto/sha1-tprf.o
  671. endif
  672. ifdef NEED_TLS_PRF
  673. SHA1OBJS += ../src/crypto/sha1-tlsprf.o
  674. endif
  675. endif
  676. ifdef NEED_SHA1
  677. OBJS += $(SHA1OBJS)
  678. endif
  679. ifneq ($(CONFIG_TLS), openssl)
  680. OBJS += ../src/crypto/md5.o
  681. endif
  682. ifdef NEED_MD5
  683. ifdef CONFIG_INTERNAL_MD5
  684. OBJS += ../src/crypto/md5-internal.o
  685. HOBJS += ../src/crypto/md5-internal.o
  686. endif
  687. endif
  688. ifdef NEED_MD4
  689. ifdef CONFIG_INTERNAL_MD4
  690. OBJS += ../src/crypto/md4-internal.o
  691. endif
  692. endif
  693. ifdef NEED_DES
  694. ifdef CONFIG_INTERNAL_DES
  695. OBJS += ../src/crypto/des-internal.o
  696. endif
  697. endif
  698. ifdef CONFIG_NO_RC4
  699. CFLAGS += -DCONFIG_NO_RC4
  700. endif
  701. ifdef NEED_RC4
  702. ifdef CONFIG_INTERNAL_RC4
  703. ifndef CONFIG_NO_RC4
  704. OBJS += ../src/crypto/rc4.o
  705. endif
  706. endif
  707. endif
  708. ifdef NEED_SHA256
  709. CFLAGS += -DCONFIG_SHA256
  710. ifneq ($(CONFIG_TLS), openssl)
  711. OBJS += ../src/crypto/sha256.o
  712. endif
  713. OBJS += ../src/crypto/sha256-prf.o
  714. ifdef CONFIG_INTERNAL_SHA256
  715. OBJS += ../src/crypto/sha256-internal.o
  716. endif
  717. ifdef NEED_TLS_PRF_SHA256
  718. OBJS += ../src/crypto/sha256-tlsprf.o
  719. endif
  720. ifdef NEED_HMAC_SHA256_KDF
  721. OBJS += ../src/crypto/sha256-kdf.o
  722. endif
  723. endif
  724. ifdef NEED_SHA384
  725. CFLAGS += -DCONFIG_SHA384
  726. OBJS += ../src/crypto/sha384-prf.o
  727. endif
  728. ifdef CONFIG_INTERNAL_SHA384
  729. CFLAGS += -DCONFIG_INTERNAL_SHA384
  730. OBJS += ../src/crypto/sha384-internal.o
  731. endif
  732. ifdef CONFIG_INTERNAL_SHA512
  733. CFLAGS += -DCONFIG_INTERNAL_SHA512
  734. OBJS += ../src/crypto/sha512-internal.o
  735. endif
  736. ifdef NEED_DH_GROUPS
  737. OBJS += ../src/crypto/dh_groups.o
  738. endif
  739. ifdef NEED_DH_GROUPS_ALL
  740. CFLAGS += -DALL_DH_GROUPS
  741. endif
  742. ifdef CONFIG_INTERNAL_DH_GROUP5
  743. ifdef NEED_DH_GROUPS
  744. OBJS += ../src/crypto/dh_group5.o
  745. endif
  746. endif
  747. ifdef NEED_ECC
  748. CFLAGS += -DCONFIG_ECC
  749. endif
  750. ifdef CONFIG_NO_RANDOM_POOL
  751. CFLAGS += -DCONFIG_NO_RANDOM_POOL
  752. else
  753. OBJS += ../src/crypto/random.o
  754. HOBJS += ../src/crypto/random.o
  755. HOBJS += ../src/utils/eloop.o
  756. HOBJS += $(SHA1OBJS)
  757. ifneq ($(CONFIG_TLS), openssl)
  758. HOBJS += ../src/crypto/md5.o
  759. endif
  760. endif
  761. ifdef CONFIG_RADIUS_SERVER
  762. CFLAGS += -DRADIUS_SERVER
  763. OBJS += ../src/radius/radius_server.o
  764. endif
  765. ifdef CONFIG_IPV6
  766. CFLAGS += -DCONFIG_IPV6
  767. endif
  768. ifdef CONFIG_DRIVER_RADIUS_ACL
  769. CFLAGS += -DCONFIG_DRIVER_RADIUS_ACL
  770. endif
  771. ifdef CONFIG_FULL_DYNAMIC_VLAN
  772. # define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges
  773. # and vlan interfaces for the vlan feature.
  774. CFLAGS += -DCONFIG_FULL_DYNAMIC_VLAN
  775. endif
  776. ifdef NEED_BASE64
  777. OBJS += ../src/utils/base64.o
  778. endif
  779. ifdef NEED_AP_MLME
  780. OBJS += ../src/ap/wmm.o
  781. OBJS += ../src/ap/ap_list.o
  782. OBJS += ../src/ap/ieee802_11.o
  783. OBJS += ../src/ap/hw_features.o
  784. OBJS += ../src/ap/dfs.o
  785. CFLAGS += -DNEED_AP_MLME
  786. endif
  787. ifdef CONFIG_IEEE80211N
  788. OBJS += ../src/ap/ieee802_11_ht.o
  789. endif
  790. ifdef CONFIG_IEEE80211AC
  791. OBJS += ../src/ap/ieee802_11_vht.o
  792. endif
  793. ifdef CONFIG_P2P_MANAGER
  794. CFLAGS += -DCONFIG_P2P_MANAGER
  795. OBJS += ../src/ap/p2p_hostapd.o
  796. endif
  797. ifdef CONFIG_HS20
  798. CFLAGS += -DCONFIG_HS20
  799. OBJS += ../src/ap/hs20.o
  800. CONFIG_INTERWORKING=y
  801. endif
  802. ifdef CONFIG_INTERWORKING
  803. CFLAGS += -DCONFIG_INTERWORKING
  804. OBJS += ../src/common/gas.o
  805. OBJS += ../src/ap/gas_serv.o
  806. endif
  807. ifdef CONFIG_PROXYARP
  808. CFLAGS += -DCONFIG_PROXYARP
  809. OBJS += ../src/ap/x_snoop.o
  810. OBJS += ../src/ap/dhcp_snoop.o
  811. ifdef CONFIG_IPV6
  812. OBJS += ../src/ap/ndisc_snoop.o
  813. endif
  814. endif
  815. OBJS += ../src/drivers/driver_common.o
  816. ifdef CONFIG_WPA_CLI_EDIT
  817. OBJS_c += ../src/utils/edit.o
  818. else
  819. OBJS_c += ../src/utils/edit_simple.o
  820. endif
  821. ifdef CONFIG_ACS
  822. CFLAGS += -DCONFIG_ACS
  823. OBJS += ../src/ap/acs.o
  824. LIBS += -lm
  825. endif
  826. ifdef CONFIG_NO_STDOUT_DEBUG
  827. CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
  828. endif
  829. ifdef CONFIG_DEBUG_LINUX_TRACING
  830. CFLAGS += -DCONFIG_DEBUG_LINUX_TRACING
  831. endif
  832. ifdef CONFIG_DEBUG_FILE
  833. CFLAGS += -DCONFIG_DEBUG_FILE
  834. endif
  835. ifdef CONFIG_SQLITE
  836. CFLAGS += -DCONFIG_SQLITE
  837. LIBS += -lsqlite3
  838. LIBS_h += -lsqlite3
  839. endif
  840. ifdef CONFIG_FST
  841. CFLAGS += -DCONFIG_FST
  842. OBJS += ../src/fst/fst.o
  843. OBJS += ../src/fst/fst_group.o
  844. OBJS += ../src/fst/fst_iface.o
  845. OBJS += ../src/fst/fst_session.o
  846. OBJS += ../src/fst/fst_ctrl_aux.o
  847. ifdef CONFIG_FST_TEST
  848. CFLAGS += -DCONFIG_FST_TEST
  849. endif
  850. ifndef CONFIG_NO_CTRL_IFACE
  851. OBJS += ../src/fst/fst_ctrl_iface.o
  852. endif
  853. endif
  854. ALL=hostapd hostapd_cli
  855. all: verify_config $(ALL)
  856. Q=@
  857. E=echo
  858. ifeq ($(V), 1)
  859. Q=
  860. E=true
  861. endif
  862. ifeq ($(QUIET), 1)
  863. Q=@
  864. E=true
  865. endif
  866. ifdef CONFIG_CODE_COVERAGE
  867. %.o: %.c
  868. @$(E) " CC " $<
  869. $(Q)cd $(dir $@); $(CC) -c -o $(notdir $@) $(CFLAGS) $(notdir $<)
  870. else
  871. %.o: %.c
  872. $(Q)$(CC) -c -o $@ $(CFLAGS) $<
  873. @$(E) " CC " $<
  874. endif
  875. verify_config:
  876. @if [ ! -r .config ]; then \
  877. echo 'Building hostapd requires a configuration file'; \
  878. echo '(.config). See README for more instructions. You can'; \
  879. echo 'run "cp defconfig .config" to create an example'; \
  880. echo 'configuration.'; \
  881. exit 1; \
  882. fi
  883. $(DESTDIR)$(BINDIR)/%: %
  884. install -D $(<) $(@)
  885. install: $(addprefix $(DESTDIR)$(BINDIR)/,$(ALL))
  886. ../src/drivers/build.hostapd:
  887. @if [ -f ../src/drivers/build.wpa_supplicant ]; then \
  888. $(MAKE) -C ../src/drivers clean; \
  889. fi
  890. @touch ../src/drivers/build.hostapd
  891. BCHECK=../src/drivers/build.hostapd
  892. hostapd: $(BCHECK) $(OBJS)
  893. $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
  894. @$(E) " LD " $@
  895. ifdef CONFIG_WPA_TRACE
  896. OBJS_c += ../src/utils/trace.o
  897. endif
  898. hostapd_cli: $(OBJS_c)
  899. $(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c)
  900. @$(E) " LD " $@
  901. NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS)
  902. NOBJS += ../src/utils/common.o
  903. ifdef NEED_RC4
  904. ifdef CONFIG_INTERNAL_RC4
  905. ifndef CONFIG_NO_RC4
  906. NOBJS += ../src/crypto/rc4.o
  907. endif
  908. endif
  909. endif
  910. ifdef CONFIG_INTERNAL_MD5
  911. NOBJS += ../src/crypto/md5-internal.o
  912. endif
  913. NOBJS += ../src/crypto/crypto_openssl.o ../src/utils/os_$(CONFIG_OS).o
  914. NOBJS += ../src/utils/wpa_debug.o
  915. NOBJS += ../src/utils/wpabuf.o
  916. ifdef CONFIG_WPA_TRACE
  917. NOBJS += ../src/utils/trace.o
  918. LIBS_n += -lbfd
  919. endif
  920. ifdef TLS_FUNCS
  921. LIBS_n += -lcrypto
  922. endif
  923. 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
  924. HOBJS += ../src/crypto/aes-encblock.o
  925. ifdef CONFIG_INTERNAL_AES
  926. HOBJS += ../src/crypto/aes-internal.o
  927. HOBJS += ../src/crypto/aes-internal-enc.o
  928. endif
  929. nt_password_hash: $(NOBJS)
  930. $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
  931. @$(E) " LD " $@
  932. hlr_auc_gw: $(HOBJS)
  933. $(Q)$(CC) $(LDFLAGS) -o hlr_auc_gw $(HOBJS) $(LIBS_h)
  934. @$(E) " LD " $@
  935. lcov-html:
  936. lcov -c -d .. > lcov.info
  937. genhtml lcov.info --output-directory lcov-html
  938. clean:
  939. $(MAKE) -C ../src clean
  940. rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw
  941. rm -f *.d *.gcno *.gcda *.gcov
  942. rm -f lcov.info
  943. rm -rf lcov-html
  944. -include $(OBJS:%.o=%.d)