From 912321e93537c409aa4d75866df9b8e855d3e554 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 6 Dec 2009 16:27:54 +0200 Subject: [PATCH] Add rules for building src/tls/libtls.a and use it with eap_example eap_example is now using src/crypto/libcrypto.a and src/tls/libtls.a instead of providing own rules for building the files for these components. TLS library selection is temporarily disabled for eap_example (it will be built using internal crypto/TLS), but the configuration option for this will eventually be restored with a new libcrypto.a configuration option. --- eap_example/Makefile | 87 ++++---------------------------------------- src/tls/.gitignore | 1 + src/tls/Makefile | 35 ++++++++++++++++-- 3 files changed, 41 insertions(+), 82 deletions(-) create mode 100644 src/tls/.gitignore diff --git a/eap_example/Makefile b/eap_example/Makefile index ec26bc849..be4f6b6a6 100644 --- a/eap_example/Makefile +++ b/eap_example/Makefile @@ -14,11 +14,6 @@ ifndef CFLAGS CFLAGS = -MMD -O2 -Wall -g endif -CONFIG_TLS=openssl -#CONFIG_TLS=internal -#CONFIG_INTERNAL_LIBTOMMATH=y -#CONFIG_TLS=gnutls - CFLAGS += -I. CFLAGS += -I../src @@ -26,30 +21,8 @@ CFLAGS += -I../src/utils OBJS_both += ../src/utils/libutils.a -OBJS_both += ../src/crypto/sha1.o -OBJS_both += ../src/crypto/sha1-tlsprf.o -OBJS_both += ../src/crypto/aes-cbc.o -OBJS_both += ../src/crypto/aes-ctr.o -OBJS_both += ../src/crypto/aes-eax.o -OBJS_both += ../src/crypto/aes-encblock.o -OBJS_both += ../src/crypto/aes-omac1.o -OBJS_both += ../src/crypto/aes-unwrap.o -OBJS_both += ../src/crypto/aes-wrap.o -OBJS_both += ../src/crypto/ms_funcs.o - -ifeq ($(CONFIG_TLS), internal) -OBJS_both += ../src/crypto/rc4.o -OBJS_both += ../src/crypto/md4-internal.o -OBJS_both += ../src/crypto/sha1-internal.o -OBJS_both += ../src/crypto/des-internal.o -OBJS_both += ../src/crypto/aes-internal.o ../src/crypto/aes-internal-dec.o ../src/crypto/aes-internal-enc.o -endif -ifeq ($(CONFIG_TLS), gnutls) -OBJS_both += ../src/crypto/rc4.o -endif -SHA256OBJS = ../src/crypto/sha256.o - -MD5OBJS = ../src/crypto/md5.o +OBJS_both += ../src/crypto/libcrypto.a +OBJS_both += ../src/tls/libtls.a OBJS_both += ../src/eap_common/eap_peap_common.o OBJS_both += ../src/eap_common/eap_psk_common.o @@ -103,56 +76,6 @@ CFLAGS += -DEAP_SERVER_GPSK -DEAP_SERVER_GPSK_SHA256 CFLAGS += -DIEEE8021X_EAPOL -ifeq ($(CONFIG_TLS), openssl) -OBJS_both += ../src/crypto/tls_openssl.o -OBJS_both += ../src/crypto/crypto_openssl.o -LIBS += -lssl -lcrypto -endif - -ifeq ($(CONFIG_TLS), gnutls) -OBJS_both += ../src/crypto/tls_gnutls.o -OBJS_both += ../src/crypto/crypto_gnutls.o -LIBS += -lgnutls -lgcrypt -CONFIG_INTERNAL_SHA256=y -endif - -ifeq ($(CONFIG_TLS), internal) -OBJS_both += ../src/crypto/tls_internal.o -OBJS_both += ../src/tls/tlsv1_common.o ../src/tls/tlsv1_record.o -OBJS_both += ../src/tls/tlsv1_cred.o -OBJS_both += ../src/tls/asn1.o ../src/tls/x509v3.o -OBJS_both += ../src/crypto/crypto_internal.o ../src/tls/rsa.o ../src/tls/bignum.o -OBJS_both += ../src/tls/pkcs1.o -OBJS_both += ../src/tls/pkcs5.o -OBJS_both += ../src/tls/pkcs8.o - -OBJS_peer += ../src/tls/tlsv1_client.o -OBJS_peer += ../src/tls/tlsv1_client_write.o ../src/tls/tlsv1_client_read.o -CFLAGS += -DCONFIG_TLS_INTERNAL_CLIENT - -OBJS_server += ../src/tls/tlsv1_server.o -OBJS_server += ../src/tls/tlsv1_server_write.o ../src/tls/tlsv1_server_read.o -CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER - -CFLAGS += -DCONFIG_TLS_INTERNAL -CFLAGS += -DCONFIG_CRYPTO_INTERNAL -CFLAGS += -DCONFIG_INTERNAL_X509 -CONFIG_INTERNAL_SHA256=y -MD5OBJS += ../src/crypto/md5-internal.o -ifdef CONFIG_INTERNAL_LIBTOMMATH -CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH -else -LIBS += -ltommath -endif -endif - - -ifdef CONFIG_INTERNAL_SHA256 -SHA256OBJS += ../src/crypto/sha256-internal.o -endif - -OBJS_both += $(SHA256OBJS) $(MD5OBJS) - # Optional components to add EAP server support OBJS_server += ../src/eap_server/eap_tls.o @@ -196,6 +119,12 @@ OBJS_ex = eap_example.o eap_example_peer.o eap_example_server.o ../src/utils/libutils.a: $(MAKE) -C ../src/utils +../src/crypto/libcrypto.a: + $(MAKE) -C ../src/crypto + +../src/tls/libtls.a: + $(MAKE) -C ../src/tls + ifneq ($(CONFIG_SOLIB), yes) LIBEAP = libeap.a diff --git a/src/tls/.gitignore b/src/tls/.gitignore new file mode 100644 index 000000000..d43242d73 --- /dev/null +++ b/src/tls/.gitignore @@ -0,0 +1 @@ +libtls.a diff --git a/src/tls/Makefile b/src/tls/Makefile index cffba620d..0f02447a9 100644 --- a/src/tls/Makefile +++ b/src/tls/Makefile @@ -1,9 +1,38 @@ -all: - @echo Nothing to be made. +all: libtls.a clean: for d in $(SUBDIRS); do make -C $$d clean; done - rm -f *~ *.o *.d + rm -f *~ *.o *.d libtls.a install: @echo Nothing to be made. + + +include ../lib.rules + +CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH +CFLAGS += -DCONFIG_CRYPTO_INTERNAL + +LIB_OBJS= \ + asn1.o \ + bignum.o \ + pkcs1.o \ + pkcs5.o \ + pkcs8.o \ + rsa.o \ + tlsv1_client.o \ + tlsv1_client_read.o \ + tlsv1_client_write.o \ + tlsv1_common.o \ + tlsv1_cred.o \ + tlsv1_record.o \ + tlsv1_server.o \ + tlsv1_server_read.o \ + tlsv1_server_write.o \ + x509v3.o + + +libtls.a: $(LIB_OBJS) + $(AR) crT $@ $? + +-include $(OBJS:%.o=%.d)