Makefile 20 KB

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