diff -urN ../wpa_supplicant-0.6.10.orig/src/eap_peer/eap_methods.c ./src/eap_peer/eap_methods.c --- ../wpa_supplicant-0.6.10.orig/src/eap_peer/eap_methods.c 2010-01-12 06:55:02.000000000 -0800 +++ ./src/eap_peer/eap_methods.c 2010-05-12 14:57:02.000000000 -0700 @@ -339,6 +339,146 @@ } +// ###################################################### + +#ifdef EAP_MD5 + int eap_peer_md5_register(void); +#endif /* EAP_MD5 */ + +#ifdef EAP_TLS + int eap_peer_tls_register(void); +#endif /* EAP_TLS */ + +#ifdef EAP_MSCHAPv2 + int eap_peer_mschapv2_register(void); +#endif /* EAP_MSCHAPv2 */ + +#ifdef EAP_PEAP + int eap_peer_peap_register(void); +#endif /* EAP_PEAP */ + +#ifdef EAP_TTLS + int eap_peer_ttls_register(void); +#endif /* EAP_TTLS */ + +#ifdef EAP_GTC + int eap_peer_gtc_register(void); +#endif /* EAP_GTC */ + +#ifdef EAP_OTP + int eap_peer_otp_register(void); +#endif /* EAP_OTP */ + +#ifdef EAP_SIM + int eap_peer_sim_register(void); +#endif /* EAP_SIM */ + +#ifdef EAP_LEAP + int eap_peer_leap_register(void); +#endif /* EAP_LEAP */ + +#ifdef EAP_PSK + int eap_peer_psk_register(void); +#endif /* EAP_PSK */ + +#ifdef EAP_AKA + int eap_peer_aka_register(void); +#endif /* EAP_AKA */ + +#ifdef EAP_AKA_PRIME + int eap_peer_aka_prime_register(void); +#endif /* EAP_AKA_PRIME */ + +#ifdef EAP_FAST + int eap_peer_fast_register(void); +#endif /* EAP_FAST */ + +#ifdef EAP_PAX + int eap_peer_pax_register(void); +#endif /* EAP_PAX */ + +#ifdef EAP_SAKE + int eap_peer_sake_register(void); +#endif /* EAP_SAKE */ + +#ifdef EAP_GPSK + int eap_peer_gpsk_register(void); +#endif /* EAP_GPSK */ + +#ifdef EAP_WSC + int eap_peer_wsc_register(void); +#endif /* EAP_WSC */ + +#ifdef EAP_IKEV2 + int eap_peer_ikev2_register(void); +#endif /* EAP_IKEV2 */ + +#ifdef EAP_VENDOR_TEST + int eap_peer_vendor_test_register(void); +#endif /* EAP_VENDOR_TEST */ + +#ifdef EAP_TNC + int eap_peer_tnc_register(void); +#endif + +// ###################################################### + +int eap_peer_set_method(int eap_method) +{ + typedef int (*eap_method_register)(); + + static eap_method_register eap_method_register_funcs[] = + { + NULL, /* EAP_TYPE_NONE = 0, */ + NULL, /* EAP_TYPE_IDENTITY */ + NULL, /* EAP_TYPE_NOTIFICATION */ + NULL, /* EAP_TYPE_NAK */ +#ifdef EAP_MD5 + eap_peer_md5_register, +#else + NULL, /* EAP_TYPE_MD5 */ +#endif + NULL, // EAP_TYPE_OTP + NULL, // EAP_TYPE_GTC + NULL, // EAP_TYPE_LEAP + NULL, // EAP_TYPE_SIM + NULL, // EAP_TYPE_AKA + + NULL, // EAP_TYPE_PEAP + NULL, // EAP_TYPE_MSCHAPV2 + NULL, // EAP_TYPE_TLV +#ifdef EAP_TLS + eap_peer_tls_register, +#else + NULL, // EAP_TYPE_TLS +#endif + NULL, // EAP_TYPE_TNC + NULL, // EAP_TYPE_FAST + NULL, // EAP_TYPE_PAX + NULL, // EAP_TYPE_PSK + NULL, // EAP_TYPE_SAKE + NULL, // EAP_TYPE_IKEV2 + NULL, // EAP_TYPE_AKA_PRIME +#ifdef EAP_TTLS + eap_peer_ttls_register, +#else + NULL, // EAP_TYPE_TTLS +#endif + NULL // EAP_TYPE_GPSK + + }; + + + if ( eap_method_register_funcs[eap_method] != NULL ) + { + eap_method_register_funcs[eap_method](); + return 1; + } + else + return -1; +} + + /** * eap_peer_register_methods - Register statically linked EAP peer methods * Returns: 0 on success, -1 on failure diff -urN ../wpa_supplicant-0.6.10.orig/src/eap_peer/libeap0.pc ./src/eap_peer/libeap0.pc --- ../wpa_supplicant-0.6.10.orig/src/eap_peer/libeap0.pc 1969-12-31 16:00:00.000000000 -0800 +++ ./src/eap_peer/libeap0.pc 2010-05-12 14:57:02.000000000 -0700 @@ -0,0 +1,10 @@ +prefix=/usr/local +exec_prefix=/usr/local +libdir=${exec_prefix}/lib +includedir=${prefix}/include/eap_peer + +Name: libeap0 +Description: EAP Peer Library API +Version: 0.6.7 +Libs: -L${libdir} -leap +Cflags: -I${includedir} diff -urN ../wpa_supplicant-0.6.10.orig/src/eap_peer/Makefile ./src/eap_peer/Makefile --- ../wpa_supplicant-0.6.10.orig/src/eap_peer/Makefile 2010-01-12 06:55:02.000000000 -0800 +++ ./src/eap_peer/Makefile 2010-05-12 15:00:11.000000000 -0700 @@ -1,12 +1,177 @@ -all: - @echo Nothing to be made. +LIBEAP_NAME = libeap +LIBEAP_CURRENT = 0 +LIBEAP_REVISION = 0 +LIBEAP_AGE = 0 + +LIBEAP = $(LIBEAP_NAME).so.$(LIBEAP_CURRENT).$(LIBEAP_REVISION).$(LIBEAP_AGE) +LIBEAP_SO = $(LIBEAP_NAME).so.$(LIBEAP_CURRENT) + +.PHONY: all clean install uninstall + +all: $(LIBEAP) + +ifndef CC +CC=gcc +endif + +ifndef CFLAGS +CFLAGS = -MMD -O2 -Wall -g +endif + +CONFIG_TLS=openssl + +INCLUDE_INSTALL_DIR=/usr/local/include/eap_peer + +CFLAGS += -I. +CFLAGS += -I .. +CFLAGS += -I ../crypto +CFLAGS += -I ../utils +CFLAGS += -I ../common + +# at least for now, need to include config_ssid.h and config_blob.h from +# wpa_supplicant directory +CFLAGS += -I ../../wpa_supplicant + +OBJS_both += ../utils/common.o +OBJS_both += ../utils/os_unix.o +OBJS_both += ../utils/wpa_debug.o +OBJS_both += ../utils/base64.o +OBJS_both += ../utils/wpabuf.o +OBJS_both += ../crypto/md5.o +OBJS_both += ../crypto/rc4.o +OBJS_both += ../crypto/md4.o +OBJS_both += ../crypto/sha1.o +OBJS_both += ../crypto/des.o +OBJS_both += ../crypto/aes_wrap.o +OBJS_both += ../crypto/aes.o +OBJS_both += ../crypto/ms_funcs.o +OBJS_both += ../crypto/sha256.o + + +OBJS_both += ../eap_common/eap_peap_common.o +OBJS_both += ../eap_common/eap_psk_common.o +OBJS_both += ../eap_common/eap_pax_common.o +OBJS_both += ../eap_common/eap_sake_common.o +OBJS_both += ../eap_common/eap_gpsk_common.o +OBJS_both += ../eap_common/chap.o + +OBJS_peer += ../eap_peer/eap_tls.o +OBJS_peer += ../eap_peer/eap_peap.o +OBJS_peer += ../eap_peer/eap_ttls.o +OBJS_peer += ../eap_peer/eap_md5.o +OBJS_peer += ../eap_peer/eap_mschapv2.o +OBJS_peer += ../eap_peer/mschapv2.o +OBJS_peer += ../eap_peer/eap_otp.o +OBJS_peer += ../eap_peer/eap_gtc.o +OBJS_peer += ../eap_peer/eap_leap.o +OBJS_peer += ../eap_peer/eap_psk.o +OBJS_peer += ../eap_peer/eap_pax.o +OBJS_peer += ../eap_peer/eap_sake.o +OBJS_peer += ../eap_peer/eap_gpsk.o +OBJS_peer += ../eap_peer/eap.o +OBJS_peer += ../eap_common/eap_common.o +OBJS_peer += ../eap_peer/eap_methods.o +OBJS_peer += ../eap_peer/eap_tls_common.o + +CFLAGS += -DEAP_TLS +CFLAGS += -DEAP_PEAP +CFLAGS += -DEAP_TTLS +CFLAGS += -DEAP_MD5 +CFLAGS += -DEAP_MSCHAPv2 +CFLAGS += -DEAP_GTC +CFLAGS += -DEAP_OTP +CFLAGS += -DEAP_LEAP +CFLAGS += -DEAP_PSK +CFLAGS += -DEAP_PAX +CFLAGS += -DEAP_SAKE +CFLAGS += -DEAP_GPSK -DEAP_GPSK_SHA256 +CFLAGS += -DEAP_TLS_FUNCS + +CFLAGS += -DIEEE8021X_EAPOL + +ifeq ($(CONFIG_TLS), openssl) +CFLAGS += -DEAP_TLS_OPENSSL +OBJS_both += ../crypto/tls_openssl.o +OBJS_both += ../crypto/crypto_openssl.o +LIBS += -lssl -lcrypto +CFLAGS += -DINTERNAL_SHA256 +endif + +ifeq ($(CONFIG_TLS), internal) +OBJS_both += ../crypto/tls_internal.o +OBJS_both += ../tls/tlsv1_common.o ../../tls/tlsv1_record.o +OBJS_both += ../tls/tlsv1_cred.o +OBJS_both += ../tls/asn1.o ../../tls/x509v3.o +OBJS_both += ../crypto/crypto_internal.o ../../tls/rsa.o ../../tls/bignum.o + +OBJS_peer += ../tls/tlsv1_client.o +OBJS_peer += ../tls/tlsv1_client_write.o ../../tls/tlsv1_client_read.o +CFLAGS += -DCONFIG_TLS_INTERNAL_CLIENT + +OBJS_server += ../tls/tlsv1_server.o +OBJS_server += ../tls/tlsv1_server_write.o ../../tls/tlsv1_server_read.o +CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER + +CFLAGS += -DCONFIG_TLS_INTERNAL +CFLAGS += -DCONFIG_CRYPTO_INTERNAL +CFLAGS += -DCONFIG_INTERNAL_X509 +CFLAGS += -DINTERNAL_AES +CFLAGS += -DINTERNAL_SHA1 +CFLAGS += -DINTERNAL_SHA256 +CFLAGS += -DINTERNAL_MD5 +CFLAGS += -DINTERNAL_MD4 +CFLAGS += -DINTERNAL_DES +ifdef CONFIG_INTERNAL_LIBTOMMATH +CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH +else +LIBS += -ltommath +endif +endif + +ifndef LDO +LDO=$(CC) +endif + + +OBJS_lib=$(OBJS_both) $(OBJS_peer) + + #$(OBJS_server) + +CFLAGS += -fPIC -DPIC +LDFLAGS += -shared + +$(LIBEAP): $(OBJS_lib) + $(LDO) $(LDFLAGS) $(OBJS_lib) -Wl,-soname -Wl,$(LIBEAP_SO) -o $(LIBEAP) $(LIBS) + + +INCLUDE_HEADERS = ../utils/includes.h ../utils/common.h eap.h ../common/defs.h ../eap_common/eap_defs.h eap_methods.h eap_config.h ../utils/wpabuf.h ../crypto/tls.h ../utils/build_config.h ../utils/os.h ../utils/wpa_debug.h + +install: + + mkdir -p $(DESTDIR)/usr/local/lib +# copy the lib file to std lib location + cp $(LIBEAP) $(DESTDIR)/usr/local/lib + +# copy the headers reqd by apps using eap peer library in its own subfolder under /usr/include + test -z $(DESTDIR)/$(INCLUDE_INSTALL_DIR) || mkdir -p $(DESTDIR)/$(INCLUDE_INSTALL_DIR) + +# the header folder structure needs to be preserved. + test -z $(DESTDIR)/$(INCLUDE_INSTALL_DIR)/eap_common || mkdir -p $(DESTDIR)/$(INCLUDE_INSTALL_DIR)/eap_common + + cp $(INCLUDE_HEADERS) $(DESTDIR)/$(INCLUDE_INSTALL_DIR) + + mv $(DESTDIR)/$(INCLUDE_INSTALL_DIR)/eap_defs.h $(DESTDIR)/$(INCLUDE_INSTALL_DIR)/eap_common + + mkdir -p $(DESTDIR)/usr/local/lib/pkgconfig + cp libeap0.pc $(DESTDIR)/usr/local/lib/pkgconfig + +uninstall: + + rm $(DESTDIR)/usr/local/lib/$(LIBEAP) + rm -fr $(DESTDIR)/$(INCLUDE_INSTALL_DIR) + rm -f $(DESTDIR)/usr/local/lib/pkgconfig/libeap0.pc clean: - for d in $(SUBDIRS); do make -C $$d clean; done - rm -f *~ *.o *.so *.d + rm -f core *~ *.o *.d libeap.a $(LIBEAP) -install: - if ls *.so >/dev/null 2>&1; then \ - install -d $(DESTDIR)$(LIBDIR)/wpa_supplicant && \ - cp *.so $(DESTDIR)$(LIBDIR)/wpa_supplicant \ - ; fi +-include $(OBJS:%.o=%.d) diff -urN ../wpa_supplicant-0.6.10.orig/wpa_supplicant/Makefile ./wpa_supplicant/Makefile --- ../wpa_supplicant-0.6.10.orig/wpa_supplicant/Makefile 2010-01-12 06:55:02.000000000 -0800 +++ ./wpa_supplicant/Makefile 2010-05-12 14:57:02.000000000 -0700 @@ -17,7 +17,7 @@ ALL=wpa_supplicant wpa_passphrase wpa_cli -all: verify_config $(ALL) dynamic_eap_methods +all: verify_config $(ALL) dynamic_eap_methods eap_peer_lib verify_config: @if [ ! -r .config ]; then \ @@ -1102,6 +1102,9 @@ wpa_cli: $(OBJS_c) $(LDO) $(LDFLAGS) -o wpa_cli $(OBJS_c) $(LIBS_c) +eap_peer_lib: + $(MAKE) -C ../src/eap_peer + link_test: $(OBJS) $(OBJS_h) tests/link_test.o $(LDO) $(LDFLAGS) -o link_test $(OBJS) $(OBJS_h) tests/link_test.o $(LIBS)