diff options
Diffstat (limited to 'src/3rdparty')
-rwxr-xr-x | src/3rdparty/sha3/KeccakF-1600-interface.h | 24 | ||||
-rwxr-xr-x | src/3rdparty/sha3/KeccakF-1600-opt32.c | 70 | ||||
-rwxr-xr-x | src/3rdparty/sha3/KeccakF-1600-opt64.c | 48 | ||||
-rwxr-xr-x | src/3rdparty/sha3/KeccakNISTInterface.c | 18 | ||||
-rwxr-xr-x | src/3rdparty/sha3/KeccakNISTInterface.h | 8 | ||||
-rwxr-xr-x | src/3rdparty/sha3/KeccakSponge.c | 10 | ||||
-rwxr-xr-x | src/3rdparty/sha3/KeccakSponge.h | 6 |
7 files changed, 94 insertions, 90 deletions
diff --git a/src/3rdparty/sha3/KeccakF-1600-interface.h b/src/3rdparty/sha3/KeccakF-1600-interface.h index 22185a4ac3..ce2710eeb2 100755 --- a/src/3rdparty/sha3/KeccakF-1600-interface.h +++ b/src/3rdparty/sha3/KeccakF-1600-interface.h @@ -16,31 +16,31 @@ http://creativecommons.org/publicdomain/zero/1.0/ #include "KeccakF-1600-int-set.h" -void KeccakInitialize( void ); -void KeccakInitializeState(unsigned char *state); -void KeccakPermutation(unsigned char *state); +static void KeccakInitialize( void ); +static void KeccakInitializeState(unsigned char *state); +static void KeccakPermutation(unsigned char *state); #ifdef ProvideFast576 -void KeccakAbsorb576bits(unsigned char *state, const unsigned char *data); +static void KeccakAbsorb576bits(unsigned char *state, const unsigned char *data); #endif #ifdef ProvideFast832 -void KeccakAbsorb832bits(unsigned char *state, const unsigned char *data); +static void KeccakAbsorb832bits(unsigned char *state, const unsigned char *data); #endif #ifdef ProvideFast1024 -void KeccakAbsorb1024bits(unsigned char *state, const unsigned char *data); +static void KeccakAbsorb1024bits(unsigned char *state, const unsigned char *data); #endif #ifdef ProvideFast1088 -void KeccakAbsorb1088bits(unsigned char *state, const unsigned char *data); +static void KeccakAbsorb1088bits(unsigned char *state, const unsigned char *data); #endif #ifdef ProvideFast1152 -void KeccakAbsorb1152bits(unsigned char *state, const unsigned char *data); +static void KeccakAbsorb1152bits(unsigned char *state, const unsigned char *data); #endif #ifdef ProvideFast1344 -void KeccakAbsorb1344bits(unsigned char *state, const unsigned char *data); +static void KeccakAbsorb1344bits(unsigned char *state, const unsigned char *data); #endif -void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsigned int laneCount); +static void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsigned int laneCount); #ifdef ProvideFast1024 -void KeccakExtract1024bits(const unsigned char *state, unsigned char *data); +static void KeccakExtract1024bits(const unsigned char *state, unsigned char *data); #endif -void KeccakExtract(const unsigned char *state, unsigned char *data, unsigned int laneCount); +static void KeccakExtract(const unsigned char *state, unsigned char *data, unsigned int laneCount); #endif diff --git a/src/3rdparty/sha3/KeccakF-1600-opt32.c b/src/3rdparty/sha3/KeccakF-1600-opt32.c index aded3a951b..b1b442c7e0 100755 --- a/src/3rdparty/sha3/KeccakF-1600-opt32.c +++ b/src/3rdparty/sha3/KeccakF-1600-opt32.c @@ -26,7 +26,7 @@ int interleaveTablesBuilt = 0; UINT16 interleaveTable[65536]; UINT16 deinterleaveTable[65536]; -void buildInterleaveTables() +static void buildInterleaveTables() { UINT32 i, j; UINT16 x; @@ -70,7 +70,7 @@ void buildInterleaveTables() #endif // Endianness -void xor8bytesIntoInterleavedWords(UINT32 *even, UINT32 *odd, const UINT8* source) +static void xor8bytesIntoInterleavedWords(UINT32 *even, UINT32 *odd, const UINT8* source) { UINT16 i0, i1, i2, i3; @@ -87,7 +87,7 @@ void xor8bytesIntoInterleavedWords(UINT32 *even, UINT32 *odd, const UINT8* sourc xor8bytesIntoInterleavedWords(state+i*2, state+i*2+1, input+i*8); \ } -void setInterleavedWordsInto8bytes(UINT8* dest, UINT32 even, UINT32 odd) +static void setInterleavedWordsInto8bytes(UINT8* dest, UINT32 even, UINT32 odd) { UINT16 d0, d1, d2, d3; @@ -138,7 +138,7 @@ void setInterleavedWordsInto8bytes(UINT8* dest, UINT32 even, UINT32 odd) #else // (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN) // Credit: Henry S. Warren, Hacker's Delight, Addison-Wesley, 2002 -UINT64 toInterleaving(UINT64 x) +static UINT64 toInterleaving(UINT64 x) { UINT64 t; @@ -151,7 +151,7 @@ UINT64 toInterleaving(UINT64 x) return x; } -void xor8bytesIntoInterleavedWords(UINT32* evenAndOdd, const UINT8* source) +static void xor8bytesIntoInterleavedWords(UINT32* evenAndOdd, const UINT8* source) { // This can be optimized UINT64 sourceWord = @@ -178,7 +178,7 @@ void xor8bytesIntoInterleavedWords(UINT32* evenAndOdd, const UINT8* source) #endif // Endianness // Credit: Henry S. Warren, Hacker's Delight, Addison-Wesley, 2002 -UINT64 fromInterleaving(UINT64 x) +static UINT64 fromInterleaving(UINT64 x) { UINT64 t; @@ -191,7 +191,7 @@ UINT64 fromInterleaving(UINT64 x) return x; } -void setInterleavedWordsInto8bytes(UINT8* dest, UINT32* evenAndOdd) +static void setInterleavedWordsInto8bytes(UINT8* dest, UINT32* evenAndOdd) { #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) ((UINT64*)dest)[0] = fromInterleaving(*(UINT64*)evenAndOdd); @@ -240,19 +240,19 @@ void setInterleavedWordsInto8bytes(UINT8* dest, UINT32* evenAndOdd) #error "Only unrolling 2 is supported by schedule 3." #endif -void KeccakPermutationOnWords(UINT32 *state) +static void KeccakPermutationOnWords(UINT32 *state) { rounds } -void KeccakPermutationOnWordsAfterXoring(UINT32 *state, const UINT8 *input, unsigned int laneCount) +static void KeccakPermutationOnWordsAfterXoring(UINT32 *state, const UINT8 *input, unsigned int laneCount) { xorLanesIntoState(laneCount, state, input) rounds } #ifdef ProvideFast576 -void KeccakPermutationOnWordsAfterXoring576bits(UINT32 *state, const UINT8 *input) +static void KeccakPermutationOnWordsAfterXoring576bits(UINT32 *state, const UINT8 *input) { xorLanesIntoState(9, state, input) rounds @@ -260,7 +260,7 @@ void KeccakPermutationOnWordsAfterXoring576bits(UINT32 *state, const UINT8 *inpu #endif #ifdef ProvideFast832 -void KeccakPermutationOnWordsAfterXoring832bits(UINT32 *state, const UINT8 *input) +static void KeccakPermutationOnWordsAfterXoring832bits(UINT32 *state, const UINT8 *input) { xorLanesIntoState(13, state, input) rounds @@ -268,7 +268,7 @@ void KeccakPermutationOnWordsAfterXoring832bits(UINT32 *state, const UINT8 *inpu #endif #ifdef ProvideFast1024 -void KeccakPermutationOnWordsAfterXoring1024bits(UINT32 *state, const UINT8 *input) +static void KeccakPermutationOnWordsAfterXoring1024bits(UINT32 *state, const UINT8 *input) { xorLanesIntoState(16, state, input) rounds @@ -276,7 +276,7 @@ void KeccakPermutationOnWordsAfterXoring1024bits(UINT32 *state, const UINT8 *inp #endif #ifdef ProvideFast1088 -void KeccakPermutationOnWordsAfterXoring1088bits(UINT32 *state, const UINT8 *input) +static void KeccakPermutationOnWordsAfterXoring1088bits(UINT32 *state, const UINT8 *input) { xorLanesIntoState(17, state, input) rounds @@ -284,7 +284,7 @@ void KeccakPermutationOnWordsAfterXoring1088bits(UINT32 *state, const UINT8 *inp #endif #ifdef ProvideFast1152 -void KeccakPermutationOnWordsAfterXoring1152bits(UINT32 *state, const UINT8 *input) +static void KeccakPermutationOnWordsAfterXoring1152bits(UINT32 *state, const UINT8 *input) { xorLanesIntoState(18, state, input) rounds @@ -292,7 +292,7 @@ void KeccakPermutationOnWordsAfterXoring1152bits(UINT32 *state, const UINT8 *inp #endif #ifdef ProvideFast1344 -void KeccakPermutationOnWordsAfterXoring1344bits(UINT32 *state, const UINT8 *input) +static void KeccakPermutationOnWordsAfterXoring1344bits(UINT32 *state, const UINT8 *input) { xorLanesIntoState(21, state, input) rounds @@ -301,7 +301,7 @@ void KeccakPermutationOnWordsAfterXoring1344bits(UINT32 *state, const UINT8 *inp #else // (Schedule != 3) -void KeccakPermutationOnWords(UINT32 *state) +static void KeccakPermutationOnWords(UINT32 *state) { declareABCDE #if (Unrolling != 24) @@ -312,7 +312,7 @@ void KeccakPermutationOnWords(UINT32 *state) rounds } -void KeccakPermutationOnWordsAfterXoring(UINT32 *state, const UINT8 *input, unsigned int laneCount) +static void KeccakPermutationOnWordsAfterXoring(UINT32 *state, const UINT8 *input, unsigned int laneCount) { declareABCDE unsigned int i; @@ -323,7 +323,7 @@ void KeccakPermutationOnWordsAfterXoring(UINT32 *state, const UINT8 *input, unsi } #ifdef ProvideFast576 -void KeccakPermutationOnWordsAfterXoring576bits(UINT32 *state, const UINT8 *input) +static void KeccakPermutationOnWordsAfterXoring576bits(UINT32 *state, const UINT8 *input) { declareABCDE unsigned int i; @@ -335,7 +335,7 @@ void KeccakPermutationOnWordsAfterXoring576bits(UINT32 *state, const UINT8 *inpu #endif #ifdef ProvideFast832 -void KeccakPermutationOnWordsAfterXoring832bits(UINT32 *state, const UINT8 *input) +static void KeccakPermutationOnWordsAfterXoring832bits(UINT32 *state, const UINT8 *input) { declareABCDE unsigned int i; @@ -347,7 +347,7 @@ void KeccakPermutationOnWordsAfterXoring832bits(UINT32 *state, const UINT8 *inpu #endif #ifdef ProvideFast1024 -void KeccakPermutationOnWordsAfterXoring1024bits(UINT32 *state, const UINT8 *input) +static void KeccakPermutationOnWordsAfterXoring1024bits(UINT32 *state, const UINT8 *input) { declareABCDE unsigned int i; @@ -359,7 +359,7 @@ void KeccakPermutationOnWordsAfterXoring1024bits(UINT32 *state, const UINT8 *inp #endif #ifdef ProvideFast1088 -void KeccakPermutationOnWordsAfterXoring1088bits(UINT32 *state, const UINT8 *input) +static void KeccakPermutationOnWordsAfterXoring1088bits(UINT32 *state, const UINT8 *input) { declareABCDE unsigned int i; @@ -371,7 +371,7 @@ void KeccakPermutationOnWordsAfterXoring1088bits(UINT32 *state, const UINT8 *inp #endif #ifdef ProvideFast1152 -void KeccakPermutationOnWordsAfterXoring1152bits(UINT32 *state, const UINT8 *input) +static void KeccakPermutationOnWordsAfterXoring1152bits(UINT32 *state, const UINT8 *input) { declareABCDE unsigned int i; @@ -383,7 +383,7 @@ void KeccakPermutationOnWordsAfterXoring1152bits(UINT32 *state, const UINT8 *inp #endif #ifdef ProvideFast1344 -void KeccakPermutationOnWordsAfterXoring1344bits(UINT32 *state, const UINT8 *input) +static void KeccakPermutationOnWordsAfterXoring1344bits(UINT32 *state, const UINT8 *input) { declareABCDE unsigned int i; @@ -396,14 +396,14 @@ void KeccakPermutationOnWordsAfterXoring1344bits(UINT32 *state, const UINT8 *inp #endif -void KeccakInitialize() +static void KeccakInitialize() { #ifdef UseInterleaveTables buildInterleaveTables(); #endif } -void KeccakInitializeState(unsigned char *state) +static void KeccakInitializeState(unsigned char *state) { memset(state, 0, 200); #ifdef UseBebigokimisa @@ -422,61 +422,61 @@ void KeccakInitializeState(unsigned char *state) #endif } -void KeccakPermutation(unsigned char *state) +static void KeccakPermutation(unsigned char *state) { // We assume the state is always stored as interleaved 32-bit words KeccakPermutationOnWords((UINT32*)state); } #ifdef ProvideFast576 -void KeccakAbsorb576bits(unsigned char *state, const unsigned char *data) +static void KeccakAbsorb576bits(unsigned char *state, const unsigned char *data) { KeccakPermutationOnWordsAfterXoring576bits((UINT32*)state, data); } #endif #ifdef ProvideFast832 -void KeccakAbsorb832bits(unsigned char *state, const unsigned char *data) +static void KeccakAbsorb832bits(unsigned char *state, const unsigned char *data) { KeccakPermutationOnWordsAfterXoring832bits((UINT32*)state, data); } #endif #ifdef ProvideFast1024 -void KeccakAbsorb1024bits(unsigned char *state, const unsigned char *data) +static void KeccakAbsorb1024bits(unsigned char *state, const unsigned char *data) { KeccakPermutationOnWordsAfterXoring1024bits((UINT32*)state, data); } #endif #ifdef ProvideFast1088 -void KeccakAbsorb1088bits(unsigned char *state, const unsigned char *data) +static void KeccakAbsorb1088bits(unsigned char *state, const unsigned char *data) { KeccakPermutationOnWordsAfterXoring1088bits((UINT32*)state, data); } #endif #ifdef ProvideFast1152 -void KeccakAbsorb1152bits(unsigned char *state, const unsigned char *data) +static void KeccakAbsorb1152bits(unsigned char *state, const unsigned char *data) { KeccakPermutationOnWordsAfterXoring1152bits((UINT32*)state, data); } #endif #ifdef ProvideFast1344 -void KeccakAbsorb1344bits(unsigned char *state, const unsigned char *data) +static void KeccakAbsorb1344bits(unsigned char *state, const unsigned char *data) { KeccakPermutationOnWordsAfterXoring1344bits((UINT32*)state, data); } #endif -void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsigned int laneCount) +static void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsigned int laneCount) { KeccakPermutationOnWordsAfterXoring((UINT32*)state, data, laneCount); } #ifdef ProvideFast1024 -void KeccakExtract1024bits(const unsigned char *state, unsigned char *data) +static void KeccakExtract1024bits(const unsigned char *state, unsigned char *data) { extractLanes(16, state, data) #ifdef UseBebigokimisa @@ -492,7 +492,7 @@ void KeccakExtract1024bits(const unsigned char *state, unsigned char *data) } #endif -void KeccakExtract(const unsigned char *state, unsigned char *data, unsigned int laneCount) +static void KeccakExtract(const unsigned char *state, unsigned char *data, unsigned int laneCount) { extractLanes(laneCount, state, data) #ifdef UseBebigokimisa diff --git a/src/3rdparty/sha3/KeccakF-1600-opt64.c b/src/3rdparty/sha3/KeccakF-1600-opt64.c index 9349f0366a..0432f1ab18 100755 --- a/src/3rdparty/sha3/KeccakF-1600-opt64.c +++ b/src/3rdparty/sha3/KeccakF-1600-opt64.c @@ -174,7 +174,7 @@ ALIGN const UINT64 rot_39_41[2] = {39, 41}; #include "KeccakF-1600-unrolling.macros" -void KeccakPermutationOnWords(UINT64 *state) +static void KeccakPermutationOnWords(UINT64 *state) { declareABCDE #if (Unrolling != 24) @@ -188,7 +188,7 @@ void KeccakPermutationOnWords(UINT64 *state) #endif } -void KeccakPermutationOnWordsAfterXoring(UINT64 *state, const UINT64 *input, unsigned int laneCount) +static void KeccakPermutationOnWordsAfterXoring(UINT64 *state, const UINT64 *input, unsigned int laneCount) { declareABCDE #if (Unrolling != 24) @@ -206,7 +206,7 @@ void KeccakPermutationOnWordsAfterXoring(UINT64 *state, const UINT64 *input, uns } #ifdef ProvideFast576 -void KeccakPermutationOnWordsAfterXoring576bits(UINT64 *state, const UINT64 *input) +static void KeccakPermutationOnWordsAfterXoring576bits(UINT64 *state, const UINT64 *input) { declareABCDE #if (Unrolling != 24) @@ -222,7 +222,7 @@ void KeccakPermutationOnWordsAfterXoring576bits(UINT64 *state, const UINT64 *inp #endif #ifdef ProvideFast832 -void KeccakPermutationOnWordsAfterXoring832bits(UINT64 *state, const UINT64 *input) +static void KeccakPermutationOnWordsAfterXoring832bits(UINT64 *state, const UINT64 *input) { declareABCDE #if (Unrolling != 24) @@ -238,7 +238,7 @@ void KeccakPermutationOnWordsAfterXoring832bits(UINT64 *state, const UINT64 *inp #endif #ifdef ProvideFast1024 -void KeccakPermutationOnWordsAfterXoring1024bits(UINT64 *state, const UINT64 *input) +static void KeccakPermutationOnWordsAfterXoring1024bits(UINT64 *state, const UINT64 *input) { declareABCDE #if (Unrolling != 24) @@ -254,7 +254,7 @@ void KeccakPermutationOnWordsAfterXoring1024bits(UINT64 *state, const UINT64 *in #endif #ifdef ProvideFast1088 -void KeccakPermutationOnWordsAfterXoring1088bits(UINT64 *state, const UINT64 *input) +static void KeccakPermutationOnWordsAfterXoring1088bits(UINT64 *state, const UINT64 *input) { declareABCDE #if (Unrolling != 24) @@ -270,7 +270,7 @@ void KeccakPermutationOnWordsAfterXoring1088bits(UINT64 *state, const UINT64 *in #endif #ifdef ProvideFast1152 -void KeccakPermutationOnWordsAfterXoring1152bits(UINT64 *state, const UINT64 *input) +static void KeccakPermutationOnWordsAfterXoring1152bits(UINT64 *state, const UINT64 *input) { declareABCDE #if (Unrolling != 24) @@ -286,7 +286,7 @@ void KeccakPermutationOnWordsAfterXoring1152bits(UINT64 *state, const UINT64 *in #endif #ifdef ProvideFast1344 -void KeccakPermutationOnWordsAfterXoring1344bits(UINT64 *state, const UINT64 *input) +static void KeccakPermutationOnWordsAfterXoring1344bits(UINT64 *state, const UINT64 *input) { declareABCDE #if (Unrolling != 24) @@ -301,11 +301,11 @@ void KeccakPermutationOnWordsAfterXoring1344bits(UINT64 *state, const UINT64 *in } #endif -void KeccakInitialize() +static void KeccakInitialize() { } -void KeccakInitializeState(unsigned char *state) +static void KeccakInitializeState(unsigned char *state) { memset(state, 0, 200); #ifdef UseBebigokimisa @@ -318,13 +318,14 @@ void KeccakInitializeState(unsigned char *state) #endif } -void KeccakPermutation(unsigned char *state) +static void KeccakPermutation(unsigned char *state) { // We assume the state is always stored as words KeccakPermutationOnWords((UINT64*)state); } -void fromBytesToWord(UINT64 *word, const UINT8 *bytes) +#if 0 // Unused in the Qt configuration +static void fromBytesToWord(UINT64 *word, const UINT8 *bytes) { unsigned int i; @@ -332,9 +333,10 @@ void fromBytesToWord(UINT64 *word, const UINT8 *bytes) for(i=0; i<(64/8); i++) *word |= (UINT64)(bytes[i]) << (8*i); } +#endif #ifdef ProvideFast576 -void KeccakAbsorb576bits(unsigned char *state, const unsigned char *data) +static void KeccakAbsorb576bits(unsigned char *state, const unsigned char *data) { #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) KeccakPermutationOnWordsAfterXoring576bits((UINT64*)state, (const UINT64*)data); @@ -350,7 +352,7 @@ void KeccakAbsorb576bits(unsigned char *state, const unsigned char *data) #endif #ifdef ProvideFast832 -void KeccakAbsorb832bits(unsigned char *state, const unsigned char *data) +static void KeccakAbsorb832bits(unsigned char *state, const unsigned char *data) { #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) KeccakPermutationOnWordsAfterXoring832bits((UINT64*)state, (const UINT64*)data); @@ -366,7 +368,7 @@ void KeccakAbsorb832bits(unsigned char *state, const unsigned char *data) #endif #ifdef ProvideFast1024 -void KeccakAbsorb1024bits(unsigned char *state, const unsigned char *data) +static void KeccakAbsorb1024bits(unsigned char *state, const unsigned char *data) { #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) KeccakPermutationOnWordsAfterXoring1024bits((UINT64*)state, (const UINT64*)data); @@ -382,7 +384,7 @@ void KeccakAbsorb1024bits(unsigned char *state, const unsigned char *data) #endif #ifdef ProvideFast1088 -void KeccakAbsorb1088bits(unsigned char *state, const unsigned char *data) +static void KeccakAbsorb1088bits(unsigned char *state, const unsigned char *data) { #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) KeccakPermutationOnWordsAfterXoring1088bits((UINT64*)state, (const UINT64*)data); @@ -398,7 +400,7 @@ void KeccakAbsorb1088bits(unsigned char *state, const unsigned char *data) #endif #ifdef ProvideFast1152 -void KeccakAbsorb1152bits(unsigned char *state, const unsigned char *data) +static void KeccakAbsorb1152bits(unsigned char *state, const unsigned char *data) { #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) KeccakPermutationOnWordsAfterXoring1152bits((UINT64*)state, (const UINT64*)data); @@ -414,7 +416,7 @@ void KeccakAbsorb1152bits(unsigned char *state, const unsigned char *data) #endif #ifdef ProvideFast1344 -void KeccakAbsorb1344bits(unsigned char *state, const unsigned char *data) +static void KeccakAbsorb1344bits(unsigned char *state, const unsigned char *data) { #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) KeccakPermutationOnWordsAfterXoring1344bits((UINT64*)state, (const UINT64*)data); @@ -429,7 +431,7 @@ void KeccakAbsorb1344bits(unsigned char *state, const unsigned char *data) } #endif -void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsigned int laneCount) +static void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsigned int laneCount) { #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) KeccakPermutationOnWordsAfterXoring((UINT64*)state, (const UINT64*)data, laneCount); @@ -443,16 +445,18 @@ void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsigned int #endif } -void fromWordToBytes(UINT8 *bytes, const UINT64 word) +#if 0 // Unused in the Qt configuration +static void fromWordToBytes(UINT8 *bytes, const UINT64 word) { unsigned int i; for(i=0; i<(64/8); i++) bytes[i] = (word >> (8*i)) & 0xFF; } +#endif #ifdef ProvideFast1024 -void KeccakExtract1024bits(const unsigned char *state, unsigned char *data) +static void KeccakExtract1024bits(const unsigned char *state, unsigned char *data) { #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) memcpy(data, state, 128); @@ -471,7 +475,7 @@ void KeccakExtract1024bits(const unsigned char *state, unsigned char *data) } #endif -void KeccakExtract(const unsigned char *state, unsigned char *data, unsigned int laneCount) +static void KeccakExtract(const unsigned char *state, unsigned char *data, unsigned int laneCount) { #if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) memcpy(data, state, laneCount*8); diff --git a/src/3rdparty/sha3/KeccakNISTInterface.c b/src/3rdparty/sha3/KeccakNISTInterface.c index 5d92c74239..33e6e0d28b 100755 --- a/src/3rdparty/sha3/KeccakNISTInterface.c +++ b/src/3rdparty/sha3/KeccakNISTInterface.c @@ -12,10 +12,10 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ #include <string.h> -#include "KeccakNISTInterface.h" +//#include "KeccakNISTInterface.h" #include "KeccakF-1600-interface.h" -HashReturn Init(hashState *state, int hashbitlen) +static HashReturn Init(hashState *state, int hashbitlen) { switch(hashbitlen) { case 0: // Default parameters, arbitrary length output @@ -40,29 +40,29 @@ HashReturn Init(hashState *state, int hashbitlen) return SUCCESS; } -HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen) +static HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen) { if ((databitlen % 8) == 0) - return Absorb((spongeState*)state, data, databitlen); + return (HashReturn) Absorb((spongeState*)state, data, databitlen); else { - HashReturn ret = Absorb((spongeState*)state, data, databitlen - (databitlen % 8)); + HashReturn ret = (HashReturn) Absorb((spongeState*)state, data, databitlen - (databitlen % 8)); if (ret == SUCCESS) { unsigned char lastByte; // Align the last partial byte to the least significant bits lastByte = data[databitlen/8] >> (8 - (databitlen % 8)); - return Absorb((spongeState*)state, &lastByte, databitlen % 8); + return (HashReturn) Absorb((spongeState*)state, &lastByte, databitlen % 8); } else return ret; } } -HashReturn Final(hashState *state, BitSequence *hashval) +static HashReturn Final(hashState *state, BitSequence *hashval) { - return Squeeze(state, hashval, state->fixedOutputLength); + return (HashReturn) Squeeze(state, hashval, state->fixedOutputLength); } -HashReturn Hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval) +static HashReturn Hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval) { hashState state; HashReturn result; diff --git a/src/3rdparty/sha3/KeccakNISTInterface.h b/src/3rdparty/sha3/KeccakNISTInterface.h index c6987d420b..cd85f24aa7 100755 --- a/src/3rdparty/sha3/KeccakNISTInterface.h +++ b/src/3rdparty/sha3/KeccakNISTInterface.h @@ -32,7 +32,7 @@ typedef spongeState hashState; * @pre The value of hashbitlen must be one of 0, 224, 256, 384 and 512. * @return SUCCESS if successful, BAD_HASHLEN if the value of hashbitlen is incorrect. */ -HashReturn Init(hashState *state, int hashbitlen); +static HashReturn Init(hashState *state, int hashbitlen); /** * Function to give input data for the sponge function to absorb. * @param state Pointer to the state of the sponge function initialized by Init(). @@ -43,7 +43,7 @@ HashReturn Init(hashState *state, int hashbitlen); * @pre In the previous call to Absorb(), databitLen was a multiple of 8. * @return SUCCESS if successful, FAIL otherwise. */ -HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen); +static HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen); /** * Function to squeeze output data from the sponge function. * If @a hashbitlen was not 0 in the call to Init(), the number of output bits is equal to @a hashbitlen. @@ -52,7 +52,7 @@ HashReturn Update(hashState *state, const BitSequence *data, DataLength databitl * @param hashval Pointer to the buffer where to store the output data. * @return SUCCESS if successful, FAIL otherwise. */ -HashReturn Final(hashState *state, BitSequence *hashval); +static HashReturn Final(hashState *state, BitSequence *hashval); /** * Function to compute a hash using the Keccak[r, c] sponge function. * The rate r and capacity c values are determined from @a hashbitlen. @@ -65,6 +65,6 @@ HashReturn Final(hashState *state, BitSequence *hashval); * @pre The value of hashbitlen must be one of 224, 256, 384 and 512. * @return SUCCESS if successful, BAD_HASHLEN if the value of hashbitlen is incorrect. */ -HashReturn Hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval); +static HashReturn Hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval); #endif diff --git a/src/3rdparty/sha3/KeccakSponge.c b/src/3rdparty/sha3/KeccakSponge.c index 5939ba4177..6f3da95dbb 100755 --- a/src/3rdparty/sha3/KeccakSponge.c +++ b/src/3rdparty/sha3/KeccakSponge.c @@ -18,7 +18,7 @@ http://creativecommons.org/publicdomain/zero/1.0/ #include "displayIntermediateValues.h" #endif -int InitSponge(spongeState *state, unsigned int rate, unsigned int capacity) +static int InitSponge(spongeState *state, unsigned int rate, unsigned int capacity) { if (rate+capacity != 1600) return 1; @@ -37,7 +37,7 @@ int InitSponge(spongeState *state, unsigned int rate, unsigned int capacity) return 0; } -void AbsorbQueue(spongeState *state) +static void AbsorbQueue(spongeState *state) { // state->bitsInQueue is assumed to be equal to state->rate #ifdef KeccakReference @@ -77,7 +77,7 @@ void AbsorbQueue(spongeState *state) state->bitsInQueue = 0; } -int Absorb(spongeState *state, const unsigned char *data, unsigned long long databitlen) +static int Absorb(spongeState *state, const unsigned char *data, unsigned long long databitlen) { unsigned long long i, j, wholeBlocks; unsigned int partialBlock, partialByte; @@ -191,7 +191,7 @@ int Absorb(spongeState *state, const unsigned char *data, unsigned long long dat return 0; } -void PadAndSwitchToSqueezingPhase(spongeState *state) +static void PadAndSwitchToSqueezingPhase(spongeState *state) { // Note: the bits are numbered from 0=LSB to 7=MSB if (state->bitsInQueue + 1 == state->rate) { @@ -226,7 +226,7 @@ void PadAndSwitchToSqueezingPhase(spongeState *state) state->squeezing = 1; } -int Squeeze(spongeState *state, unsigned char *output, unsigned long long outputLength) +static int Squeeze(spongeState *state, unsigned char *output, unsigned long long outputLength) { unsigned long long i; unsigned int partialBlock; diff --git a/src/3rdparty/sha3/KeccakSponge.h b/src/3rdparty/sha3/KeccakSponge.h index df3d7971f8..a545cacb30 100755 --- a/src/3rdparty/sha3/KeccakSponge.h +++ b/src/3rdparty/sha3/KeccakSponge.h @@ -47,7 +47,7 @@ ALIGN typedef struct spongeStateStruct { * @pre One must have r+c=1600 and the rate a multiple of 64 bits in this implementation. * @return Zero if successful, 1 otherwise. */ -int InitSponge(spongeState *state, unsigned int rate, unsigned int capacity); +static int InitSponge(spongeState *state, unsigned int rate, unsigned int capacity); /** * Function to give input data for the sponge function to absorb. * @param state Pointer to the state of the sponge function initialized by InitSponge(). @@ -60,7 +60,7 @@ int InitSponge(spongeState *state, unsigned int rate, unsigned int capacity); * i.e., Squeeze() must not have been called before. * @return Zero if successful, 1 otherwise. */ -int Absorb(spongeState *state, const unsigned char *data, unsigned long long databitlen); +static int Absorb(spongeState *state, const unsigned char *data, unsigned long long databitlen); /** * Function to squeeze output data from the sponge function. * If the sponge function was in the absorbing phase, this function @@ -71,6 +71,6 @@ int Absorb(spongeState *state, const unsigned char *data, unsigned long long dat * It must be a multiple of 8. * @return Zero if successful, 1 otherwise. */ -int Squeeze(spongeState *state, unsigned char *output, unsigned long long outputLength); +static int Squeeze(spongeState *state, unsigned char *output, unsigned long long outputLength); #endif |