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