Makefile 21 KB

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