Makefile 18 KB

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