From d4945ac52124d48f683e93faa0715ad769c5b50c Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Tue, 8 Sep 2015 21:09:49 +0200 Subject: [PATCH] add (nearly) all defines from tomcrypt_custom.h to crypt_build_settings ... and provide a new make target to check if something is missing --- makefile | 6 ++++++ src/misc/crypt/crypt.c | 27 +++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/makefile b/makefile index 097f72d..0488263 100644 --- a/makefile +++ b/makefile @@ -387,6 +387,12 @@ zipup: no_oops docs mv -fv crypt* ~ ; rm -rf libtomcrypt-$(VERSION) +check_defines: + cat src/headers/tomcrypt_custom.h | grep '\#define[ \t]*LTC_' | sed -e 's@/\*@@g' -e 's@\*/@@g' -e 's@^[ \t]*@@g' \ + | cut -d' ' -f 2 | sed -e 's@(x)@@g' | sort | uniq \ + | grep -v -e 'LTC_ECC[0-9]*' -e 'LTC_DH[0-9]*' -e 'LTC_NO_' -e 'LTC_MUTEX' -e 'LTC_MPI' \ + | xargs -I '{}' sh -c 'grep -q -m 1 -o {} src/misc/crypt/crypt.c || echo {} not found' + # $Source$ # $Revision$ # $Date$ diff --git a/src/misc/crypt/crypt.c b/src/misc/crypt/crypt.c index 722fbf2..dca18d0 100644 --- a/src/misc/crypt/crypt.c +++ b/src/misc/crypt/crypt.c @@ -14,6 +14,8 @@ @file crypt.c Build strings, Tom St Denis */ +#define NAME_VALUE(s) #s"="NAME(s) +#define NAME(s) #s const char *crypt_build_settings = "LibTomCrypt " SCRYPT " (Tom St Denis, tomstdenis@gmail.com)\n" @@ -251,7 +253,7 @@ const char *crypt_build_settings = "\nPRNG:\n" #if defined(LTC_YARROW) - " Yarrow\n" + " Yarrow ("NAME_VALUE(LTC_YARROW_AES)")\n" #endif #if defined(LTC_SPRNG) " SPRNG\n" @@ -260,7 +262,7 @@ const char *crypt_build_settings = " RC4\n" #endif #if defined(LTC_FORTUNA) - " Fortuna\n" + " Fortuna (" NAME_VALUE(LTC_FORTUNA_POOLS) ", " NAME_VALUE(LTC_FORTUNA_WD) ")\n" #endif #if defined(LTC_SOBER128) " SOBER128\n" @@ -341,6 +343,9 @@ const char *crypt_build_settings = #if defined(LTC_DER) " DER " #endif +#if defined(LTC_DER_MAX_PUBKEY_SIZE) + " " NAME_VALUE(LTC_DER_MAX_PUBKEY_SIZE) " " +#endif #if defined(LTC_PKCS_1) " PKCS#1 " #endif @@ -353,12 +358,30 @@ const char *crypt_build_settings = #if defined(MPI) " MPI " #endif +#if defined(LTC_DEVRANDOM) + " LTC_DEVRANDOM " +#endif #if defined(LTC_TRY_URANDOM_FIRST) " LTC_TRY_URANDOM_FIRST " #endif +#if defined(LTC_RNG_GET_BYTES) + " LTC_RNG_GET_BYTES " +#endif +#if defined(LTC_RNG_MAKE_PRNG) + " LTC_RNG_MAKE_PRNG " +#endif +#if defined(LTC_HASH_HELPERS) + " LTC_HASH_HELPERS " +#endif +#if defined(LTC_VALGRIND) + " LTC_VALGRIND " +#endif #if defined(LTC_TEST) " LTC_TEST " #endif +#if defined(LTC_TEST_EXT) + " LTC_TEST_EXT " +#endif #if defined(LTC_SMALL_CODE) " LTC_SMALL_CODE " #endif