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