Makefile 20 KB

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