Makefile 20 KB

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