Makefile 18 KB

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