1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-11 16:00:57 +00:00

Use proper option for USE_KECCAK via options.h

This commit is contained in:
Alex Beregszaszi 2016-05-17 18:10:23 +01:00
parent 23590c05c6
commit d68906ec4e
3 changed files with 8 additions and 2 deletions

View File

@ -56,4 +56,9 @@
#define BIP39_CACHE_SIZE 4 #define BIP39_CACHE_SIZE 4
#endif #endif
// support Keccak hashing
#ifndef USE_KECCAK
#define USE_KECCAK 0
#endif
#endif #endif

2
sha3.c
View File

@ -331,7 +331,7 @@ void sha3_Final(SHA3_CTX *ctx, unsigned char* result)
if (result) me64_to_le_str(result, ctx->hash, digest_length); if (result) me64_to_le_str(result, ctx->hash, digest_length);
} }
#ifdef USE_KECCAK #if USE_KECCAK
/** /**
* Store calculated hash into the given array. * Store calculated hash into the given array.
* *

3
sha3.h
View File

@ -21,6 +21,7 @@
#define __SHA3_H__ #define __SHA3_H__
#include <stdint.h> #include <stdint.h>
#include "options.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { 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_Update(SHA3_CTX *ctx, const unsigned char* msg, size_t size);
void sha3_Final(SHA3_CTX *ctx, unsigned char* result); void sha3_Final(SHA3_CTX *ctx, unsigned char* result);
#ifdef USE_KECCAK #if USE_KECCAK
#define keccak_224_Init sha3_224_Init #define keccak_224_Init sha3_224_Init
#define keccak_256_Init sha3_256_Init #define keccak_256_Init sha3_256_Init
#define keccak_384_Init sha3_384_Init #define keccak_384_Init sha3_384_Init