Makefile 19 KB

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