Makefile 22 KB

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