From 2d106f21aa342e30710682c0ee5ecad211d11c2a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 5 Dec 2009 22:51:08 +0200 Subject: [PATCH] Remove unnecessary defines The following defines are not really needed in most places, so remove them to clean up source code and build scripts: EAP_TLS_FUNCS EAP_TLS_OPENSSL EAP_TLS_GNUTLS CONFIG_TLS_INTERNAL --- eap_example/Makefile | 3 --- src/crypto/crypto_cryptoapi.c | 8 -------- src/crypto/crypto_internal.c | 3 --- src/crypto/crypto_libtomcrypt.c | 7 ------- src/eapol_supp/eapol_supp_sm.c | 2 -- src/eapol_supp/eapol_supp_sm.h | 2 -- src/tls/rsa.c | 2 -- src/utils/build_config.h | 6 ------ wpa_supplicant/Makefile | 2 -- wpa_supplicant/config.c | 2 -- wpa_supplicant/config.h | 2 -- wpa_supplicant/config_file.c | 4 ---- wpa_supplicant/ctrl_iface_dbus_handlers.c | 2 -- wpa_supplicant/eapol_test.c | 2 -- wpa_supplicant/nmake.mak | 1 - wpa_supplicant/wpas_glue.c | 2 -- 16 files changed, 50 deletions(-) diff --git a/eap_example/Makefile b/eap_example/Makefile index 28feb8f12..dbbe45eff 100644 --- a/eap_example/Makefile +++ b/eap_example/Makefile @@ -89,7 +89,6 @@ CFLAGS += -DEAP_PSK CFLAGS += -DEAP_PAX CFLAGS += -DEAP_SAKE CFLAGS += -DEAP_GPSK -DEAP_GPSK_SHA256 -CFLAGS += -DEAP_TLS_FUNCS CFLAGS += -DEAP_SERVER_TLS CFLAGS += -DEAP_SERVER_PEAP @@ -105,7 +104,6 @@ CFLAGS += -DEAP_SERVER_GPSK -DEAP_SERVER_GPSK_SHA256 CFLAGS += -DIEEE8021X_EAPOL ifeq ($(CONFIG_TLS), openssl) -CFLAGS += -DEAP_TLS_OPENSSL OBJS_both += ../src/crypto/tls_openssl.o OBJS_both += ../src/crypto/crypto_openssl.o LIBS += -lssl -lcrypto @@ -113,7 +111,6 @@ CONFIG_INTERNAL_SHA256=y endif ifeq ($(CONFIG_TLS), gnutls) -CFLAGS += -DEAP_TLS_GNUTLS OBJS_both += ../src/crypto/tls_gnutls.o OBJS_both += ../src/crypto/crypto_gnutls.o LIBS += -lgnutls -lgcrypt diff --git a/src/crypto/crypto_cryptoapi.c b/src/crypto/crypto_cryptoapi.c index aef8d4581..568fe0fcd 100644 --- a/src/crypto/crypto_cryptoapi.c +++ b/src/crypto/crypto_cryptoapi.c @@ -33,7 +33,6 @@ L"Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)" #define CALG_HMAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HMAC) #endif -#ifdef CONFIG_TLS_INTERNAL #ifdef __MINGW32_VERSION /* * MinGW does not yet include all the needed definitions for CryptoAPI, so @@ -98,7 +97,6 @@ static int mingw_load_crypto_func(void) } #endif /* __MINGW32_VERSION */ -#endif /* CONFIG_TLS_INTERNAL */ static void cryptoapi_report_error(const char *msg) @@ -238,7 +236,6 @@ void des_encrypt(const u8 *clear, const u8 *key, u8 *cypher) } -#ifdef EAP_TLS_FUNCS int md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac) { return cryptoapi_hash_vector(CALG_MD5, 16, num_elem, addr, len, mac); @@ -364,7 +361,6 @@ void aes_decrypt_deinit(void *ctx) aes_encrypt_deinit(ctx); } -#ifdef CONFIG_TLS_INTERNAL struct crypto_hash { enum crypto_hash_alg alg; @@ -796,7 +792,3 @@ int crypto_global_init(void) void crypto_global_deinit(void) { } - -#endif /* CONFIG_TLS_INTERNAL */ - -#endif /* EAP_TLS_FUNCS */ diff --git a/src/crypto/crypto_internal.c b/src/crypto/crypto_internal.c index 34b43aedb..84d30bb2d 100644 --- a/src/crypto/crypto_internal.c +++ b/src/crypto/crypto_internal.c @@ -27,8 +27,6 @@ #include "md5_i.h" #include "des_i.h" -#ifdef CONFIG_TLS_INTERNAL - struct crypto_hash { enum crypto_hash_alg alg; union { @@ -543,7 +541,6 @@ int crypto_global_init(void) void crypto_global_deinit(void) { } -#endif /* CONFIG_TLS_INTERNAL */ #ifdef CONFIG_MODEXP diff --git a/src/crypto/crypto_libtomcrypt.c b/src/crypto/crypto_libtomcrypt.c index 22ebce82a..52b67a713 100644 --- a/src/crypto/crypto_libtomcrypt.c +++ b/src/crypto/crypto_libtomcrypt.c @@ -62,7 +62,6 @@ void des_encrypt(const u8 *clear, const u8 *key, u8 *cypher) } -#ifdef EAP_TLS_FUNCS int md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac) { hash_state md; @@ -147,8 +146,6 @@ void aes_decrypt_deinit(void *ctx) } -#ifdef CONFIG_TLS_INTERNAL - struct crypto_hash { enum crypto_hash_alg alg; int error; @@ -733,7 +730,3 @@ fail: } #endif /* CONFIG_MODEXP */ - -#endif /* CONFIG_TLS_INTERNAL */ - -#endif /* EAP_TLS_FUNCS */ diff --git a/src/eapol_supp/eapol_supp_sm.c b/src/eapol_supp/eapol_supp_sm.c index 01f0ec12a..77cd564b0 100644 --- a/src/eapol_supp/eapol_supp_sm.c +++ b/src/eapol_supp/eapol_supp_sm.c @@ -1854,11 +1854,9 @@ struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx) sm->authPeriod = 30; os_memset(&conf, 0, sizeof(conf)); -#ifdef EAP_TLS_OPENSSL conf.opensc_engine_path = ctx->opensc_engine_path; conf.pkcs11_engine_path = ctx->pkcs11_engine_path; conf.pkcs11_module_path = ctx->pkcs11_module_path; -#endif /* EAP_TLS_OPENSSL */ conf.wps = ctx->wps; sm->eap = eap_peer_sm_init(sm, &eapol_cb, sm->ctx->msg_ctx, &conf); diff --git a/src/eapol_supp/eapol_supp_sm.h b/src/eapol_supp/eapol_supp_sm.h index 00fc8864a..1d2a32bb7 100644 --- a/src/eapol_supp/eapol_supp_sm.h +++ b/src/eapol_supp/eapol_supp_sm.h @@ -173,7 +173,6 @@ struct eapol_ctx { */ void (*aborted_cached)(void *ctx); -#ifdef EAP_TLS_OPENSSL /** * opensc_engine_path - Path to the OpenSSL engine for opensc * @@ -198,7 +197,6 @@ struct eapol_ctx { * module is not loaded. */ const char *pkcs11_module_path; -#endif /* EAP_TLS_OPENSSL */ /** * wps - WPS context data diff --git a/src/tls/rsa.c b/src/tls/rsa.c index 03676babe..3084adc17 100644 --- a/src/tls/rsa.c +++ b/src/tls/rsa.c @@ -34,7 +34,6 @@ struct crypto_rsa_key { }; -#ifdef EAP_TLS_FUNCS static const u8 * crypto_rsa_parse_integer(const u8 *pos, const u8 *end, struct bignum *num) { @@ -223,7 +222,6 @@ error: crypto_rsa_free(key); return NULL; } -#endif /* EAP_TLS_FUNCS */ /** diff --git a/src/utils/build_config.h b/src/utils/build_config.h index 0e1d4dc0d..7f54b0444 100644 --- a/src/utils/build_config.h +++ b/src/utils/build_config.h @@ -28,7 +28,6 @@ #define CONFIG_ANSI_C_EXTRA #define CONFIG_WINPCAP #define IEEE8021X_EAPOL -#define EAP_TLS_FUNCS #define PKCS12_FUNCS #define PCSC_FUNCS #define CONFIG_CTRL_IFACE @@ -48,7 +47,6 @@ #define _CRT_SECURE_NO_DEPRECATE #ifdef USE_INTERNAL_CRYPTO -#define CONFIG_TLS_INTERNAL #define CONFIG_TLS_INTERNAL_CLIENT #define CONFIG_INTERNAL_LIBTOMMATH #define CONFIG_INTERNAL_X509 @@ -65,8 +63,6 @@ #define CONFIG_BACKEND_FILE #define CONFIG_INTERNAL_LIBTOMMATH #define CONFIG_INTERNAL_X509 -#define EAP_TLS_FUNCS -#define CONFIG_TLS_INTERNAL #define CONFIG_CRYPTO_INTERNAL #define IEEE8021X_EAPOL #define PKCS12_FUNCS @@ -85,7 +81,6 @@ #define CONFIG_DRIVER_OSX #define CONFIG_BACKEND_FILE #define IEEE8021X_EAPOL -#define EAP_TLS_FUNCS #define PKCS12_FUNCS #define CONFIG_CTRL_IFACE #define CONFIG_CTRL_IFACE_UNIX @@ -103,7 +98,6 @@ #define EAP_WSC #ifdef USE_INTERNAL_CRYPTO -#define CONFIG_TLS_INTERNAL #define CONFIG_TLS_INTERNAL_CLIENT #define CONFIG_INTERNAL_LIBTOMMATH #define CONFIG_INTERNAL_X509 diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile index 428f01033..00f5dc27c 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -694,7 +694,6 @@ endif ifdef TLS_FUNCS NEED_DES=y # Shared TLS functions (needed for EAP_TLS, EAP_PEAP, EAP_TTLS, and EAP_FAST) -CFLAGS += -DEAP_TLS_FUNCS OBJS += ../src/eap_peer/eap_tls_common.o OBJS_h += ../src/eap_server/eap_tls_common.o NEED_TLS_PRF=y @@ -794,7 +793,6 @@ OBJS_p += ../src/crypto/rc4.o NEED_BASE64=y NEED_TLS_PRF=y NEED_MODEXP=y -CFLAGS += -DCONFIG_TLS_INTERNAL CFLAGS += -DCONFIG_TLS_INTERNAL_CLIENT endif ifdef NEED_MODEXP diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 35c46fa99..b6c5aa89a 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -1661,11 +1661,9 @@ void wpa_config_free(struct wpa_config *config) os_free(config->ctrl_interface); os_free(config->ctrl_interface_group); -#ifdef EAP_TLS_OPENSSL os_free(config->opensc_engine_path); os_free(config->pkcs11_engine_path); os_free(config->pkcs11_module_path); -#endif /* EAP_TLS_OPENSSL */ os_free(config->driver_param); os_free(config->device_name); os_free(config->manufacturer); diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index b9f0da67e..84eef48a1 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -169,7 +169,6 @@ struct wpa_config { */ int fast_reauth; -#ifdef EAP_TLS_OPENSSL /** * opensc_engine_path - Path to the OpenSSL engine for opensc * @@ -194,7 +193,6 @@ struct wpa_config { * module is not loaded. */ char *pkcs11_module_path; -#endif /* EAP_TLS_OPENSSL */ /** * driver_param - Driver interface parameters diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 29e494c1e..07a1e8ae1 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -434,11 +434,9 @@ static const struct global_parse_data global_fields[] = { { INT_RANGE(eapol_version, 1, 2) }, { INT(ap_scan) }, { INT(fast_reauth) }, -#ifdef EAP_TLS_OPENSSL { STR(opensc_engine_path) }, { STR(pkcs11_engine_path) }, { STR(pkcs11_module_path) }, -#endif /* EAP_TLS_OPENSSL */ { STR(driver_param) }, { INT(dot11RSNAConfigPMKLifetime) }, { INT(dot11RSNAConfigPMKReauthThreshold) }, @@ -837,7 +835,6 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config) fprintf(f, "ap_scan=%d\n", config->ap_scan); if (config->fast_reauth != DEFAULT_FAST_REAUTH) fprintf(f, "fast_reauth=%d\n", config->fast_reauth); -#ifdef EAP_TLS_OPENSSL if (config->opensc_engine_path) fprintf(f, "opensc_engine_path=%s\n", config->opensc_engine_path); @@ -847,7 +844,6 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config) if (config->pkcs11_module_path) fprintf(f, "pkcs11_module_path=%s\n", config->pkcs11_module_path); -#endif /* EAP_TLS_OPENSSL */ if (config->driver_param) fprintf(f, "driver_param=%s\n", config->driver_param); if (config->dot11RSNAConfigPMKLifetime) diff --git a/wpa_supplicant/ctrl_iface_dbus_handlers.c b/wpa_supplicant/ctrl_iface_dbus_handlers.c index d685697a0..08623ec36 100644 --- a/wpa_supplicant/ctrl_iface_dbus_handlers.c +++ b/wpa_supplicant/ctrl_iface_dbus_handlers.c @@ -1262,14 +1262,12 @@ DBusMessage * wpas_dbus_iface_set_smartcard_modules( wpa_dbus_dict_entry_clear(&entry); } -#ifdef EAP_TLS_OPENSSL os_free(wpa_s->conf->opensc_engine_path); wpa_s->conf->opensc_engine_path = opensc_engine_path; os_free(wpa_s->conf->pkcs11_engine_path); wpa_s->conf->pkcs11_engine_path = pkcs11_engine_path; os_free(wpa_s->conf->pkcs11_module_path); wpa_s->conf->pkcs11_module_path = pkcs11_module_path; -#endif /* EAP_TLS_OPENSSL */ wpa_sm_set_eapol(wpa_s->wpa, NULL); eapol_sm_deinit(wpa_s->eapol); diff --git a/wpa_supplicant/eapol_test.c b/wpa_supplicant/eapol_test.c index 0d493237c..2820cfbc0 100644 --- a/wpa_supplicant/eapol_test.c +++ b/wpa_supplicant/eapol_test.c @@ -404,11 +404,9 @@ static int test_eapol(struct eapol_test_data *e, struct wpa_supplicant *wpa_s, ctx->eapol_send = eapol_test_eapol_send; ctx->set_config_blob = eapol_test_set_config_blob; ctx->get_config_blob = eapol_test_get_config_blob; -#ifdef EAP_TLS_OPENSSL ctx->opensc_engine_path = wpa_s->conf->opensc_engine_path; ctx->pkcs11_engine_path = wpa_s->conf->pkcs11_engine_path; ctx->pkcs11_module_path = wpa_s->conf->pkcs11_module_path; -#endif /* EAP_TLS_OPENSSL */ wpa_s->eapol = eapol_sm_init(ctx); if (wpa_s->eapol == NULL) { diff --git a/wpa_supplicant/nmake.mak b/wpa_supplicant/nmake.mak index 2b20f6407..f2b1049ec 100644 --- a/wpa_supplicant/nmake.mak +++ b/wpa_supplicant/nmake.mak @@ -28,7 +28,6 @@ CFLAGS = $(CFLAGS) /DCONFIG_NDIS_EVENTS_INTEGRATED CFLAGS = $(CFLAGS) /DCONFIG_ANSI_C_EXTRA CFLAGS = $(CFLAGS) /DCONFIG_WINPCAP CFLAGS = $(CFLAGS) /DIEEE8021X_EAPOL -CFLAGS = $(CFLAGS) /DEAP_TLS_FUNCS CFLAGS = $(CFLAGS) /DPKCS12_FUNCS CFLAGS = $(CFLAGS) /DEAP_MD5 CFLAGS = $(CFLAGS) /DEAP_TLS diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c index f72bf3cc8..01264de91 100644 --- a/wpa_supplicant/wpas_glue.c +++ b/wpa_supplicant/wpas_glue.c @@ -568,11 +568,9 @@ int wpa_supplicant_init_eapol(struct wpa_supplicant *wpa_s) ctx->set_config_blob = wpa_supplicant_set_config_blob; ctx->get_config_blob = wpa_supplicant_get_config_blob; ctx->aborted_cached = wpa_supplicant_aborted_cached; -#ifdef EAP_TLS_OPENSSL ctx->opensc_engine_path = wpa_s->conf->opensc_engine_path; ctx->pkcs11_engine_path = wpa_s->conf->pkcs11_engine_path; ctx->pkcs11_module_path = wpa_s->conf->pkcs11_module_path; -#endif /* EAP_TLS_OPENSSL */ ctx->wps = wpa_s->wps; ctx->eap_param_needed = wpa_supplicant_eap_param_needed; ctx->port_cb = wpa_supplicant_port_cb;