Makefile 21 KB

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