1 ifndef CC 2 CC=gcc 3 endif 4 5 ifndef CFLAGS 6 CFLAGS = -MMD -O2 -Wall -g 7 endif 8 9 CFLAGS += $(EXTRA_CFLAGS) 10 CFLAGS += -I$(abspath ../src) 11 CFLAGS += -I$(abspath ../src/utils) 12 13 export BINDIR ?= /usr/local/bin/ 14 15 # Uncomment following line and set the path to your kernel tree include 16 # directory if your C library does not include all header files. 17 # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include 18 19 -include .config 20 21 ifdef CONFIG_TESTING_OPTIONS 22 CFLAGS += -DCONFIG_TESTING_OPTIONS 23 CONFIG_WPS_TESTING=y 24 endif 25 26 ifndef CONFIG_OS 27 ifdef CONFIG_NATIVE_WINDOWS 28 CONFIG_OS=win32 29 else 30 CONFIG_OS=unix 31 endif 32 endif 33 34 ifeq ($(CONFIG_OS), internal) 35 CFLAGS += -DOS_NO_C_LIB_DEFINES 36 endif 37 38 ifdef CONFIG_NATIVE_WINDOWS 39 CFLAGS += -DCONFIG_NATIVE_WINDOWS 40 LIBS += -lws2_32 41 endif 42 43 OBJS += main.o 44 OBJS += config_file.o 45 46 OBJS += ../src/ap/hostapd.o 47 OBJS += ../src/ap/wpa_auth_glue.o 48 OBJS += ../src/ap/drv_callbacks.o 49 OBJS += ../src/ap/ap_drv_ops.o 50 OBJS += ../src/ap/utils.o 51 OBJS += ../src/ap/authsrv.o 52 OBJS += ../src/ap/ieee802_1x.o 53 OBJS += ../src/ap/ap_config.o 54 OBJS += ../src/ap/eap_user_db.o 55 OBJS += ../src/ap/ieee802_11_auth.o 56 OBJS += ../src/ap/sta_info.o 57 OBJS += ../src/ap/wpa_auth.o 58 OBJS += ../src/ap/tkip_countermeasures.o 59 OBJS += ../src/ap/ap_mlme.o 60 OBJS += ../src/ap/wpa_auth_ie.o 61 OBJS += ../src/ap/preauth_auth.o 62 OBJS += ../src/ap/pmksa_cache_auth.o 63 OBJS += ../src/ap/ieee802_11_shared.o 64 OBJS += ../src/ap/beacon.o 65 OBJS += ../src/ap/bss_load.o 66 67 OBJS_c = hostapd_cli.o ../src/common/wpa_ctrl.o ../src/utils/os_$(CONFIG_OS).o 68 69 NEED_RC4=y 70 NEED_AES=y 71 NEED_MD5=y 72 NEED_SHA1=y 73 74 OBJS += ../src/drivers/drivers.o 75 CFLAGS += -DHOSTAPD 76 77 ifdef CONFIG_MODULE_TESTS 78 CFLAGS += -DCONFIG_MODULE_TESTS 79 OBJS += hapd_module_tests.o 80 endif 81 82 ifdef CONFIG_WPA_TRACE 83 CFLAGS += -DWPA_TRACE 84 OBJS += ../src/utils/trace.o 85 HOBJS += ../src/utils/trace.o 86 LDFLAGS += -rdynamic 87 CFLAGS += -funwind-tables 88 ifdef CONFIG_WPA_TRACE_BFD 89 CFLAGS += -DPACKAGE="hostapd" -DWPA_TRACE_BFD 90 LIBS += -lbfd -ldl -liberty -lz 91 LIBS_c += -lbfd -ldl -liberty -lz 92 LIBS_h += -lbfd -ldl -liberty -lz 93 endif 94 endif 95 96 ifndef CONFIG_ELOOP 97 CONFIG_ELOOP=eloop 98 endif 99 OBJS += ../src/utils/$(CONFIG_ELOOP).o 100 OBJS_c += ../src/utils/$(CONFIG_ELOOP).o 101 102 ifeq ($(CONFIG_ELOOP), eloop) 103 # Using glibc < 2.17 requires -lrt for clock_gettime() 104 LIBS += -lrt 105 LIBS_c += -lrt 106 LIBS_h += -lrt 107 LIBS_n += -lrt 108 endif 109 110 OBJS += ../src/utils/common.o 111 OBJS_c += ../src/utils/common.o 112 OBJS += ../src/utils/wpa_debug.o 113 OBJS_c += ../src/utils/wpa_debug.o 114 OBJS += ../src/utils/wpabuf.o 115 OBJS += ../src/utils/os_$(CONFIG_OS).o 116 OBJS += ../src/utils/ip_addr.o 117 118 OBJS += ../src/common/ieee802_11_common.o 119 OBJS += ../src/common/wpa_common.o 120 OBJS += ../src/common/hw_features_common.o 121 122 OBJS += ../src/eapol_auth/eapol_auth_sm.o 123 124 125 ifdef CONFIG_CODE_COVERAGE 126 CFLAGS += -O0 -fprofile-arcs -ftest-coverage 127 LIBS += -lgcov 128 LIBS_c += -lgcov 129 LIBS_h += -lgcov 130 LIBS_n += -lgcov 131 endif 132 133 ifndef CONFIG_NO_DUMP_STATE 134 # define HOSTAPD_DUMP_STATE to include support for dumping internal state 135 # through control interface commands (undefine it, if you want to save in 136 # binary size) 137 CFLAGS += -DHOSTAPD_DUMP_STATE 138 OBJS += ../src/eapol_auth/eapol_auth_dump.o 139 endif 140 141 ifdef CONFIG_NO_RADIUS 142 CFLAGS += -DCONFIG_NO_RADIUS 143 CONFIG_NO_ACCOUNTING=y 144 else 145 OBJS += ../src/radius/radius.o 146 OBJS += ../src/radius/radius_client.o 147 OBJS += ../src/radius/radius_das.o 148 endif 149 150 ifdef CONFIG_NO_ACCOUNTING 151 CFLAGS += -DCONFIG_NO_ACCOUNTING 152 else 153 OBJS += ../src/ap/accounting.o 154 endif 155 156 ifdef CONFIG_NO_VLAN 157 CFLAGS += -DCONFIG_NO_VLAN 158 else 159 OBJS += ../src/ap/vlan_init.o 160 ifdef CONFIG_VLAN_NETLINK 161 ifdef CONFIG_FULL_DYNAMIC_VLAN 162 OBJS += ../src/ap/vlan_util.o 163 endif 164 CFLAGS += -DCONFIG_VLAN_NETLINK 165 endif 166 endif 167 168 ifdef CONFIG_NO_CTRL_IFACE 169 CFLAGS += -DCONFIG_NO_CTRL_IFACE 170 else 171 OBJS += ctrl_iface.o 172 OBJS += ../src/ap/ctrl_iface_ap.o 173 endif 174 175 CFLAGS += -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX 176 177 ifdef CONFIG_IAPP 178 CFLAGS += -DCONFIG_IAPP 179 OBJS += ../src/ap/iapp.o 180 endif 181 182 ifdef CONFIG_RSN_PREAUTH 183 CFLAGS += -DCONFIG_RSN_PREAUTH 184 CONFIG_L2_PACKET=y 185 endif 186 187 ifdef CONFIG_PEERKEY 188 CFLAGS += -DCONFIG_PEERKEY 189 OBJS += ../src/ap/peerkey_auth.o 190 endif 191 192 ifdef CONFIG_HS20 193 NEED_AES_OMAC1=y 194 CONFIG_PROXYARP=y 195 endif 196 197 ifdef CONFIG_PROXYARP 198 CONFIG_L2_PACKET=y 199 endif 200 201 ifdef CONFIG_SUITEB 202 CFLAGS += -DCONFIG_SUITEB 203 NEED_SHA256=y 204 NEED_AES_OMAC1=y 205 endif 206 207 ifdef CONFIG_SUITEB192 208 CFLAGS += -DCONFIG_SUITEB192 209 NEED_SHA384=y 210 endif 211 212 ifdef CONFIG_IEEE80211W 213 CFLAGS += -DCONFIG_IEEE80211W 214 NEED_SHA256=y 215 NEED_AES_OMAC1=y 216 endif 217 218 ifdef CONFIG_IEEE80211R 219 CFLAGS += -DCONFIG_IEEE80211R 220 OBJS += ../src/ap/wpa_auth_ft.o 221 NEED_SHA256=y 222 NEED_AES_OMAC1=y 223 NEED_AES_UNWRAP=y 224 endif 225 226 ifdef CONFIG_SAE 227 CFLAGS += -DCONFIG_SAE 228 OBJS += ../src/common/sae.o 229 NEED_ECC=y 230 NEED_DH_GROUPS=y 231 NEED_AP_MLME=y 232 endif 233 234 ifdef CONFIG_WNM 235 CFLAGS += -DCONFIG_WNM 236 OBJS += ../src/ap/wnm_ap.o 237 endif 238 239 ifdef CONFIG_IEEE80211N 240 CFLAGS += -DCONFIG_IEEE80211N 241 endif 242 243 ifdef CONFIG_IEEE80211AC 244 CFLAGS += -DCONFIG_IEEE80211AC 245 endif 246 247 include ../src/drivers/drivers.mak 248 OBJS += $(DRV_AP_OBJS) 249 CFLAGS += $(DRV_AP_CFLAGS) 250 LDFLAGS += $(DRV_AP_LDFLAGS) 251 LIBS += $(DRV_AP_LIBS) 252 253 ifdef CONFIG_L2_PACKET 254 ifdef CONFIG_DNET_PCAP 255 ifdef CONFIG_L2_FREEBSD 256 LIBS += -lpcap 257 OBJS += ../src/l2_packet/l2_packet_freebsd.o 258 else 259 LIBS += -ldnet -lpcap 260 OBJS += ../src/l2_packet/l2_packet_pcap.o 261 endif 262 else 263 OBJS += ../src/l2_packet/l2_packet_linux.o 264 endif 265 else 266 OBJS += ../src/l2_packet/l2_packet_none.o 267 endif 268 269 270 ifdef CONFIG_ERP 271 CFLAGS += -DCONFIG_ERP 272 NEED_SHA256=y 273 NEED_HMAC_SHA256_KDF=y 274 endif 275 276 ifdef CONFIG_EAP_MD5 277 CFLAGS += -DEAP_SERVER_MD5 278 OBJS += ../src/eap_server/eap_server_md5.o 279 CHAP=y 280 endif 281 282 ifdef CONFIG_EAP_TLS 283 CFLAGS += -DEAP_SERVER_TLS 284 OBJS += ../src/eap_server/eap_server_tls.o 285 TLS_FUNCS=y 286 endif 287 288 ifdef CONFIG_EAP_UNAUTH_TLS 289 CFLAGS += -DEAP_SERVER_UNAUTH_TLS 290 ifndef CONFIG_EAP_TLS 291 OBJS += ../src/eap_server/eap_server_tls.o 292 TLS_FUNCS=y 293 endif 294 endif 295 296 ifdef CONFIG_EAP_PEAP 297 CFLAGS += -DEAP_SERVER_PEAP 298 OBJS += ../src/eap_server/eap_server_peap.o 299 OBJS += ../src/eap_common/eap_peap_common.o 300 TLS_FUNCS=y 301 CONFIG_EAP_MSCHAPV2=y 302 endif 303 304 ifdef CONFIG_EAP_TTLS 305 CFLAGS += -DEAP_SERVER_TTLS 306 OBJS += ../src/eap_server/eap_server_ttls.o 307 TLS_FUNCS=y 308 CHAP=y 309 endif 310 311 ifdef CONFIG_EAP_MSCHAPV2 312 CFLAGS += -DEAP_SERVER_MSCHAPV2 313 OBJS += ../src/eap_server/eap_server_mschapv2.o 314 MS_FUNCS=y 315 endif 316 317 ifdef CONFIG_EAP_GTC 318 CFLAGS += -DEAP_SERVER_GTC 319 OBJS += ../src/eap_server/eap_server_gtc.o 320 endif 321 322 ifdef CONFIG_EAP_SIM 323 CFLAGS += -DEAP_SERVER_SIM 324 OBJS += ../src/eap_server/eap_server_sim.o 325 CONFIG_EAP_SIM_COMMON=y 326 NEED_AES_CBC=y 327 endif 328 329 ifdef CONFIG_EAP_AKA 330 CFLAGS += -DEAP_SERVER_AKA 331 OBJS += ../src/eap_server/eap_server_aka.o 332 CONFIG_EAP_SIM_COMMON=y 333 NEED_SHA256=y 334 NEED_AES_CBC=y 335 endif 336 337 ifdef CONFIG_EAP_AKA_PRIME 338 CFLAGS += -DEAP_SERVER_AKA_PRIME 339 endif 340 341 ifdef CONFIG_EAP_SIM_COMMON 342 OBJS += ../src/eap_common/eap_sim_common.o 343 # Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be 344 # replaced with another file implementating the interface specified in 345 # eap_sim_db.h. 346 OBJS += ../src/eap_server/eap_sim_db.o 347 NEED_FIPS186_2_PRF=y 348 endif 349 350 ifdef CONFIG_EAP_PAX 351 CFLAGS += -DEAP_SERVER_PAX 352 OBJS += ../src/eap_server/eap_server_pax.o ../src/eap_common/eap_pax_common.o 353 endif 354 355 ifdef CONFIG_EAP_PSK 356 CFLAGS += -DEAP_SERVER_PSK 357 OBJS += ../src/eap_server/eap_server_psk.o ../src/eap_common/eap_psk_common.o 358 NEED_AES_OMAC1=y 359 NEED_AES_ENCBLOCK=y 360 NEED_AES_EAX=y 361 endif 362 363 ifdef CONFIG_EAP_SAKE 364 CFLAGS += -DEAP_SERVER_SAKE 365 OBJS += ../src/eap_server/eap_server_sake.o ../src/eap_common/eap_sake_common.o 366 endif 367 368 ifdef CONFIG_EAP_GPSK 369 CFLAGS += -DEAP_SERVER_GPSK 370 OBJS += ../src/eap_server/eap_server_gpsk.o ../src/eap_common/eap_gpsk_common.o 371 ifdef CONFIG_EAP_GPSK_SHA256 372 CFLAGS += -DEAP_GPSK_SHA256 373 endif 374 NEED_SHA256=y 375 NEED_AES_OMAC1=y 376 endif 377 378 ifdef CONFIG_EAP_PWD 379 CFLAGS += -DEAP_SERVER_PWD 380 OBJS += ../src/eap_server/eap_server_pwd.o ../src/eap_common/eap_pwd_common.o 381 NEED_SHA256=y 382 endif 383 384 ifdef CONFIG_EAP_EKE 385 CFLAGS += -DEAP_SERVER_EKE 386 OBJS += ../src/eap_server/eap_server_eke.o ../src/eap_common/eap_eke_common.o 387 NEED_DH_GROUPS=y 388 NEED_DH_GROUPS_ALL=y 389 endif 390 391 ifdef CONFIG_EAP_VENDOR_TEST 392 CFLAGS += -DEAP_SERVER_VENDOR_TEST 393 OBJS += ../src/eap_server/eap_server_vendor_test.o 394 endif 395 396 ifdef CONFIG_EAP_FAST 397 CFLAGS += -DEAP_SERVER_FAST 398 OBJS += ../src/eap_server/eap_server_fast.o 399 OBJS += ../src/eap_common/eap_fast_common.o 400 TLS_FUNCS=y 401 NEED_T_PRF=y 402 NEED_AES_UNWRAP=y 403 endif 404 405 ifdef CONFIG_WPS 406 CFLAGS += -DCONFIG_WPS -DEAP_SERVER_WSC 407 OBJS += ../src/utils/uuid.o 408 OBJS += ../src/ap/wps_hostapd.o 409 OBJS += ../src/eap_server/eap_server_wsc.o ../src/eap_common/eap_wsc_common.o 410 OBJS += ../src/wps/wps.o 411 OBJS += ../src/wps/wps_common.o 412 OBJS += ../src/wps/wps_attr_parse.o 413 OBJS += ../src/wps/wps_attr_build.o 414 OBJS += ../src/wps/wps_attr_process.o 415 OBJS += ../src/wps/wps_dev_attr.o 416 OBJS += ../src/wps/wps_enrollee.o 417 OBJS += ../src/wps/wps_registrar.o 418 NEED_DH_GROUPS=y 419 NEED_SHA256=y 420 NEED_BASE64=y 421 NEED_AES_CBC=y 422 NEED_MODEXP=y 423 CONFIG_EAP=y 424 425 ifdef CONFIG_WPS_NFC 426 CFLAGS += -DCONFIG_WPS_NFC 427 OBJS += ../src/wps/ndef.o 428 NEED_WPS_OOB=y 429 endif 430 431 ifdef NEED_WPS_OOB 432 CFLAGS += -DCONFIG_WPS_OOB 433 endif 434 435 ifdef CONFIG_WPS_UPNP 436 CFLAGS += -DCONFIG_WPS_UPNP 437 OBJS += ../src/wps/wps_upnp.o 438 OBJS += ../src/wps/wps_upnp_ssdp.o 439 OBJS += ../src/wps/wps_upnp_web.o 440 OBJS += ../src/wps/wps_upnp_event.o 441 OBJS += ../src/wps/wps_upnp_ap.o 442 OBJS += ../src/wps/upnp_xml.o 443 OBJS += ../src/wps/httpread.o 444 OBJS += ../src/wps/http_client.o 445 OBJS += ../src/wps/http_server.o 446 endif 447 448 ifdef CONFIG_WPS_STRICT 449 CFLAGS += -DCONFIG_WPS_STRICT 450 OBJS += ../src/wps/wps_validate.o 451 endif 452 453 ifdef CONFIG_WPS_TESTING 454 CFLAGS += -DCONFIG_WPS_TESTING 455 endif 456 457 endif 458 459 ifdef CONFIG_EAP_IKEV2 460 CFLAGS += -DEAP_SERVER_IKEV2 461 OBJS += ../src/eap_server/eap_server_ikev2.o ../src/eap_server/ikev2.o 462 OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o 463 NEED_DH_GROUPS=y 464 NEED_DH_GROUPS_ALL=y 465 NEED_MODEXP=y 466 NEED_CIPHER=y 467 endif 468 469 ifdef CONFIG_EAP_TNC 470 CFLAGS += -DEAP_SERVER_TNC 471 OBJS += ../src/eap_server/eap_server_tnc.o 472 OBJS += ../src/eap_server/tncs.o 473 NEED_BASE64=y 474 ifndef CONFIG_DRIVER_BSD 475 LIBS += -ldl 476 endif 477 endif 478 479 # Basic EAP functionality is needed for EAPOL 480 OBJS += eap_register.o 481 OBJS += ../src/eap_server/eap_server.o 482 OBJS += ../src/eap_common/eap_common.o 483 OBJS += ../src/eap_server/eap_server_methods.o 484 OBJS += ../src/eap_server/eap_server_identity.o 485 CFLAGS += -DEAP_SERVER_IDENTITY 486 487 ifdef CONFIG_EAP 488 CFLAGS += -DEAP_SERVER 489 endif 490 491 ifdef CONFIG_PKCS12 492 CFLAGS += -DPKCS12_FUNCS 493 endif 494 495 ifdef MS_FUNCS 496 OBJS += ../src/crypto/ms_funcs.o 497 NEED_DES=y 498 NEED_MD4=y 499 endif 500 501 ifdef CHAP 502 OBJS += ../src/eap_common/chap.o 503 endif 504 505 ifdef TLS_FUNCS 506 NEED_DES=y 507 # Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS) 508 CFLAGS += -DEAP_TLS_FUNCS 509 OBJS += ../src/eap_server/eap_server_tls_common.o 510 NEED_TLS_PRF=y 511 endif 512 513 ifndef CONFIG_TLS 514 CONFIG_TLS=openssl 515 endif 516 517 ifdef CONFIG_TLSV11 518 CFLAGS += -DCONFIG_TLSV11 519 endif 520 521 ifdef CONFIG_TLSV12 522 CFLAGS += -DCONFIG_TLSV12 523 NEED_SHA256=y 524 endif 525 526 ifeq ($(CONFIG_TLS), openssl) 527 ifdef TLS_FUNCS 528 OBJS += ../src/crypto/tls_openssl.o 529 LIBS += -lssl 530 endif 531 OBJS += ../src/crypto/crypto_openssl.o 532 HOBJS += ../src/crypto/crypto_openssl.o 533 ifdef NEED_FIPS186_2_PRF 534 OBJS += ../src/crypto/fips_prf_openssl.o 535 endif 536 LIBS += -lcrypto 537 LIBS_h += -lcrypto 538 endif 539 540 ifeq ($(CONFIG_TLS), gnutls) 541 ifdef TLS_FUNCS 542 OBJS += ../src/crypto/tls_gnutls.o 543 LIBS += -lgnutls -lgpg-error 544 endif 545 OBJS += ../src/crypto/crypto_gnutls.o 546 HOBJS += ../src/crypto/crypto_gnutls.o 547 ifdef NEED_FIPS186_2_PRF 548 OBJS += ../src/crypto/fips_prf_internal.o 549 SHA1OBJS += ../src/crypto/sha1-internal.o 550 endif 551 LIBS += -lgcrypt 552 LIBS_h += -lgcrypt 553 CONFIG_INTERNAL_SHA256=y 554 CONFIG_INTERNAL_RC4=y 555 CONFIG_INTERNAL_DH_GROUP5=y 556 endif 557 558 ifeq ($(CONFIG_TLS), internal) 559 ifndef CONFIG_CRYPTO 560 CONFIG_CRYPTO=internal 561 endif 562 ifdef TLS_FUNCS 563 OBJS += ../src/crypto/crypto_internal-rsa.o 564 OBJS += ../src/crypto/tls_internal.o 565 OBJS += ../src/tls/tlsv1_common.o 566 OBJS += ../src/tls/tlsv1_record.o 567 OBJS += ../src/tls/tlsv1_cred.o 568 OBJS += ../src/tls/tlsv1_server.o 569 OBJS += ../src/tls/tlsv1_server_write.o 570 OBJS += ../src/tls/tlsv1_server_read.o 571 OBJS += ../src/tls/asn1.o 572 OBJS += ../src/tls/rsa.o 573 OBJS += ../src/tls/x509v3.o 574 OBJS += ../src/tls/pkcs1.o 575 OBJS += ../src/tls/pkcs5.o 576 OBJS += ../src/tls/pkcs8.o 577 NEED_SHA256=y 578 NEED_BASE64=y 579 NEED_TLS_PRF=y 580 ifdef CONFIG_TLSV12 581 NEED_TLS_PRF_SHA256=y 582 endif 583 NEED_MODEXP=y 584 NEED_CIPHER=y 585 CFLAGS += -DCONFIG_TLS_INTERNAL 586 CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER 587 endif 588 ifdef NEED_CIPHER 589 NEED_DES=y 590 OBJS += ../src/crypto/crypto_internal-cipher.o 591 endif 592 ifdef NEED_MODEXP 593 OBJS += ../src/crypto/crypto_internal-modexp.o 594 OBJS += ../src/tls/bignum.o 595 endif 596 ifeq ($(CONFIG_CRYPTO), libtomcrypt) 597 OBJS += ../src/crypto/crypto_libtomcrypt.o 598 LIBS += -ltomcrypt -ltfm 599 LIBS_h += -ltomcrypt -ltfm 600 CONFIG_INTERNAL_SHA256=y 601 CONFIG_INTERNAL_RC4=y 602 CONFIG_INTERNAL_DH_GROUP5=y 603 endif 604 ifeq ($(CONFIG_CRYPTO), internal) 605 OBJS += ../src/crypto/crypto_internal.o 606 NEED_AES_DEC=y 607 CFLAGS += -DCONFIG_CRYPTO_INTERNAL 608 ifdef CONFIG_INTERNAL_LIBTOMMATH 609 CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH 610 ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST 611 CFLAGS += -DLTM_FAST 612 endif 613 else 614 LIBS += -ltommath 615 LIBS_h += -ltommath 616 endif 617 CONFIG_INTERNAL_AES=y 618 CONFIG_INTERNAL_DES=y 619 CONFIG_INTERNAL_SHA1=y 620 CONFIG_INTERNAL_MD4=y 621 CONFIG_INTERNAL_MD5=y 622 CONFIG_INTERNAL_SHA256=y 623 CONFIG_INTERNAL_RC4=y 624 CONFIG_INTERNAL_DH_GROUP5=y 625 endif 626 ifeq ($(CONFIG_CRYPTO), cryptoapi) 627 OBJS += ../src/crypto/crypto_cryptoapi.o 628 OBJS_p += ../src/crypto/crypto_cryptoapi.o 629 CFLAGS += -DCONFIG_CRYPTO_CRYPTOAPI 630 CONFIG_INTERNAL_SHA256=y 631 CONFIG_INTERNAL_RC4=y 632 endif 633 endif 634 635 ifeq ($(CONFIG_TLS), none) 636 ifdef TLS_FUNCS 637 OBJS += ../src/crypto/tls_none.o 638 CFLAGS += -DEAP_TLS_NONE 639 CONFIG_INTERNAL_AES=y 640 CONFIG_INTERNAL_SHA1=y 641 CONFIG_INTERNAL_MD5=y 642 endif 643 OBJS += ../src/crypto/crypto_none.o 644 OBJS_p += ../src/crypto/crypto_none.o 645 CONFIG_INTERNAL_SHA256=y 646 CONFIG_INTERNAL_RC4=y 647 endif 648 649 ifndef TLS_FUNCS 650 OBJS += ../src/crypto/tls_none.o 651 ifeq ($(CONFIG_TLS), internal) 652 CONFIG_INTERNAL_AES=y 653 CONFIG_INTERNAL_SHA1=y 654 CONFIG_INTERNAL_MD5=y 655 CONFIG_INTERNAL_RC4=y 656 endif 657 endif 658 659 AESOBJS = # none so far 660 ifdef CONFIG_INTERNAL_AES 661 AESOBJS += ../src/crypto/aes-internal.o ../src/crypto/aes-internal-enc.o 662 endif 663 664 ifneq ($(CONFIG_TLS), openssl) 665 AESOBJS += ../src/crypto/aes-wrap.o 666 endif 667 ifdef NEED_AES_EAX 668 AESOBJS += ../src/crypto/aes-eax.o 669 NEED_AES_CTR=y 670 endif 671 ifdef NEED_AES_CTR 672 AESOBJS += ../src/crypto/aes-ctr.o 673 endif 674 ifdef NEED_AES_ENCBLOCK 675 AESOBJS += ../src/crypto/aes-encblock.o 676 endif 677 ifdef NEED_AES_OMAC1 678 AESOBJS += ../src/crypto/aes-omac1.o 679 endif 680 ifdef NEED_AES_UNWRAP 681 ifneq ($(CONFIG_TLS), openssl) 682 NEED_AES_DEC=y 683 AESOBJS += ../src/crypto/aes-unwrap.o 684 endif 685 endif 686 ifdef NEED_AES_CBC 687 NEED_AES_DEC=y 688 ifneq ($(CONFIG_TLS), openssl) 689 AESOBJS += ../src/crypto/aes-cbc.o 690 endif 691 endif 692 ifdef NEED_AES_DEC 693 ifdef CONFIG_INTERNAL_AES 694 AESOBJS += ../src/crypto/aes-internal-dec.o 695 endif 696 endif 697 ifdef NEED_AES 698 OBJS += $(AESOBJS) 699 endif 700 701 ifdef NEED_SHA1 702 ifneq ($(CONFIG_TLS), openssl) 703 SHA1OBJS += ../src/crypto/sha1.o 704 endif 705 SHA1OBJS += ../src/crypto/sha1-prf.o 706 ifdef CONFIG_INTERNAL_SHA1 707 SHA1OBJS += ../src/crypto/sha1-internal.o 708 ifdef NEED_FIPS186_2_PRF 709 SHA1OBJS += ../src/crypto/fips_prf_internal.o 710 endif 711 endif 712 ifneq ($(CONFIG_TLS), openssl) 713 SHA1OBJS += ../src/crypto/sha1-pbkdf2.o 714 endif 715 ifdef NEED_T_PRF 716 SHA1OBJS += ../src/crypto/sha1-tprf.o 717 endif 718 ifdef NEED_TLS_PRF 719 SHA1OBJS += ../src/crypto/sha1-tlsprf.o 720 endif 721 endif 722 723 ifdef NEED_SHA1 724 OBJS += $(SHA1OBJS) 725 endif 726 727 ifneq ($(CONFIG_TLS), openssl) 728 OBJS += ../src/crypto/md5.o 729 endif 730 731 ifdef NEED_MD5 732 ifdef CONFIG_INTERNAL_MD5 733 OBJS += ../src/crypto/md5-internal.o 734 HOBJS += ../src/crypto/md5-internal.o 735 endif 736 endif 737 738 ifdef NEED_MD4 739 ifdef CONFIG_INTERNAL_MD4 740 OBJS += ../src/crypto/md4-internal.o 741 endif 742 endif 743 744 ifdef NEED_DES 745 ifdef CONFIG_INTERNAL_DES 746 OBJS += ../src/crypto/des-internal.o 747 endif 748 endif 749 750 ifdef NEED_RC4 751 ifdef CONFIG_INTERNAL_RC4 752 OBJS += ../src/crypto/rc4.o 753 endif 754 endif 755 756 ifdef NEED_SHA256 757 CFLAGS += -DCONFIG_SHA256 758 ifneq ($(CONFIG_TLS), openssl) 759 OBJS += ../src/crypto/sha256.o 760 endif 761 OBJS += ../src/crypto/sha256-prf.o 762 ifdef CONFIG_INTERNAL_SHA256 763 OBJS += ../src/crypto/sha256-internal.o 764 endif 765 ifdef NEED_TLS_PRF_SHA256 766 OBJS += ../src/crypto/sha256-tlsprf.o 767 endif 768 ifdef NEED_HMAC_SHA256_KDF 769 OBJS += ../src/crypto/sha256-kdf.o 770 endif 771 endif 772 ifdef NEED_SHA384 773 CFLAGS += -DCONFIG_SHA384 774 endif 775 776 ifdef NEED_DH_GROUPS 777 OBJS += ../src/crypto/dh_groups.o 778 endif 779 ifdef NEED_DH_GROUPS_ALL 780 CFLAGS += -DALL_DH_GROUPS 781 endif 782 ifdef CONFIG_INTERNAL_DH_GROUP5 783 ifdef NEED_DH_GROUPS 784 OBJS += ../src/crypto/dh_group5.o 785 endif 786 endif 787 788 ifdef NEED_ECC 789 CFLAGS += -DCONFIG_ECC 790 endif 791 792 ifdef CONFIG_NO_RANDOM_POOL 793 CFLAGS += -DCONFIG_NO_RANDOM_POOL 794 else 795 OBJS += ../src/crypto/random.o 796 HOBJS += ../src/crypto/random.o 797 HOBJS += ../src/utils/eloop.o 798 HOBJS += $(SHA1OBJS) 799 ifneq ($(CONFIG_TLS), openssl) 800 HOBJS += ../src/crypto/md5.o 801 endif 802 endif 803 804 ifdef CONFIG_RADIUS_SERVER 805 CFLAGS += -DRADIUS_SERVER 806 OBJS += ../src/radius/radius_server.o 807 endif 808 809 ifdef CONFIG_IPV6 810 CFLAGS += -DCONFIG_IPV6 811 endif 812 813 ifdef CONFIG_DRIVER_RADIUS_ACL 814 CFLAGS += -DCONFIG_DRIVER_RADIUS_ACL 815 endif 816 817 ifdef CONFIG_FULL_DYNAMIC_VLAN 818 # define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges 819 # and vlan interfaces for the vlan feature. 820 CFLAGS += -DCONFIG_FULL_DYNAMIC_VLAN 821 endif 822 823 ifdef NEED_BASE64 824 OBJS += ../src/utils/base64.o 825 endif 826 827 ifdef NEED_AP_MLME 828 OBJS += ../src/ap/wmm.o 829 OBJS += ../src/ap/ap_list.o 830 OBJS += ../src/ap/ieee802_11.o 831 OBJS += ../src/ap/hw_features.o 832 OBJS += ../src/ap/dfs.o 833 CFLAGS += -DNEED_AP_MLME 834 endif 835 ifdef CONFIG_IEEE80211N 836 OBJS += ../src/ap/ieee802_11_ht.o 837 endif 838 839 ifdef CONFIG_IEEE80211AC 840 OBJS += ../src/ap/ieee802_11_vht.o 841 endif 842 843 ifdef CONFIG_P2P_MANAGER 844 CFLAGS += -DCONFIG_P2P_MANAGER 845 OBJS += ../src/ap/p2p_hostapd.o 846 endif 847 848 ifdef CONFIG_HS20 849 CFLAGS += -DCONFIG_HS20 850 OBJS += ../src/ap/hs20.o 851 CONFIG_INTERWORKING=y 852 endif 853 854 ifdef CONFIG_INTERWORKING 855 CFLAGS += -DCONFIG_INTERWORKING 856 OBJS += ../src/common/gas.o 857 OBJS += ../src/ap/gas_serv.o 858 endif 859 860 ifdef CONFIG_PROXYARP 861 CFLAGS += -DCONFIG_PROXYARP 862 OBJS += ../src/ap/x_snoop.o 863 OBJS += ../src/ap/dhcp_snoop.o 864 ifdef CONFIG_IPV6 865 OBJS += ../src/ap/ndisc_snoop.o 866 endif 867 endif 868 869 OBJS += ../src/drivers/driver_common.o 870 871 ifdef CONFIG_WPA_CLI_EDIT 872 OBJS_c += ../src/utils/edit.o 873 else 874 OBJS_c += ../src/utils/edit_simple.o 875 endif 876 877 ifdef CONFIG_ACS 878 CFLAGS += -DCONFIG_ACS 879 OBJS += ../src/ap/acs.o 880 LIBS += -lm 881 endif 882 883 ifdef CONFIG_NO_STDOUT_DEBUG 884 CFLAGS += -DCONFIG_NO_STDOUT_DEBUG 885 endif 886 887 ifdef CONFIG_DEBUG_LINUX_TRACING 888 CFLAGS += -DCONFIG_DEBUG_LINUX_TRACING 889 endif 890 891 ifdef CONFIG_DEBUG_FILE 892 CFLAGS += -DCONFIG_DEBUG_FILE 893 endif 894 895 ifdef CONFIG_SQLITE 896 CFLAGS += -DCONFIG_SQLITE 897 LIBS += -lsqlite3 898 LIBS_h += -lsqlite3 899 endif 900 901 ALL=hostapd hostapd_cli 902 903 all: verify_config $(ALL) 904 905 Q=@ 906 E=echo 907 ifeq ($(V), 1) 908 Q= 909 E=true 910 endif 911 ifeq ($(QUIET), 1) 912 Q=@ 913 E=true 914 endif 915 916 ifdef CONFIG_CODE_COVERAGE 917 %.o: %.c 918 @$(E) " CC " $< 919 $(Q)cd $(dir $@); $(CC) -c -o $(notdir $@) $(CFLAGS) $(notdir $<) 920 else 921 %.o: %.c 922 $(Q)$(CC) -c -o $@ $(CFLAGS) $< 923 @$(E) " CC " $< 924 endif 925 926 verify_config: 927 @if [ ! -r .config ]; then \ 928 echo 'Building hostapd requires a configuration file'; \ 929 echo '(.config). See README for more instructions. You can'; \ 930 echo 'run "cp defconfig .config" to create an example'; \ 931 echo 'configuration.'; \ 932 exit 1; \ 933 fi 934 935 $(DESTDIR)$(BINDIR)/%: % 936 install -D $(<) $(@) 937 938 install: $(addprefix $(DESTDIR)$(BINDIR)/,$(ALL)) 939 940 ../src/drivers/build.hostapd: 941 @if [ -f ../src/drivers/build.wpa_supplicant ]; then \ 942 $(MAKE) -C ../src/drivers clean; \ 943 fi 944 @touch ../src/drivers/build.hostapd 945 946 BCHECK=../src/drivers/build.hostapd 947 948 hostapd: $(BCHECK) $(OBJS) 949 $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) 950 @$(E) " LD " $@ 951 952 ifdef CONFIG_WPA_TRACE 953 OBJS_c += ../src/utils/trace.o 954 endif 955 hostapd_cli: $(OBJS_c) 956 $(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c) 957 @$(E) " LD " $@ 958 959 NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) 960 NOBJS += ../src/utils/common.o 961 ifdef NEED_RC4 962 ifdef CONFIG_INTERNAL_RC4 963 NOBJS += ../src/crypto/rc4.o 964 endif 965 endif 966 ifdef CONFIG_INTERNAL_MD5 967 NOBJS += ../src/crypto/md5-internal.o 968 endif 969 NOBJS += ../src/crypto/crypto_openssl.o ../src/utils/os_$(CONFIG_OS).o 970 NOBJS += ../src/utils/wpa_debug.o 971 NOBJS += ../src/utils/wpabuf.o 972 ifdef CONFIG_WPA_TRACE 973 NOBJS += ../src/utils/trace.o 974 LIBS_n += -lbfd 975 endif 976 ifdef TLS_FUNCS 977 LIBS_n += -lcrypto 978 endif 979 980 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 981 HOBJS += ../src/crypto/aes-encblock.o 982 ifdef CONFIG_INTERNAL_AES 983 HOBJS += ../src/crypto/aes-internal.o 984 HOBJS += ../src/crypto/aes-internal-enc.o 985 endif 986 987 nt_password_hash: $(NOBJS) 988 $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n) 989 @$(E) " LD " $@ 990 991 hlr_auc_gw: $(HOBJS) 992 $(Q)$(CC) $(LDFLAGS) -o hlr_auc_gw $(HOBJS) $(LIBS_h) 993 @$(E) " LD " $@ 994 995 lcov-html: 996 lcov -c -d .. > lcov.info 997 genhtml lcov.info --output-directory lcov-html 998 999 clean: 1000 $(MAKE) -C ../src clean 1001 rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw 1002 rm -f *.d *.gcno *.gcda *.gcov 1003 rm -f lcov.info 1004 rm -rf lcov-html 1005 1006 -include $(OBJS:%.o=%.d) 1007