Makefile 16 KB

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