Makefile 19 KB

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