Makefile 20 KB

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