Makefile 20 KB

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