Makefile 20 KB

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