Makefile 19 KB

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