Makefile 21 KB

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