From 56431240ae8e3f75008575b1da1eb28115e5ee46 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Wed, 13 Nov 2013 01:46:42 +0100 Subject: [PATCH] add test case to makefiles --- crypto/evp/Makefile | 2 +- crypto/evp/p5_crpt2_test.c | 17 ++++++++++++++++- test/Makefile | 16 ++++++++++++---- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/crypto/evp/Makefile b/crypto/evp/Makefile index dd77a06c61..2302eb1fae 100644 --- a/crypto/evp/Makefile +++ b/crypto/evp/Makefile @@ -13,7 +13,7 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) GENERAL=Makefile -TEST=evp_test.c +TEST=evp_test.c p5_crpt2_test.c TESTDATA=evptests.txt APPS= diff --git a/crypto/evp/p5_crpt2_test.c b/crypto/evp/p5_crpt2_test.c index cf02851246..ad57e17655 100644 --- a/crypto/evp/p5_crpt2_test.c +++ b/crypto/evp/p5_crpt2_test.c @@ -61,6 +61,14 @@ #include #include +#ifdef OPENSSL_NO_SHA +int main(int argc, char *argv[]) +{ + printf("No SHA support\n"); + return(0); +} +#else + typedef struct { const char *pass; int passlen; @@ -113,7 +121,7 @@ hexdump(FILE *f, const char *title, const unsigned char *s, int l) { int i; fprintf(f, "%s", title); for(i=0; i < l ; i++) { - fprintf(f, " 0x%02x", s[i]); + fprintf(f, "%02x", s[i]); } fprintf(f, "\n"); } @@ -192,9 +200,15 @@ int main(int argc,char **argv) { printf("PKCS5_PBKDF2_HMAC() tests "); for (i=0; test->pass != NULL; i++, test++) { +#ifndef OPENSSL_NO_SHA0 test_p5_pbkdf2(i, "sha1", test, sha1_results[i]); +#endif +#ifndef OPENSSL_NO_SHA256 test_p5_pbkdf2(i, "sha256", test, sha256_results[i]); +#endif +#ifndef OPENSSL_NO_SHA512 test_p5_pbkdf2(i, "sha512", test, sha512_results[i]); +#endif printf("."); } printf(" done\n"); @@ -209,3 +223,4 @@ int main(int argc,char **argv) { CRYPTO_mem_leaks_fp(stderr); return 0; } +#endif /* OPENSSL_NO_SHA */ diff --git a/test/Makefile b/test/Makefile index 66ce1a1bbd..10389133cb 100644 --- a/test/Makefile +++ b/test/Makefile @@ -62,6 +62,7 @@ SSLTEST= ssltest RSATEST= rsa_test ENGINETEST= enginetest EVPTEST= evp_test +P5_CRPT2_TEST= p5_crpt2_test IGETEST= igetest JPAKETEST= jpaketest SRPTEST= srptest @@ -99,7 +100,7 @@ EXE= $(BNTEST)$(EXE_EXT) $(ECTEST)$(EXE_EXT) $(ECDSATEST)$(EXE_EXT) $(ECDHTEST) $(BFTEST)$(EXE_EXT) $(CASTTEST)$(EXE_EXT) $(SSLTEST)$(EXE_EXT) \ $(EXPTEST)$(EXE_EXT) $(DSATEST)$(EXE_EXT) $(RSATEST)$(EXE_EXT) \ $(EVPTEST)$(EXE_EXT) $(IGETEST)$(EXE_EXT) $(JPAKETEST)$(EXE_EXT) $(SRPTEST)$(EXE_EXT) \ - $(V3NAMETEST)$(EXE_EXT) $(HEARTBEATTEST)$(EXE_EXT) + $(V3NAMETEST)$(EXE_EXT) $(HEARTBEATTEST)$(EXE_EXT) $(P5_CRPT2_TEST)$(EXE_EXT) FIPSEXE=$(FIPS_SHATEST)$(EXE_EXT) $(FIPS_DESTEST)$(EXE_EXT) \ $(FIPS_RANDTEST)$(EXE_EXT) $(FIPS_AESTEST)$(EXE_EXT) \ @@ -128,7 +129,8 @@ OBJ= $(BNTEST).o $(ECTEST).o $(ECDSATEST).o $(ECDHTEST).o $(IDEATEST).o \ $(FIPS_TEST_SUITE).o $(FIPS_DHVS).o $(FIPS_ECDSAVS).o \ $(FIPS_ECDHVS).o $(FIPS_CMACTEST).o $(FIPS_ALGVS).o \ $(EVPTEST).o $(IGETEST).o $(JPAKETEST).o $(V3NAMETEST).o \ - $(GOST2814789TEST).o $(HEARTBEATTEST).o + $(GOST2814789TEST).o $(HEARTBEATTEST).o $(P5_CRPT2_TEST).o + SRC= $(BNTEST).c $(ECTEST).c $(ECDSATEST).c $(ECDHTEST).c $(IDEATEST).c \ $(MD2TEST).c $(MD4TEST).c $(MD5TEST).c \ $(HMACTEST).c $(WPTEST).c \ @@ -143,7 +145,7 @@ SRC= $(BNTEST).c $(ECTEST).c $(ECDSATEST).c $(ECDHTEST).c $(IDEATEST).c \ $(FIPS_TEST_SUITE).c $(FIPS_DHVS).c $(FIPS_ECDSAVS).c \ $(FIPS_ECDHVS).c $(FIPS_CMACTEST).c $(FIPS_ALGVS).c \ $(EVPTEST).c $(IGETEST).c $(JPAKETEST).c $(V3NAMETEST).c \ - $(GOST2814789TEST).c $(HEARTBEATTEST).c + $(GOST2814789TEST).c $(HEARTBEATTEST).c $(P5_CRPT2_TEST).c EXHEADER= HEADER= $(EXHEADER) @@ -191,11 +193,14 @@ alltests: \ test_gen test_req test_pkcs7 test_verify test_dh test_dsa \ test_ss test_ca test_engine test_evp test_ssl test_tsa test_ige \ test_jpake test_srp test_cms test_v3name test_ocsp \ - test_gost2814789 test_heartbeat + test_gost2814789 test_heartbeat test_p5_crpt2 test_evp: $(EVPTEST)$(EXE_EXT) evptests.txt ../util/shlib_wrap.sh ./$(EVPTEST) evptests.txt +test_p5_crpt2: $(P5_CRPT2_TEST)$(EXE_EXT) + ../util/shlib_wrap.sh ./$(P5_CRPT2_TEST) + test_des: $(DESTEST)$(EXE_EXT) ../util/shlib_wrap.sh ./$(DESTEST) @@ -591,6 +596,9 @@ $(ENGINETEST)$(EXE_EXT): $(ENGINETEST).o $(DLIBCRYPTO) $(EVPTEST)$(EXE_EXT): $(EVPTEST).o $(DLIBCRYPTO) @target=$(EVPTEST); $(BUILD_CMD) +$(P5_CRPT2_TEST)$(EXE_EXT): $(P5_CRPT2_TEST).o $(DLIBCRYPTO) + @target=$(P5_CRPT2_TEST); $(BUILD_CMD) + $(ECDSATEST)$(EXE_EXT): $(ECDSATEST).o $(DLIBCRYPTO) @target=$(ECDSATEST); $(BUILD_CMD) -- 2.40.0