From 246157cba6b506d47f55474125528e3546564df0 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 28 Jul 2009 21:09:57 +0300 Subject: [PATCH] Crypto build cleanup: remove INTERNAL_AES In addition, rename aes.c to aes-internal.c to match in style with SHA-1 conditionally built internal implementation. --- eap_example/Makefile | 3 +-- hostapd/Makefile | 16 ++++++++-------- src/crypto/{aes.c => aes-internal.c} | 5 ----- src/utils/build_config.h | 2 -- wpa_supplicant/Makefile | 22 +++++++++++----------- 5 files changed, 20 insertions(+), 28 deletions(-) rename src/crypto/{aes.c => aes-internal.c} (99%) diff --git a/eap_example/Makefile b/eap_example/Makefile index ae9e9f780..493eff0d6 100644 --- a/eap_example/Makefile +++ b/eap_example/Makefile @@ -36,13 +36,13 @@ OBJS_both += ../src/crypto/rc4.o OBJS_both += ../src/crypto/md4.o OBJS_both += ../src/crypto/sha1.o OBJS_both += ../src/crypto/aes_wrap.o -OBJS_both += ../src/crypto/aes.o OBJS_both += ../src/crypto/ms_funcs.o OBJS_both += ../src/crypto/sha256.o ifeq ($(CONFIG_TLS), internal) OBJS_both += ../src/crypto/sha1-internal.o OBJS_both += ../src/crypto/des-internal.o +OBJS_both += ../src/crypto/aes-internal.o endif @@ -124,7 +124,6 @@ CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER CFLAGS += -DCONFIG_TLS_INTERNAL CFLAGS += -DCONFIG_CRYPTO_INTERNAL CFLAGS += -DCONFIG_INTERNAL_X509 -CFLAGS += -DINTERNAL_AES CFLAGS += -DINTERNAL_SHA256 CFLAGS += -DINTERNAL_MD5 CFLAGS += -DINTERNAL_MD4 diff --git a/hostapd/Makefile b/hostapd/Makefile index 5b7fdca0c..beb18e5a1 100644 --- a/hostapd/Makefile +++ b/hostapd/Makefile @@ -44,7 +44,7 @@ OBJS = hostapd.o main.o ieee802_1x.o eapol_sm.o \ preauth.o pmksa_cache.o \ drv_callbacks.o \ tkip_countermeasures.o \ - mlme.o wpa_auth_ie.o + mlme.o wpa_auth_ie.o $(AESOBJS) OBJS += ../src/drivers/drivers.o OBJS += ../src/drivers/scan_helpers.o @@ -90,10 +90,8 @@ OBJS += ../src/crypto/md5.o OBJS += ../src/crypto/rc4.o OBJS += ../src/crypto/md4.o OBJS += ../src/crypto/sha1.o -OBJS += ../src/crypto/aes_wrap.o -OBJS += ../src/crypto/aes.o -HOBJS=../src/hlr_auc_gw/hlr_auc_gw.o ../src/utils/common.o ../src/utils/wpa_debug.o ../src/utils/os_$(CONFIG_OS).o ../src/hlr_auc_gw/milenage.o ../src/crypto/aes_wrap.o ../src/crypto/aes.o +AESOBJS = ../src/crypto/aes_wrap.o CFLAGS += -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX @@ -430,7 +428,7 @@ OBJS += ../src/tls/tlsv1_cred.o ../src/tls/tlsv1_server.o OBJS += ../src/tls/tlsv1_server_write.o ../src/tls/tlsv1_server_read.o OBJS += ../src/tls/asn1.o ../src/tls/x509v3.o OBJS_p += ../src/tls/asn1.o -OBJS_p += ../src/crypto/rc4.o ../src/crypto/aes_wrap.o ../src/crypto/aes.o +OBJS_p += ../src/crypto/rc4.o $(AESOBJS) NEED_BASE64=y CFLAGS += -DCONFIG_TLS_INTERNAL CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER @@ -531,7 +529,7 @@ CONFIG_INTERNAL_SHA256=y endif ifdef CONFIG_INTERNAL_AES -CFLAGS += -DINTERNAL_AES +AESOBJS += ../src/crypto/aes-internal.o endif ifdef CONFIG_INTERNAL_SHA1 OBJS += ../src/crypto/sha1-internal.o @@ -653,6 +651,8 @@ ifdef TLS_FUNCS LIBS_n += -lcrypto endif +HOBJS=../src/hlr_auc_gw/hlr_auc_gw.o ../src/utils/common.o ../src/utils/wpa_debug.o ../src/utils/os_$(CONFIG_OS).o ../src/hlr_auc_gw/milenage.o $(AESOBJS) + nt_password_hash: $(NOBJS) $(CC) -o nt_password_hash $(NOBJS) $(LIBS_n) @@ -685,10 +685,10 @@ clean-docs: rm -rf doc/latex doc/html rm -f doc/hostapd.{eps,png} hostapd-devel.pdf -TEST_SRC_MILENAGE = ../src/hlr_auc_gw/milenage.c ../src/crypto/aes_wrap.c ../src/crypto/aes.c ../src/utils/common.c ../src/utils/wpa_debug.o ../src/utils/os_$(CONFIG_OS).c +TEST_SRC_MILENAGE = ../src/hlr_auc_gw/milenage.c ../src/crypto/aes_wrap.c ../src/crypto/aes-internal.c ../src/utils/common.c ../src/utils/wpa_debug.o ../src/utils/os_$(CONFIG_OS).c test-milenage: $(TEST_SRC_MILENAGE) $(CC) -o test-milenage -Wall -Werror $(TEST_SRC_MILENAGE) \ - -DTEST_MAIN_MILENAGE -I. -DINTERNAL_AES \ + -DTEST_MAIN_MILENAGE -I. \ -I../src/crypto -I../src/utils ./test-milenage rm test-milenage diff --git a/src/crypto/aes.c b/src/crypto/aes-internal.c similarity index 99% rename from src/crypto/aes.c rename to src/crypto/aes-internal.c index 8b8f2a04d..2a78bb7b6 100644 --- a/src/crypto/aes.c +++ b/src/crypto/aes-internal.c @@ -24,9 +24,6 @@ #include "includes.h" #include "common.h" - -#ifdef INTERNAL_AES - #include "crypto.h" /* @@ -1123,5 +1120,3 @@ void aes_decrypt_deinit(void *ctx) os_free(ctx); } #endif /* CONFIG_NO_AES_DECRYPT */ - -#endif /* INTERNAL_AES */ diff --git a/src/utils/build_config.h b/src/utils/build_config.h index 0215bb58f..32a628e57 100644 --- a/src/utils/build_config.h +++ b/src/utils/build_config.h @@ -51,7 +51,6 @@ #define CONFIG_TLS_INTERNAL #define CONFIG_TLS_INTERNAL_CLIENT #define CONFIG_INTERNAL_LIBTOMMATH -#define INTERNAL_AES #define INTERNAL_SHA256 #define INTERNAL_MD5 #define INTERNAL_MD4 @@ -67,7 +66,6 @@ #define CONFIG_NO_HOSTAPD_LOGGER #define CONFIG_NO_STDOUT_DEBUG #define CONFIG_BACKEND_FILE -#define INTERNAL_AES #define INTERNAL_MD5 #define INTERNAL_MD4 #define CONFIG_INTERNAL_LIBTOMMATH diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile index 07e60acfa..cfc180ded 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -43,6 +43,7 @@ install: all SHA1OBJS = ../src/crypto/sha1.o DESOBJS = # none needed when not internal +AESOBJS = ../src/crypto/aes_wrap.o OBJS = config.o @@ -775,7 +776,7 @@ OBJS += ../src/tls/tlsv1_cred.o ../src/tls/tlsv1_client.o OBJS += ../src/tls/tlsv1_client_write.o ../src/tls/tlsv1_client_read.o OBJS += ../src/tls/asn1.o ../src/tls/rsa.o ../src/tls/x509v3.o OBJS_p += ../src/tls/asn1.o ../src/tls/rsa.o -OBJS_p += ../src/crypto/rc4.o ../src/crypto/aes_wrap.o ../src/crypto/aes.o +OBJS_p += ../src/crypto/rc4.o NEED_BASE64=y NEED_TLS_PRF=y CFLAGS += -DCONFIG_TLS_INTERNAL @@ -903,7 +904,7 @@ CONFIG_INTERNAL_MD5=y endif ifdef CONFIG_INTERNAL_AES -CFLAGS += -DINTERNAL_AES +AESOBJS += ../src/crypto/aes-internal.o endif ifdef CONFIG_INTERNAL_SHA1 SHA1OBJS += ../src/crypto/sha1-internal.o @@ -1065,7 +1066,7 @@ CFLAGS += -DCONFIG_NO_AES_ENCRYPT_BLOCK endif ifdef NEED_AES -OBJS += ../src/crypto/aes_wrap.o ../src/crypto/aes.o +OBJS += $(AESOBJS) endif ifdef NEED_DH_GROUPS @@ -1118,7 +1119,7 @@ endif OBJS += ../src/drivers/scan_helpers.o OBJS += $(SHA1OBJS) $(DESOBJS) -OBJS_p += $(SHA1OBJS) $(DESOBJS) +OBJS_p += $(SHA1OBJS) $(DESOBJS) $(AESOBJS) OBJS_wpa_rm := ctrl_iface.o mlme.o ctrl_iface_unix.o OBJS_wpa := $(filter-out $(OBJS_wpa_rm),$(OBJS)) $(OBJS_h) tests/test_wpa.o @@ -1212,16 +1213,15 @@ test_wpa: $(OBJS_wpa) $(OBJS_h) OBJSa=../src/tls/asn1_test.o ../src/tls/asn1.o ../src/tls/x509v3.o ../src/utils/common.o ../src/utils/wpa_debug.o ../src/utils/os_unix.o \ ../src/crypto/crypto_$(CONFIG_CRYPTO).o ../src/crypto/md5.o $(SHA1OBSJ) \ - ../src/crypto/rc4.o $(DESOBJS) ../src/crypto/aes_wrap.o \ - ../src/crypto/aes.o ../src/tls/bignum.o ../src/tls/rsa.o + ../src/crypto/rc4.o $(DESOBJS) $(AESOBJS) ../src/tls/bignum.o ../src/tls/rsa.o asn1_test: $(OBJSa) $(LDO) $(LDFLAGS) -o asn1_test $(OBJSa) OBJSx=tests/test_x509v3.o ../src/tls/asn1.o ../src/tls/x509v3.o \ ../src/utils/common.o ../src/utils/wpa_debug.o ../src/utils/os_unix.o \ ../src/crypto/crypto_$(CONFIG_CRYPTO).o \ - ../src/crypto/md5.o $(SHA1OBJS) ../src/crypto/aes.o \ - ../src/crypto/rc4.o $(DESOBJS) ../src/crypto/aes_wrap.o \ + ../src/crypto/md5.o $(SHA1OBJS) $(AESOBJS) \ + ../src/crypto/rc4.o $(DESOBJS) \ ../src/crypto/sha256.o \ ../src/tls/bignum.o ../src/tls/rsa.o test_x509v3: $(OBJSx) @@ -1312,15 +1312,15 @@ test-sha256: $(TEST_SHA256_OBJS) ./test-sha256 rm test-sha256 -TEST_AES_OBJS = ../src/crypto/aes_wrap.o ../src/crypto/aes.o tests/test_aes.o +TEST_AES_OBJS = tests/test_aes.o $(AESOBJS) test-aes: $(TEST_AES_OBJS) $(LDO) $(LDFLAGS) -o $@ $(TEST_AES_OBJS) $(LIBS) ./test-aes rm test-aes TEST_EAP_SIM_COMMON_OBJS = $(SHA1OBJS) ../src/crypto/md5.o \ - ../src/crypto/aes_wrap.o ../src/utils/common.o ../src/utils/os_unix.o \ - ../src/utils/wpa_debug.o ../src/crypto/aes.o \ + ../src/utils/common.o ../src/utils/os_unix.o \ + ../src/utils/wpa_debug.o $(AESOBJS) \ tests/test_eap_sim_common.o test-eap_sim_common: $(TEST_EAP_SIM_COMMON_OBJS) $(LDO) $(LDFLAGS) -o $@ $(TEST_AES_OBJS) $(LIBS)