From 91a473a8d9a7bfee8793cb9c3efb37c038bca614 Mon Sep 17 00:00:00 2001 From: Mathias Tausig <mathias.tausig@fh-campuswien.ac.at> Date: Tue, 6 Mar 2018 13:40:52 +0100 Subject: [PATCH] hashes:sha3: Alterations to Keccak code Changed integer typedefs to portable stdint types Added Endianness define --- sys/hashes/sha3.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/hashes/sha3.c b/sys/hashes/sha3.c index 5b21f06b53..bc6d1be9e0 100644 --- a/sys/hashes/sha3.c +++ b/sys/hashes/sha3.c @@ -57,6 +57,7 @@ */ #include <hashes/sha3.h> +#include <stdint.h> /** * Function to compute the Keccak[r, c] sponge function over a given input. @@ -193,10 +194,14 @@ void sha3_512_final(keccak_state_t *ctx, void *digest) ================================================================ */ -typedef unsigned char UINT8; -typedef unsigned long long int UINT64; +typedef uint8_t UINT8; +typedef uint64_t UINT64; typedef UINT64 tKeccakLane; +#if __BYTE_ORDER__ == __ORDER__LITTLE_ENDIAN__ +#define LITTLE_ENDIAN +#endif + #ifndef LITTLE_ENDIAN /** Function to load a 64-bit value using the little-endian (LE) convention. * On a LE platform, this could be greatly simplified using a cast. -- GitLab