Makefile 20 KB

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