diff options
-rw-r--r-- | Makefile | 82 | ||||
-rw-r--r-- | common.h | 1 | ||||
-rw-r--r-- | libhashsum.h | 29 | ||||
-rw-r--r-- | libhashsum_get_algorithm_string.c | 101 | ||||
-rw-r--r-- | libhashsum_init_hasher_from_string.c | 134 | ||||
-rw-r--r-- | mk/after-config.mk | 53 | ||||
-rw-r--r-- | mk/before-config.mk | 21 |
7 files changed, 250 insertions, 171 deletions
@@ -1,28 +1,6 @@ .POSIX: - -# This are overwritten in $(CONFIGFILE), however they -# are added so that they are always defined even if -# the use has an out of date version of config.mk -DEFAULT_SUPPORT = yes -SUPPORT_SHA1 = $(DEFAULT_SUPPORT) -SUPPORT_SHA2 = $(DEFAULT_SUPPORT) -SUPPORT_MD2 = $(DEFAULT_SUPPORT) -SUPPORT_MD4 = $(DEFAULT_SUPPORT) -SUPPORT_MD5 = $(DEFAULT_SUPPORT) -SUPPORT_RIPEMD_128 = $(DEFAULT_SUPPORT) -SUPPORT_RIPEMD_160 = $(DEFAULT_SUPPORT) -SUPPORT_RIPEMD_256 = $(DEFAULT_SUPPORT) -SUPPORT_RIPEMD_320 = $(DEFAULT_SUPPORT) -SUPPORT_KECCAK = $(DEFAULT_SUPPORT) -SUPPORT_SHA3 = $(DEFAULT_SUPPORT) -SUPPORT_SHAKE = $(DEFAULT_SUPPORT) -SUPPORT_RAWSHAKE = $(DEFAULT_SUPPORT) -SUPPORT_BLAKE224 = $(DEFAULT_SUPPORT) -SUPPORT_BLAKE256 = $(DEFAULT_SUPPORT) -SUPPORT_BLAKE384 = $(DEFAULT_SUPPORT) -SUPPORT_BLAKE512 = $(DEFAULT_SUPPORT) - +include mk/before-config.mk CONFIGFILE = config.mk include $(CONFIGFILE) @@ -33,6 +11,8 @@ OS = linux # Windows: windows include mk/$(OS).mk +include mk/after-config.mk + LIB_MAJOR = 1 LIB_MINOR = 0 @@ -40,63 +20,9 @@ LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR) LIB_NAME = hashsum -CPPFLAGS_LIBKECCAK_IF_SUPPORTED = -LDFLAGS_LIBKECCAK_IF_SUPPORTED = - -CPPFLAGS_LIBBLAKE_IF_SUPPORTED = -LDFLAGS_LIBBLAKE_IF_SUPPORTED = - -include mk/md2=$(SUPPORT_MD2).mk -include mk/md4=$(SUPPORT_MD4).mk -include mk/md5=$(SUPPORT_MD5).mk -include mk/ripemd-128=$(SUPPORT_RIPEMD_128).mk -include mk/ripemd-160=$(SUPPORT_RIPEMD_160).mk -include mk/ripemd-256=$(SUPPORT_RIPEMD_256).mk -include mk/ripemd-320=$(SUPPORT_RIPEMD_320).mk -include mk/sha1=$(SUPPORT_SHA1).mk -include mk/sha2=$(SUPPORT_SHA2).mk -include mk/keccak=$(SUPPORT_KECCAK).mk -include mk/sha3=$(SUPPORT_SHA3).mk -include mk/shake=$(SUPPORT_SHAKE).mk -include mk/rawshake=$(SUPPORT_RAWSHAKE).mk -include mk/blake224=$(SUPPORT_SHA3).mk -include mk/blake256=$(SUPPORT_SHA3).mk -include mk/blake384=$(SUPPORT_SHA3).mk -include mk/blake512=$(SUPPORT_SHA3).mk - - -CPPFLAGS_FULL =\ - $(CPPFLAGS)\ - $(CPPFLAGS_MD2)\ - $(CPPFLAGS_MD4)\ - $(CPPFLAGS_MD5)\ - $(CPPFLAGS_RIPEMD_128)\ - $(CPPFLAGS_RIPEMD_160)\ - $(CPPFLAGS_RIPEMD_256)\ - $(CPPFLAGS_RIPEMD_320)\ - $(CPPFLAGS_SHA1)\ - $(CPPFLAGS_SHA2)\ - $(CPPFLAGS_LIBKECCAK_IF_SUPPORTED)\ - $(CPPFLAGS_KECCAK)\ - $(CPPFLAGS_SHA3)\ - $(CPPFLAGS_SHAKE)\ - $(CPPFLAGS_RAWSHAKE)\ - $(CPPFLAGS_LIBBLAKE_IF_SUPPORTED)\ - $(CPPFLAGS_BLAKE224)\ - $(CPPFLAGS_BLAKE256)\ - $(CPPFLAGS_BLAKE384)\ - $(CPPFLAGS_BLAKE512) - -LDFLAGS_FULL =\ - $(LDFLAGS)\ - $(LDFLAGS_SHA1)\ - $(LDFLAGS_SHA2)\ - $(LDFLAGS_LIBKECCAK_IF_SUPPORTED)\ - $(LDFLAGS_LIBBLAKE_IF_SUPPORTED) - - OBJ =\ libhashsum_init_hasher.o\ + libhashsum_get_algorithm_string.o\ libhashsum_init_hasher_from_string.o\ libhashsum_init_md2_hasher.o\ libhashsum_init_md4_hasher.o\ @@ -35,6 +35,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <strings.h> #if defined(__GNUC__) diff --git a/libhashsum.h b/libhashsum.h index 7f828c0..29a8f6f 100644 --- a/libhashsum.h +++ b/libhashsum.h @@ -61,7 +61,7 @@ enum libhashsum_algorithm { LIBHASHSUM_SHA3_256, /**< SHA3-256 */ LIBHASHSUM_SHA3_384, /**< SHA3-384 */ LIBHASHSUM_SHA3_512, /**< SHA3-512 */ - LIBHASHSUM_SHAKE128 , /**< SHAKE128 */ + LIBHASHSUM_SHAKE128, /**< SHAKE128 */ LIBHASHSUM_SHAKE256, /**< SHAKE256 */ LIBHASHSUM_SHAKE512, /**< SHAKE512 */ LIBHASHSUM_RAWSHAKE128, /**< RawSHAKE128 */ @@ -306,6 +306,12 @@ enum libhashsum_algorithm { #define LIBHASHSUM_BLAKE512_HASH_SIZE 64 +#if defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpadded" +#endif + + /** * Hash state * @@ -602,6 +608,11 @@ struct libhashsum_hasher { }; +#if defined(__GNUC__) +# pragma GCC diagnostic pop +#endif + + /** * Create an initialised state for a hash algorithm * and return hash functions and details @@ -629,6 +640,20 @@ LIBHASHSUM_1_NONNULL_ int libhashsum_init_hasher(struct libhashsum_hasher *this, enum libhashsum_algorithm algorithm); /** + * Inspect a hashing algorithm string to identify + * which algorithm it references + * + * @param algorithm_out Output parameter for the hashing algorithm + * identifier (set if 1 is returned) + * @param algorithm The hashing algorithm as a string + * @return 1 if the algorithm was recognised, 0 otherwise + * + * @since 1.0 + */ +LIBHASHSUM_NONNULL_ +int libhashsum_get_algorithm_string(enum libhashsum_algorithm *algorithm_out, const char *algorithm); + +/** * Create an initialised state for a hash algorithm * and return hash functions and details * @@ -1280,7 +1305,7 @@ int libhashsum_init_blakeb_hasher(struct libhashsum_hasher *this, size_t hashbit * @param this The output parameter for the functions, details, and state * @param hashbits Hash output size in bits * @param salt `NULL` (for all zeroes) or a salt - * @parma saltbytes The number of bytes in `salt` (ignored if `salt` is `NULL`), + * @param saltbytes The number of bytes in `salt` (ignored if `salt` is `NULL`), * shall be 16 for if `hashbits` is 224 or 256, and 32 if * `hashbits` is 384 or 512 * @return 0 on success, -1 on failure diff --git a/libhashsum_get_algorithm_string.c b/libhashsum_get_algorithm_string.c new file mode 100644 index 0000000..5f910be --- /dev/null +++ b/libhashsum_get_algorithm_string.c @@ -0,0 +1,101 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + + +#if defined(__GNUC__) +__attribute__((__pure__)) +#endif +static int +equiv(const char *a, const char *b) +{ + while (*a && *b && *b != '[') { + if (tolower(*a) == tolower(*b) || (*b == '/' && (*a == '-' || *a == '_'))) { + a++; + b++; + } else if (*b == '-' && !isdigit(b[-1])) { + b++; + } else { + return 0; + } + } + if (!strncasecmp(a, "sum", 3)) + a = &a[3]; + return !*a && (!*b || *b == '['); +} + + +int +libhashsum_get_algorithm_string(enum libhashsum_algorithm *algorithm_out, const char *algorithm) +{ + if (equiv(algorithm, "MD2")) + *algorithm_out = LIBHASHSUM_MD2; + else if (equiv(algorithm, "MD4")) + *algorithm_out = LIBHASHSUM_MD4; + else if (equiv(algorithm, "MD5")) + *algorithm_out = LIBHASHSUM_MD5; + else if (equiv(algorithm, "RIPEMD-128") || equiv(algorithm, "RMD-128")) + *algorithm_out = LIBHASHSUM_RIPEMD_128; + else if (equiv(algorithm, "RIPEMD-160") || equiv(algorithm, "RMD-160")) + *algorithm_out = LIBHASHSUM_RIPEMD_160; + else if (equiv(algorithm, "RIPEMD-256") || equiv(algorithm, "RMD-256")) + *algorithm_out = LIBHASHSUM_RIPEMD_256; + else if (equiv(algorithm, "RIPEMD-320") || equiv(algorithm, "RMD-320")) + *algorithm_out = LIBHASHSUM_RIPEMD_320; + else if (equiv(algorithm, "SHA-0")) + *algorithm_out = LIBHASHSUM_SHA0; + else if (equiv(algorithm, "SHA-1")) + *algorithm_out = LIBHASHSUM_SHA1; + else if (equiv(algorithm, "SHA-224") || equiv(algorithm, "SHA-2-224")) + *algorithm_out = LIBHASHSUM_SHA_224; + else if (equiv(algorithm, "SHA-256") || equiv(algorithm, "SHA-2-256")) + *algorithm_out = LIBHASHSUM_SHA_256; + else if (equiv(algorithm, "SHA-384") || equiv(algorithm, "SHA-2-384")) + *algorithm_out = LIBHASHSUM_SHA_384; + else if (equiv(algorithm, "SHA-512") || equiv(algorithm, "SHA-2-512")) + *algorithm_out = LIBHASHSUM_SHA_512; + else if (equiv(algorithm, "SHA-512/224") || equiv(algorithm, "SHA-2-512/224")) + *algorithm_out = LIBHASHSUM_SHA_512_224; + else if (equiv(algorithm, "SHA-512/256") || equiv(algorithm, "SHA-2-512/256")) + *algorithm_out = LIBHASHSUM_SHA_512_256; + else if (equiv(algorithm, "Keccak-224")) + *algorithm_out = LIBHASHSUM_KECCAK_224; + else if (equiv(algorithm, "Keccak-256")) + *algorithm_out = LIBHASHSUM_KECCAK_256; + else if (equiv(algorithm, "Keccak-384")) + *algorithm_out = LIBHASHSUM_KECCAK_384; + else if (equiv(algorithm, "Keccak-512")) + *algorithm_out = LIBHASHSUM_KECCAK_512; + else if (equiv(algorithm, "SHA-3-224")) + *algorithm_out = LIBHASHSUM_SHA3_224; + else if (equiv(algorithm, "SHA-3-256")) + *algorithm_out = LIBHASHSUM_SHA3_256; + else if (equiv(algorithm, "SHA-3-384")) + *algorithm_out = LIBHASHSUM_SHA3_384; + else if (equiv(algorithm, "SHA-3-512")) + *algorithm_out = LIBHASHSUM_SHA3_512; + else if (equiv(algorithm, "SHAKE-128[]")) + *algorithm_out = LIBHASHSUM_SHAKE128; + else if (equiv(algorithm, "SHAKE-256[]")) + *algorithm_out = LIBHASHSUM_SHAKE256; + else if (equiv(algorithm, "SHAKE-512[]")) + *algorithm_out = LIBHASHSUM_SHAKE512; + else if (equiv(algorithm, "RawSHAKE-128[]")) + *algorithm_out = LIBHASHSUM_RAWSHAKE128; + else if (equiv(algorithm, "RawSHAKE-256[]")) + *algorithm_out = LIBHASHSUM_RAWSHAKE256; + else if (equiv(algorithm, "RawSHAKE-512[]")) + *algorithm_out = LIBHASHSUM_RAWSHAKE512; + else if (equiv(algorithm, "Keccak[]")) + *algorithm_out = LIBHASHSUM_KECCAK; + else if (equiv(algorithm, "BLAKE-224[]") || equiv(algorithm, "B224[]")) + *algorithm_out = LIBHASHSUM_BLAKE224; + else if (equiv(algorithm, "BLAKE-256[]") || equiv(algorithm, "B256[]")) + *algorithm_out = LIBHASHSUM_BLAKE256; + else if (equiv(algorithm, "BLAKE-384[]") || equiv(algorithm, "B384[]")) + *algorithm_out = LIBHASHSUM_BLAKE384; + else if (equiv(algorithm, "BLAKE-512[]") || equiv(algorithm, "B512[]")) + *algorithm_out = LIBHASHSUM_BLAKE512; + else + return 0; + return 1; +} diff --git a/libhashsum_init_hasher_from_string.c b/libhashsum_init_hasher_from_string.c index 1bdc70d..55fe882 100644 --- a/libhashsum_init_hasher_from_string.c +++ b/libhashsum_init_hasher_from_string.c @@ -2,26 +2,6 @@ #include "common.h" -#if defined(__GNUC__) -__attribute__((__pure__)) -#endif -static int -equiv(const char *a, const char *b) -{ - while (*a && *b && *b != '[') { - if (tolower(*a) == tolower(*b)) { - a++; - b++; - } else if (*b == '-') { - b++; - } else { - return 0; - } - } - return !*a && (!*b || *b == '['); -} - - static int with_n(int (*initfunc)(struct libhashsum_hasher *, size_t), struct libhashsum_hasher *this, const char *algorithm) { @@ -175,75 +155,47 @@ einval: int libhashsum_init_hasher_from_string(struct libhashsum_hasher *this, const char *algorithm) { - if (!strcasecmp(algorithm, "MD2")) - return libhashsum_init_md2_hasher(this); - if (!strcasecmp(algorithm, "MD4")) - return libhashsum_init_md4_hasher(this); - if (!strcasecmp(algorithm, "MD5")) - return libhashsum_init_md5_hasher(this); - if (equiv(algorithm, "RIPEMD-128")) - return libhashsum_init_ripemd_128_hasher(this); - if (equiv(algorithm, "RIPEMD-160")) - return libhashsum_init_ripemd_160_hasher(this); - if (equiv(algorithm, "RIPEMD-256")) - return libhashsum_init_ripemd_256_hasher(this); - if (equiv(algorithm, "RIPEMD-320")) - return libhashsum_init_ripemd_320_hasher(this); - if (equiv(algorithm, "SHA-0")) - return libhashsum_init_sha0_hasher(this); - if (equiv(algorithm, "SHA-1")) - return libhashsum_init_sha1_hasher(this); - if (equiv(algorithm, "SHA-224") || !strcasecmp(algorithm, "SHA2-224")) - return libhashsum_init_sha_224_hasher(this); - if (equiv(algorithm, "SHA-256") || !strcasecmp(algorithm, "SHA2-256")) - return libhashsum_init_sha_256_hasher(this); - if (equiv(algorithm, "SHA-384") || !strcasecmp(algorithm, "SHA2-384")) - return libhashsum_init_sha_384_hasher(this); - if (equiv(algorithm, "SHA-512") || !strcasecmp(algorithm, "SHA2-512")) - return libhashsum_init_sha_512_hasher(this); - if (equiv(algorithm, "SHA-512/224") || !strcasecmp(algorithm, "SHA2-512/224")) - return libhashsum_init_sha_512_224_hasher(this); - if (equiv(algorithm, "SHA-512/256") || !strcasecmp(algorithm, "SHA2-512/256")) - return libhashsum_init_sha_512_256_hasher(this); - if (equiv(algorithm, "Keccak-224")) - return libhashsum_init_keccak_224_hasher(this); - if (equiv(algorithm, "Keccak-256")) - return libhashsum_init_keccak_256_hasher(this); - if (equiv(algorithm, "Keccak-384")) - return libhashsum_init_keccak_384_hasher(this); - if (equiv(algorithm, "Keccak-512")) - return libhashsum_init_keccak_512_hasher(this); - if (!strcasecmp(algorithm, "SHA3-224")) - return libhashsum_init_sha3_224_hasher(this); - if (!strcasecmp(algorithm, "SHA3-256")) - return libhashsum_init_sha3_256_hasher(this); - if (!strcasecmp(algorithm, "SHA3-384")) - return libhashsum_init_sha3_384_hasher(this); - if (!strcasecmp(algorithm, "SHA3-512")) - return libhashsum_init_sha3_512_hasher(this); - if (equiv(algorithm, "SHAKE-128[")) - return with_n(&libhashsum_init_shake128_hasher, this, algorithm); - if (equiv(algorithm, "SHAKE-256[")) - return with_n(&libhashsum_init_shake256_hasher, this, algorithm); - if (equiv(algorithm, "SHAKE-512[")) - return with_n(&libhashsum_init_shake512_hasher, this, algorithm); - if (equiv(algorithm, "RawSHAKE-128[")) - return with_n(&libhashsum_init_rawshake128_hasher, this, algorithm); - if (equiv(algorithm, "RawSHAKE-256[")) - return with_n(&libhashsum_init_rawshake256_hasher, this, algorithm); - if (equiv(algorithm, "RawSHAKE-512[")) - return with_n(&libhashsum_init_rawshake512_hasher, this, algorithm); - if (equiv(algorithm, "Keccak[")) - return with_rcn(&libhashsum_init_keccak_hasher, this, algorithm); - if (equiv(algorithm, "BLAKE-224[")) - return with_salt(&libhashsum_init_blake224_hasher, this, algorithm, 16U); - if (equiv(algorithm, "BLAKE-256[")) - return with_salt(&libhashsum_init_blake256_hasher, this, algorithm, 16U); - if (equiv(algorithm, "BLAKE-384[")) - return with_salt(&libhashsum_init_blake384_hasher, this, algorithm, 32U); - if (equiv(algorithm, "BLAKE-512[")) - return with_salt(&libhashsum_init_blake512_hasher, this, algorithm, 32U); - - errno = EINVAL; - return -1; + enum libhashsum_algorithm algo; + if (!libhashsum_get_algorithm_string(&algo, algorithm)) { + errno = EINVAL; + return -1; + } + switch (algo) { + case LIBHASHSUM_MD2: return libhashsum_init_md2_hasher(this); + case LIBHASHSUM_MD4: return libhashsum_init_md4_hasher(this); + case LIBHASHSUM_MD5: return libhashsum_init_md5_hasher(this); + case LIBHASHSUM_RIPEMD_128: return libhashsum_init_ripemd_128_hasher(this); + case LIBHASHSUM_RIPEMD_160: return libhashsum_init_ripemd_160_hasher(this); + case LIBHASHSUM_RIPEMD_256: return libhashsum_init_ripemd_256_hasher(this); + case LIBHASHSUM_RIPEMD_320: return libhashsum_init_ripemd_320_hasher(this); + case LIBHASHSUM_SHA0: return libhashsum_init_sha0_hasher(this); + case LIBHASHSUM_SHA1: return libhashsum_init_sha1_hasher(this); + case LIBHASHSUM_SHA_224: return libhashsum_init_sha_224_hasher(this); + case LIBHASHSUM_SHA_256: return libhashsum_init_sha_256_hasher(this); + case LIBHASHSUM_SHA_384: return libhashsum_init_sha_384_hasher(this); + case LIBHASHSUM_SHA_512: return libhashsum_init_sha_512_hasher(this); + case LIBHASHSUM_SHA_512_224: return libhashsum_init_sha_512_224_hasher(this); + case LIBHASHSUM_SHA_512_256: return libhashsum_init_sha_512_256_hasher(this); + case LIBHASHSUM_KECCAK_224: return libhashsum_init_keccak_224_hasher(this); + case LIBHASHSUM_KECCAK_256: return libhashsum_init_keccak_256_hasher(this); + case LIBHASHSUM_KECCAK_384: return libhashsum_init_keccak_384_hasher(this); + case LIBHASHSUM_KECCAK_512: return libhashsum_init_keccak_512_hasher(this); + case LIBHASHSUM_SHA3_224: return libhashsum_init_sha3_224_hasher(this); + case LIBHASHSUM_SHA3_256: return libhashsum_init_sha3_256_hasher(this); + case LIBHASHSUM_SHA3_384: return libhashsum_init_sha3_384_hasher(this); + case LIBHASHSUM_SHA3_512: return libhashsum_init_sha3_512_hasher(this); + case LIBHASHSUM_SHAKE128: return with_n(&libhashsum_init_shake128_hasher, this, algorithm); + case LIBHASHSUM_SHAKE256: return with_n(&libhashsum_init_shake256_hasher, this, algorithm); + case LIBHASHSUM_SHAKE512: return with_n(&libhashsum_init_shake512_hasher, this, algorithm); + case LIBHASHSUM_RAWSHAKE128: return with_n(&libhashsum_init_rawshake128_hasher, this, algorithm); + case LIBHASHSUM_RAWSHAKE256: return with_n(&libhashsum_init_rawshake256_hasher, this, algorithm); + case LIBHASHSUM_RAWSHAKE512: return with_n(&libhashsum_init_rawshake512_hasher, this, algorithm); + case LIBHASHSUM_KECCAK: return with_rcn(&libhashsum_init_keccak_hasher, this, algorithm); + case LIBHASHSUM_BLAKE224: return with_salt(&libhashsum_init_blake224_hasher, this, algorithm, 16U); + case LIBHASHSUM_BLAKE256: return with_salt(&libhashsum_init_blake256_hasher, this, algorithm, 16U); + case LIBHASHSUM_BLAKE384: return with_salt(&libhashsum_init_blake384_hasher, this, algorithm, 32U); + case LIBHASHSUM_BLAKE512: return with_salt(&libhashsum_init_blake512_hasher, this, algorithm, 32U); + default: + abort(); + } } diff --git a/mk/after-config.mk b/mk/after-config.mk new file mode 100644 index 0000000..71a470c --- /dev/null +++ b/mk/after-config.mk @@ -0,0 +1,53 @@ +CPPFLAGS_LIBKECCAK_IF_SUPPORTED = +LDFLAGS_LIBKECCAK_IF_SUPPORTED = + +CPPFLAGS_LIBBLAKE_IF_SUPPORTED = +LDFLAGS_LIBBLAKE_IF_SUPPORTED = + +include mk/md2=$(SUPPORT_MD2).mk +include mk/md4=$(SUPPORT_MD4).mk +include mk/md5=$(SUPPORT_MD5).mk +include mk/ripemd-128=$(SUPPORT_RIPEMD_128).mk +include mk/ripemd-160=$(SUPPORT_RIPEMD_160).mk +include mk/ripemd-256=$(SUPPORT_RIPEMD_256).mk +include mk/ripemd-320=$(SUPPORT_RIPEMD_320).mk +include mk/sha1=$(SUPPORT_SHA1).mk +include mk/sha2=$(SUPPORT_SHA2).mk +include mk/keccak=$(SUPPORT_KECCAK).mk +include mk/sha3=$(SUPPORT_SHA3).mk +include mk/shake=$(SUPPORT_SHAKE).mk +include mk/rawshake=$(SUPPORT_RAWSHAKE).mk +include mk/blake224=$(SUPPORT_SHA3).mk +include mk/blake256=$(SUPPORT_SHA3).mk +include mk/blake384=$(SUPPORT_SHA3).mk +include mk/blake512=$(SUPPORT_SHA3).mk + + +CPPFLAGS_FULL =\ + $(CPPFLAGS)\ + $(CPPFLAGS_MD2)\ + $(CPPFLAGS_MD4)\ + $(CPPFLAGS_MD5)\ + $(CPPFLAGS_RIPEMD_128)\ + $(CPPFLAGS_RIPEMD_160)\ + $(CPPFLAGS_RIPEMD_256)\ + $(CPPFLAGS_RIPEMD_320)\ + $(CPPFLAGS_SHA1)\ + $(CPPFLAGS_SHA2)\ + $(CPPFLAGS_LIBKECCAK_IF_SUPPORTED)\ + $(CPPFLAGS_KECCAK)\ + $(CPPFLAGS_SHA3)\ + $(CPPFLAGS_SHAKE)\ + $(CPPFLAGS_RAWSHAKE)\ + $(CPPFLAGS_LIBBLAKE_IF_SUPPORTED)\ + $(CPPFLAGS_BLAKE224)\ + $(CPPFLAGS_BLAKE256)\ + $(CPPFLAGS_BLAKE384)\ + $(CPPFLAGS_BLAKE512) + +LDFLAGS_FULL =\ + $(LDFLAGS)\ + $(LDFLAGS_SHA1)\ + $(LDFLAGS_SHA2)\ + $(LDFLAGS_LIBKECCAK_IF_SUPPORTED)\ + $(LDFLAGS_LIBBLAKE_IF_SUPPORTED) diff --git a/mk/before-config.mk b/mk/before-config.mk new file mode 100644 index 0000000..c77dd47 --- /dev/null +++ b/mk/before-config.mk @@ -0,0 +1,21 @@ +# This are overwritten in $(CONFIGFILE), however they +# are added so that they are always defined even if +# the use has an out of date version of config.mk +DEFAULT_SUPPORT = yes +SUPPORT_SHA1 = $(DEFAULT_SUPPORT) +SUPPORT_SHA2 = $(DEFAULT_SUPPORT) +SUPPORT_MD2 = $(DEFAULT_SUPPORT) +SUPPORT_MD4 = $(DEFAULT_SUPPORT) +SUPPORT_MD5 = $(DEFAULT_SUPPORT) +SUPPORT_RIPEMD_128 = $(DEFAULT_SUPPORT) +SUPPORT_RIPEMD_160 = $(DEFAULT_SUPPORT) +SUPPORT_RIPEMD_256 = $(DEFAULT_SUPPORT) +SUPPORT_RIPEMD_320 = $(DEFAULT_SUPPORT) +SUPPORT_KECCAK = $(DEFAULT_SUPPORT) +SUPPORT_SHA3 = $(DEFAULT_SUPPORT) +SUPPORT_SHAKE = $(DEFAULT_SUPPORT) +SUPPORT_RAWSHAKE = $(DEFAULT_SUPPORT) +SUPPORT_BLAKE224 = $(DEFAULT_SUPPORT) +SUPPORT_BLAKE256 = $(DEFAULT_SUPPORT) +SUPPORT_BLAKE384 = $(DEFAULT_SUPPORT) +SUPPORT_BLAKE512 = $(DEFAULT_SUPPORT) |