# HG changeset patch # User Matt Johnston # Date 1279715926 0 # Node ID d194db6f9453edefbb8d6b80f4140157a887b29e # Parent 0442c18da5c9cab4998420d79ab0ebaa072238e4 Use system libtomcrypt/libtommath if available. Doesn't currently build due to clash in rsa_key identifier. diff -r 0442c18da5c9 -r d194db6f9453 Makefile.in --- a/Makefile.in Tue Jul 20 13:54:20 2010 +0000 +++ b/Makefile.in Wed Jul 21 12:38:46 2010 +0000 @@ -16,6 +16,12 @@ LTC=libtomcrypt/libtomcrypt.a LTM=libtommath/libtommath.a +ifeq (@BUNDLED_LIBTOM@, 1) +LIBTOM_DEPS=$(LTC) $(LTM) +CFLAGS+=-I$(srcdir)/libtomcrypt/src/headers/ +LIBS+=$(LTC) $(LTM) +endif + COMMONOBJS=dbutil.o buffer.o \ dss.o bignum.o \ signkey.o rsa.o random.o \ @@ -70,8 +76,8 @@ STRIP=@STRIP@ INSTALL=@INSTALL@ CPPFLAGS=@CPPFLAGS@ -CFLAGS=-I. -I$(srcdir) -I$(srcdir)/libtomcrypt/src/headers/ $(CPPFLAGS) @CFLAGS@ -LIBS=$(LTC) $(LTM) @LIBS@ +CFLAGS=-I. -I$(srcdir) $(CPPFLAGS) @CFLAGS@ +LIBS+=@LIBS@ LDFLAGS=@LDFLAGS@ EXEEXT=@EXEEXT@ @@ -107,10 +113,6 @@ CFLAGS+=-DPROGRESS_METER endif -#%: $(HEADERS) -#%: $(HEADERS) Makefile -# TODO - all: $(TARGETS) strip: $(TARGETS) @@ -154,8 +156,7 @@ dropbearkey: $(dropbearkeyobjs) dropbearconvert: $(dropbearconvertobjs) -dropbear dbclient dropbearkey dropbearconvert: $(HEADERS) $(LTC) $(LTM) \ - Makefile +dropbear dbclient dropbearkey dropbearconvert: $(HEADERS) $(LIBTOM_DEPS) Makefile $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBS) # scp doesn't use the libs so is special. @@ -172,7 +173,7 @@ dropbearmulti: multilink -multibinary: $(HEADERS) $(MULTIOBJS) $(LTC) $(LTM) Makefile +multibinary: $(HEADERS) $(MULTIOBJS) $(LIBTOM_DEPS) Makefile $(CC) $(LDFLAGS) -o dropbearmulti$(EXEEXT) $(MULTIOBJS) $(LIBS) multilink: multibinary $(addprefix link, $(PROGRAMS)) diff -r 0442c18da5c9 -r d194db6f9453 configure.in --- a/configure.in Tue Jul 20 13:54:20 2010 +0000 +++ b/configure.in Wed Jul 21 12:38:46 2010 +0000 @@ -363,6 +363,23 @@ AC_CHECK_FUNCS(setutxent utmpxname) AC_CHECK_FUNCS(logout updwtmp logwtmp) +AC_ARG_ENABLE(bundled-libtom, + [ --enable-bundled-libtom Use bundled libtomcrypt/libtommath even if a system version exists], + [ + AC_MSG_NOTICE(use bundled) + AC_DEFINE(BUNDLED_LIBTOM,,Use bundled libtom) + BUNDLED_LIBTOM=1 + ], + [ + AC_MSG_NOTICE(not bundled) + BUNDLED_LIBTOM=0 + AC_CHECK_LIB(tomcrypt, register_cipher, , BUNDLED_LIBTOM=1) + AC_CHECK_LIB(tommath, mp_exptmod, , BUNDLED_LIBTOM=1) + ] +) + +AC_SUBST(BUNDLED_LIBTOM) + dnl Added from OpenSSH 3.6.1p2's configure.ac dnl allow user to disable some login recording features @@ -671,5 +688,13 @@ AC_OUTPUT(Makefile) AC_OUTPUT(libtomcrypt/Makefile) AC_OUTPUT(libtommath/Makefile) + +AC_MSG_NOTICE() +if test $BUNDLED_LIBTOM = 1 ; then +AC_MSG_NOTICE(Using bundled libtomcrypt and libtommath) +else +AC_MSG_NOTICE(Using system libtomcrypt and libtommath) +fi + AC_MSG_NOTICE() AC_MSG_NOTICE(Now edit options.h to choose features.) diff -r 0442c18da5c9 -r d194db6f9453 includes.h --- a/includes.h Tue Jul 20 13:54:20 2010 +0000 +++ b/includes.h Wed Jul 21 12:38:46 2010 +0000 @@ -120,8 +120,14 @@ #include #endif +#ifdef BUNDLED_LIBTOM #include "libtomcrypt/src/headers/tomcrypt.h" #include "libtommath/tommath.h" +#else +#include +#include +#endif + #include "compat.h" #include "fake-rfc2553.h"