Skip to content

Commit 3e0679e

Browse files
authored
Merge pull request #10156 from douzzer/20260407-SHA3-unaligned-access
20260407-SHA3-unaligned-access
2 parents 6617863 + 296148b commit 3e0679e

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

wolfcrypt/src/sha3.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -615,19 +615,8 @@ static word64 Load64BitLittleEndian(const byte* a)
615615
return n;
616616
}
617617
#elif defined(WC_SHA3_FAULT_HARDEN)
618-
static WC_INLINE word64 Load64Unaligned(const unsigned char *a)
619-
{
620-
#ifdef WC_64BIT_CPU
621-
return *(word64*)a;
622-
#elif defined(WC_32BIT_CPU)
623-
return (((word64)((word32*)a)[1]) << 32) |
624-
((word32*)a)[0];
625-
#else
626-
return (((word64)((word16*)a)[3]) << 48) |
627-
(((word64)((word16*)a)[2]) << 32) |
628-
(((word64)((word16*)a)[1]) << 16) |
629-
((word16*)a)[0];
630-
#endif
618+
static WC_INLINE word64 Load64Unaligned(const unsigned char *a) {
619+
return readUnalignedWord64(a);
631620
}
632621

633622
/* Convert the array of bytes, in little-endian order, to a 64-bit integer.

0 commit comments

Comments
 (0)