Makefile 20 KB

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