From d68906ec4eeddf59bb9c67e0a8f8077991cd17c3 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 17 May 2016 18:10:23 +0100 Subject: [PATCH] Use proper option for USE_KECCAK via options.h --- options.h | 5 +++++ sha3.c | 2 +- sha3.h | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/options.h b/options.h index d5ac4ab33e..4baadf0bd5 100644 --- a/options.h +++ b/options.h @@ -56,4 +56,9 @@ #define BIP39_CACHE_SIZE 4 #endif +// support Keccak hashing +#ifndef USE_KECCAK +#define USE_KECCAK 0 +#endif + #endif diff --git a/sha3.c b/sha3.c index 9f23b89d35..fc6d1c8bf7 100644 --- a/sha3.c +++ b/sha3.c @@ -331,7 +331,7 @@ void sha3_Final(SHA3_CTX *ctx, unsigned char* result) if (result) me64_to_le_str(result, ctx->hash, digest_length); } -#ifdef USE_KECCAK +#if USE_KECCAK /** * Store calculated hash into the given array. * diff --git a/sha3.h b/sha3.h index b809f33590..b605663ae0 100644 --- a/sha3.h +++ b/sha3.h @@ -21,6 +21,7 @@ #define __SHA3_H__ #include +#include "options.h" #ifdef __cplusplus extern "C" { @@ -57,7 +58,7 @@ void sha3_512_Init(SHA3_CTX *ctx); void sha3_Update(SHA3_CTX *ctx, const unsigned char* msg, size_t size); void sha3_Final(SHA3_CTX *ctx, unsigned char* result); -#ifdef USE_KECCAK +#if USE_KECCAK #define keccak_224_Init sha3_224_Init #define keccak_256_Init sha3_256_Init #define keccak_384_Init sha3_384_Init