Makefile 22 KB

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