Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ba3e4a0

Browse files
committed
Keccak: fromBytesToWord() and fromWordToBytes() are required on 64bit big endian platforms
1 parent 174baa3 commit ba3e4a0

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Modules/_sha3/keccak/KeccakF-1600-opt64.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ static void KeccakPermutation(unsigned char *state)
324324
KeccakPermutationOnWords((UINT64*)state);
325325
}
326326

327-
/*
327+
#if (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN)
328328
static void fromBytesToWord(UINT64 *word, const UINT8 *bytes)
329329
{
330330
unsigned int i;
@@ -333,7 +333,8 @@ static void fromBytesToWord(UINT64 *word, const UINT8 *bytes)
333333
for(i=0; i<(64/8); i++)
334334
*word |= (UINT64)(bytes[i]) << (8*i);
335335
}
336-
*/
336+
#endif
337+
337338

338339
#ifdef ProvideFast576
339340
static void KeccakAbsorb576bits(unsigned char *state, const unsigned char *data)
@@ -445,15 +446,16 @@ static void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsign
445446
#endif
446447
}
447448

448-
/*
449+
#if (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN)
449450
static void fromWordToBytes(UINT8 *bytes, const UINT64 word)
450451
{
451452
unsigned int i;
452453

453454
for(i=0; i<(64/8); i++)
454455
bytes[i] = (word >> (8*i)) & 0xFF;
455456
}
456-
*/
457+
#endif
458+
457459

458460
#ifdef ProvideFast1024
459461
static void KeccakExtract1024bits(const unsigned char *state, unsigned char *data)

0 commit comments

Comments
 (0)