diff --git a/build.sh b/build.sh index 590fc44..b1e6de3 100755 --- a/build.sh +++ b/build.sh @@ -15,9 +15,9 @@ fi CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" make -j$MAKE_JOBS -f $3 all_test 1>gcc_1.txt 2>gcc_2.txt mret=$? cnt=$(wc -l < gcc_2.txt) -# ignore 2 lines since ar prints to stderr instead of stdout and ar is called for -# $(LIBNAME) and testprof/$(LIBTEST_S) -if [[ $mret -ne 0 ]] || [[ $cnt -gt 2 ]]; then +# ignore 1 line since ar prints to stderr instead of stdout and ar is called for +# $(LIBNAME) +if [[ $mret -ne 0 ]] || [[ $cnt -gt 1 ]]; then echo "build $1 failed! printing gcc_2.txt now for convenience" cat gcc_2.txt exit 1 diff --git a/helper.pl b/helper.pl index e468b2f..eb4664d 100755 --- a/helper.pl +++ b/helper.pl @@ -239,7 +239,7 @@ sub process_makefiles { my @all = (); find({ no_chdir => 1, wanted => sub { push @all, $_ if -f $_ && $_ =~ /\.(c|h)$/ } }, 'src'); my @t = qw(); - find({ no_chdir => 1, wanted => sub { push @t, $_ if $_ =~ /(common|no_prng|_tests?).c$/ } }, 'testprof'); + find({ no_chdir => 1, wanted => sub { push @t, $_ if $_ =~ /(common|no_prng|_tests?|test).c$/ } }, 'testprof'); my @o = sort ('src/ciphers/aes/aes_enc.o', map { my $x = $_; $x =~ s/\.c$/.o/; $x } @c); my $var_o = prepare_variable("OBJECTS", @o); diff --git a/makefile b/makefile index 5454e1f..5e8c5a7 100644 --- a/makefile +++ b/makefile @@ -27,9 +27,6 @@ INSTALL_CMD = install ifndef LIBNAME LIBNAME=libtomcrypt.a endif -ifndef LIBTEST - LIBTEST=libtomcrypt_prof.a -endif include makefile_include.mk @@ -61,27 +58,17 @@ ifneq ($V,1) endif ${silent} $(RANLIB) $@ -$(LIBTEST): $(TOBJECTS) -ifneq ($V,1) - @echo " * ${AR} $@" -endif - ${silent} $(AR) $(ARFLAGS) $@ $(TOBJECTS) -ifneq ($V,1) - @echo " * ${RANLIB} $@" -endif - ${silent} $(RANLIB) $@ - timing: $(LIBNAME) $(TIMINGS) testprof/common.o ifneq ($V,1) @echo " * ${CC} $@" endif ${silent} $(CC) $(LDFLAGS) $(TIMINGS) testprof/common.o $(LIB_PRE) $(LIBNAME) $(LIB_POST) $(EXTRALIBS) -o $(TIMING) -test: $(LIBNAME) $(LIBTEST) $(TESTS) +test: $(LIBNAME) $(TOBJECTS) ifneq ($V,1) @echo " * ${CC} $@" endif - ${silent} $(CC) $(LDFLAGS) $(TESTS) $(LIBTEST) $(LIB_PRE) $(LIBNAME) $(LIB_POST) $(EXTRALIBS) -o $(TEST) + ${silent} $(CC) $(LDFLAGS) $(TOBJECTS) $(LIB_PRE) $(LIBNAME) $(LIB_POST) $(EXTRALIBS) -o $(TEST) # build the demos from a template define DEMO_template @@ -102,8 +89,6 @@ install: .common_install install_bins: .common_install_bins -install_test: .common_install_test - profile: CFLAGS="$(CFLAGS) -fprofile-generate" $(MAKE) timing EXTRALIBS="$(EXTRALIBS) -lgcov" ./timing diff --git a/makefile.mingw b/makefile.mingw index 60e84b2..ee3d11e 100644 --- a/makefile.mingw +++ b/makefile.mingw @@ -33,7 +33,6 @@ VERSION=1.17 LIBMAIN_S =libtomcrypt.a LIBMAIN_I =libtomcrypt.dll.a LIBMAIN_D =libtomcrypt.dll -LIBTEST_S =libtomcrypt_prof.a #List of objects to compile (all goes to libtomcrypt.a) OBJECTS=src/ciphers/aes/aes.o src/ciphers/aes/aes_enc.o src/ciphers/anubis.o src/ciphers/blowfish.o \ @@ -193,7 +192,7 @@ testprof/dh_test.o testprof/dsa_test.o testprof/ecc_test.o testprof/file_test.o testprof/mac_test.o testprof/misc_test.o testprof/modes_test.o testprof/multi_test.o testprof/no_prng.o \ testprof/pkcs_1_eme_test.o testprof/pkcs_1_emsa_test.o testprof/pkcs_1_oaep_test.o \ testprof/pkcs_1_pss_test.o testprof/pkcs_1_test.o testprof/rotate_test.o testprof/rsa_test.o \ -testprof/store_test.o +testprof/store_test.o testprof/test.o #The following headers will be installed by "make install" HEADERS=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \ @@ -225,11 +224,6 @@ $(TOBJECTS): $(HEADERS) testprof/tomcrypt_test.h .c.o: $(CC) $(LTC_CFLAGS) -c $< -o $@ -#Create libtomcrypt_prof.a -$(LIBTEST_S): $(TOBJECTS) - $(AR) $(ARFLAGS) $@ $(TOBJECTS) - $(RANLIB) $@ - #Create libtomcrypt.a $(LIBMAIN_S): $(OBJECTS) $(AR) $(ARFLAGS) $@ $(OBJECTS) @@ -252,13 +246,13 @@ tv_gen: demos/tv_gen.o testprof/common.o $(LIBMAIN_S) #Tests + timing tests timing.exe: demos/timing.o testprof/common.o $(LIBMAIN_S) - $(CC) $? $(LTC_LDFLAGS) -o $@ + $(CC) demos/timing.o testprof/common.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ @echo NOTICE: start the tests by: timing.exe -test.exe: demos/test.o $(LIBTEST_S) $(LIBMAIN_S) - $(CC) $? $(LTC_LDFLAGS) -o $@ +test.exe: $(TOBJECTS) $(LIBMAIN_S) + $(CC) $(TOBJECTS) $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ @echo NOTICE: start the tests by: test.exe -all: $(LIBMAIN_S) $(LIBMAIN_I) $(LIBMAIN_D) $(LIBTEST_S) hashsum.exe ltcrypt.exe small.exe tv_gen.exe timing.exe test.exe +all: $(LIBMAIN_S) $(LIBMAIN_I) $(LIBMAIN_D) hashsum.exe ltcrypt.exe small.exe tv_gen.exe timing.exe test.exe test: test.exe @@ -267,7 +261,7 @@ clean: @cmd /c del /Q /S *.o *.a *.exe *.dll 2>nul #Install the library + headers -install: $(LIBMAIN_S) $(LIBMAIN_I) $(LIBMAIN_D) $(LIBTEST_S) +install: $(LIBMAIN_S) $(LIBMAIN_I) $(LIBMAIN_D) cmd /c if not exist "$(DESTDIR)\bin" mkdir "$(DESTDIR)\bin" cmd /c if not exist "$(DESTDIR)\lib" mkdir "$(DESTDIR)\lib" cmd /c if not exist "$(DESTDIR)\include" mkdir "$(DESTDIR)\include" diff --git a/makefile.msvc b/makefile.msvc index acd1a62..3bafbe7 100644 --- a/makefile.msvc +++ b/makefile.msvc @@ -26,7 +26,6 @@ VERSION=1.17 #Libraries to be created (this makefile builds only static libraries) LIBMAIN_S =tomcrypt.lib -LIBTEST_S =tomcrypt_prof.lib #List of objects to compile (all goes to tomcrypt.lib) OBJECTS=src/ciphers/aes/aes.obj src/ciphers/aes/aes_enc.obj src/ciphers/anubis.obj src/ciphers/blowfish.obj \ @@ -186,7 +185,7 @@ testprof/dh_test.obj testprof/dsa_test.obj testprof/ecc_test.obj testprof/file_t testprof/mac_test.obj testprof/misc_test.obj testprof/modes_test.obj testprof/multi_test.obj testprof/no_prng.obj \ testprof/pkcs_1_eme_test.obj testprof/pkcs_1_emsa_test.obj testprof/pkcs_1_oaep_test.obj \ testprof/pkcs_1_pss_test.obj testprof/pkcs_1_test.obj testprof/rotate_test.obj testprof/rsa_test.obj \ -testprof/store_test.obj +testprof/store_test.obj testprof/test.obj #The following headers will be installed by "make install" HEADERS=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \ @@ -218,10 +217,6 @@ $(TOBJECTS): $(HEADERS) testprof/tomcrypt_test.h .c.obj: $(CC) $(LTC_CFLAGS) /c $< /Fo$@ -#Create tomcrypt_prof.lib -$(LIBTEST_S): $(TOBJECTS) - lib /out:$(LIBTEST_S) $(TOBJECTS) - #Create tomcrypt.lib $(LIBMAIN_S): $(OBJECTS) lib /out:$(LIBMAIN_S) $(OBJECTS) @@ -237,12 +232,12 @@ tv_gen.exe: demos/tv_gen.c $(LIBMAIN_S) cl $(LTC_CFLAGS) demos/tv_gen.c $(LIBMAIN_S) $(LTC_LDFLAGS) #Tests + timing tests -timing.exe: demos/timing.c $(LIBMAIN_S) $(LIBTEST_S) - cl $(LTC_CFLAGS) demos/timing.c $(LIBTEST_S) $(LIBMAIN_S) $(LTC_LDFLAGS) -test.exe: demos/test.c $(LIBMAIN_S) $(LIBTEST_S) - cl $(LTC_CFLAGS) demos/test.c $(LIBTEST_S) $(LIBMAIN_S) $(LTC_LDFLAGS) +timing.exe: demos/timing.c $(LIBMAIN_S) + cl $(LTC_CFLAGS) demos/timing.c $(LIBMAIN_S) $(LTC_LDFLAGS) +test.exe: $(LIBMAIN_S) $(TOBJECTS) + cl $(LTC_CFLAGS) $(TOBJECTS) $(LIBMAIN_S) $(LTC_LDFLAGS) -all: $(LIBMAIN_S) $(LIBTEST_S) hashsum.exe ltcrypt.exe small.exe tv_gen.exe timing.exe test.exe +all: $(LIBMAIN_S) hashsum.exe ltcrypt.exe small.exe tv_gen.exe timing.exe test.exe test: test.exe @@ -251,7 +246,7 @@ clean: @cmd /c del /Q /S *.OBJ *.LIB *.EXE *.DLL 2>nul #Install the library + headers -install: $(LIBMAIN_S) $(LIBTEST_S) +install: $(LIBMAIN_S) cmd /c if not exist "$(DESTDIR)\bin" mkdir "$(DESTDIR)\bin" cmd /c if not exist "$(DESTDIR)\lib" mkdir "$(DESTDIR)\lib" cmd /c if not exist "$(DESTDIR)\include" mkdir "$(DESTDIR)\include" diff --git a/makefile.shared b/makefile.shared index 78d9254..55d2432 100644 --- a/makefile.shared +++ b/makefile.shared @@ -18,9 +18,6 @@ LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC) INSTALL_CMD = $(LT) --mode=install install #Output filenames for various targets. -ifndef LIBTEST - LIBTEST=libtomcrypt_prof.la -endif ifndef LIBNAME LIBNAME=libtomcrypt.la endif @@ -39,9 +36,6 @@ src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c $(LIBNAME): $(OBJECTS) $(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) `find ./src -type f -name "*.lo" | LC_ALL=C sort` $(EXTRALIBS) -o $@ -rpath $(LIBPATH) -version-info $(VERSION_LT) -$(LIBTEST): $(TOBJECTS) - $(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) `find ./testprof -type f -name "*.lo" | LC_ALL=C sort` -o $@ -rpath $(LIBPATH) -version-info $(VERSION_LT) - install: .common_install sed -e 's,^prefix=.*,prefix=$(DESTDIR),' -e 's,^Version:.*,Version: $(VERSION),' libtomcrypt.pc.in > libtomcrypt.pc install -d $(LIBPATH)/pkgconfig @@ -49,13 +43,11 @@ install: .common_install install_bins: .common_install_bins -install_test: .common_install_test - -test: $(LIBNAME) $(LIBTEST) $(TESTS) - $(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $(TEST) $(TESTS) $(LIBTEST) $(LIBNAME) $(EXTRALIBS) +test: $(LIBNAME) $(TOBJECTS) + $(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $(TEST) $(TOBJECTS) $(LIBNAME) $(EXTRALIBS) timing: $(TIMINGS) testprof/common.o $(LIBNAME) - $(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $(TIMING) $? $(EXTRALIBS) + $(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $(TIMING) $^ $(EXTRALIBS) # build the demos from a template define DEMO_template diff --git a/makefile.unix b/makefile.unix index 84733a9..51d93e5 100644 --- a/makefile.unix +++ b/makefile.unix @@ -38,7 +38,6 @@ VERSION=1.17 #Libraries to be created (this makefile builds only static libraries) LIBMAIN_S =libtomcrypt.a -LIBTEST_S =libtomcrypt_prof.a #List of objects to compile (all goes to libtomcrypt.a) OBJECTS=src/ciphers/aes/aes.o src/ciphers/aes/aes_enc.o src/ciphers/anubis.o src/ciphers/blowfish.o \ @@ -198,7 +197,7 @@ testprof/dh_test.o testprof/dsa_test.o testprof/ecc_test.o testprof/file_test.o testprof/mac_test.o testprof/misc_test.o testprof/modes_test.o testprof/multi_test.o testprof/no_prng.o \ testprof/pkcs_1_eme_test.o testprof/pkcs_1_emsa_test.o testprof/pkcs_1_oaep_test.o \ testprof/pkcs_1_pss_test.o testprof/pkcs_1_test.o testprof/rotate_test.o testprof/rsa_test.o \ -testprof/store_test.o +testprof/store_test.o testprof/test.o #The following headers will be installed by "make install" HEADERS=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \ @@ -232,11 +231,6 @@ $(TOBJECTS): $(HEADERS) testprof/tomcrypt_test.h .c.o: $(CC) $(LTC_CFLAGS) -c $< -o $@ -#Create libtomcrypt_prof.a -$(LIBTEST_S): $(TOBJECTS) - $(AR) $(ARFLAGS) $@ $(TOBJECTS) - $(RANLIB) $@ - #Create libtomcrypt.a $(LIBMAIN_S): $(OBJECTS) $(AR) $(ARFLAGS) $@ $(OBJECTS) @@ -244,28 +238,28 @@ $(LIBMAIN_S): $(OBJECTS) #Demo tools/utilities hashsum: demos/hashsum.o testprof/common.o $(LIBMAIN_S) - $(CC) $? $(LTC_LDFLAGS) -o $@ + $(CC) demos/hashsum.o testprof/common.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ ltcrypt: demos/ltcrypt.o testprof/common.o $(LIBMAIN_S) - $(CC) $? $(LTC_LDFLAGS) -o $@ + $(CC) demos/ltcrypt.o testprof/common.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ small: demos/small.o testprof/common.o $(LIBMAIN_S) - $(CC) $? $(LTC_LDFLAGS) -o $@ + $(CC) demos/small.o testprof/common.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ tv_gen: demos/tv_gen.o testprof/common.o $(LIBMAIN_S) - $(CC) $? $(LTC_LDFLAGS) -o $@ + $(CC) demos/tv_gen.o testprof/common.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ #Tests + timing tests -timing: demos/timing.o testprof/common.o $(LIBMAIN_S) - $(CC) $? $(LTC_LDFLAGS) -o $@ +timing: demos/timing.o $(LIBMAIN_S) testprof/common.o + $(CC) demos/timing.o $(LIBMAIN_S) testprof/common.o $(LTC_LDFLAGS) -o $@ @echo "NOTICE: start the timing tests by: ./timing" -test: demos/test.o $(LIBTEST_S) $(LIBMAIN_S) - $(CC) $? $(LTC_LDFLAGS) -o $@ +test: $(TOBJECTS) $(LIBMAIN_S) + $(CC) $(TOBJECTS) $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@ @echo "NOTICE: start the tests by: ./test" -all: $(LIBMAIN_S) $(LIBTEST_S) hashsum ltcrypt small tv_gen timing test +all: $(LIBMAIN_S) hashsum ltcrypt small tv_gen timing test #NOTE: this makefile works also on cygwin, thus we need to delete *.exe clean: -@rm -f $(OBJECTS) $(TOBJECTS) - -@rm -f $(LIBMAIN_S) $(LIBTEST_S) + -@rm -f $(LIBMAIN_S) -@rm -f demos/*.o *_tv.txt -@rm -f test tv_gen hashsum crypt small timing -@rm -f test.exe tv_gen.exe hashsum.exe crypt.exe small.exe timing.exe diff --git a/makefile_include.mk b/makefile_include.mk index 828e1cb..c0feaf5 100644 --- a/makefile_include.mk +++ b/makefile_include.mk @@ -113,7 +113,6 @@ UNBROKEN_DEMOS=$(USEFUL_DEMOS) ltcrypt small tv_gen sizes constants DEMOS=$(UNBROKEN_DEMOS) openssl-enc TIMINGS=demos/timing.o -TESTS=demos/test.o #LIBPATH The directory for libtomcrypt to be installed to. #INCPATH The directory to install the header files for libtomcrypt. @@ -296,7 +295,7 @@ testprof/dh_test.o testprof/dsa_test.o testprof/ecc_test.o testprof/file_test.o testprof/mac_test.o testprof/misc_test.o testprof/modes_test.o testprof/multi_test.o testprof/no_prng.o \ testprof/pkcs_1_eme_test.o testprof/pkcs_1_emsa_test.o testprof/pkcs_1_oaep_test.o \ testprof/pkcs_1_pss_test.o testprof/pkcs_1_test.o testprof/rotate_test.o testprof/rsa_test.o \ -testprof/store_test.o +testprof/store_test.o testprof/test.o # The following headers will be installed by "make install" HEADERS=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \ @@ -354,12 +353,6 @@ install_all: install install_bins install_docs install_test install -d $(BINPATH) $(INSTALL_CMD) -m 775 $(USEFUL_DEMOS) $(BINPATH) -.common_install_test: $(LIBTEST) - install -d $(LIBPATH) - install -d $(INCPATH) - install -m 644 testprof/tomcrypt_test.h $(INCPATH) - $(INSTALL_CMD) -m 644 $(LIBTEST) $(LIBPATH) - install_docs: doc/crypt.pdf install -d $(DATAPATH) install -m 644 doc/crypt.pdf $(DATAPATH) diff --git a/demos/test.c b/testprof/test.c similarity index 100% rename from demos/test.c rename to testprof/test.c