From 34d9d37a6d473b96c4a4e17e234518fc7ecb828f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 10 Aug 2013 05:54:38 +0200 Subject: m + fix java-c-jni implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- c/sha3.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'c') diff --git a/c/sha3.c b/c/sha3.c index fc4f5e5..6ef90a1 100644 --- a/c/sha3.c +++ b/c/sha3.c @@ -20,9 +20,9 @@ #if __x86_64__ || __ppc64__ - #define llong long int + #define llong long int #else - #define llong long long int + #define llong long long int #endif @@ -38,12 +38,12 @@ * Round contants */ static const llong RC[] = { - 0x0000000000000001L, 0x0000000000008082L, 0x800000000000808AL, 0x8000000080008000L, - 0x000000000000808BL, 0x0000000080000001L, 0x8000000080008081L, 0x8000000000008009L, - 0x000000000000008AL, 0x0000000000000088L, 0x0000000080008009L, 0x000000008000000AL, - 0x000000008000808BL, 0x800000000000008BL, 0x8000000000008089L, 0x8000000000008003L, - 0x8000000000008002L, 0x8000000000000080L, 0x000000000000800AL, 0x800000008000000AL, - 0x8000000080008081L, 0x8000000000008080L, 0x0000000080000001L, 0x8000000080008008L}; + 0x0000000000000001L, 0x0000000000008082L, 0x800000000000808AL, 0x8000000080008000L, + 0x000000000000808BL, 0x0000000080000001L, 0x8000000080008081L, 0x8000000000008009L, + 0x000000000000008AL, 0x0000000000000088L, 0x0000000080008009L, 0x000000008000000AL, + 0x000000008000808BL, 0x800000000000008BL, 0x8000000000008089L, 0x8000000000008003L, + 0x8000000000008002L, 0x8000000000000080L, 0x000000000000800AL, 0x800000008000000AL, + 0x8000000080008081L, 0x8000000000008080L, 0x0000000080000001L, 0x8000000080008008L}; /** * Keccak-f round temporary @@ -95,7 +95,7 @@ static long l = 0; * 12 + 2ℓ, the number of rounds */ static long nr = 0; - + /** * The current state @@ -106,7 +106,7 @@ static llong* S = null; * Left over water to fill the sponge with at next update */ static byte* M = null; - + /** * Pointer for {@link #M} */ @@ -217,7 +217,6 @@ inline void revarraycopy(byte* src, long soff, byte* dest, long doff, long lengt } - /** * Rotate a word * @@ -428,7 +427,7 @@ inline byte* pad10star1(byte* msg, long len, long r, long* outlen) } else { - char* M; + byte* M; long N; len = (nrf + 1) << 3; len = ((len - (len % r) + (r - 8)) >> 3) + 1; @@ -613,7 +612,7 @@ extern void update(byte* msg, long msglen) free(_msg); } - + /** * Absorb the last part of the message and squeeze the Keccak sponge -- cgit v1.2.3-70-g09d2