Makefile 22 KB

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