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