mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-05 19:50:49 +02:00
wolfcrypt/src/sha3.c: fix Load64Unaligned() implementation with unaligned integer access when WC_SHA3_FAULT_HARDEN && !BIG_ENDIAN_ORDER.
This commit is contained in:
+2
-13
@@ -615,19 +615,8 @@ static word64 Load64BitLittleEndian(const byte* a)
|
||||
return n;
|
||||
}
|
||||
#elif defined(WC_SHA3_FAULT_HARDEN)
|
||||
static WC_INLINE word64 Load64Unaligned(const unsigned char *a)
|
||||
{
|
||||
#ifdef WC_64BIT_CPU
|
||||
return *(word64*)a;
|
||||
#elif defined(WC_32BIT_CPU)
|
||||
return (((word64)((word32*)a)[1]) << 32) |
|
||||
((word32*)a)[0];
|
||||
#else
|
||||
return (((word64)((word16*)a)[3]) << 48) |
|
||||
(((word64)((word16*)a)[2]) << 32) |
|
||||
(((word64)((word16*)a)[1]) << 16) |
|
||||
((word16*)a)[0];
|
||||
#endif
|
||||
static WC_INLINE word64 Load64Unaligned(const unsigned char *a) {
|
||||
return readUnalignedWord64(a);
|
||||
}
|
||||
|
||||
/* Convert the array of bytes, in little-endian order, to a 64-bit integer.
|
||||
|
||||
Reference in New Issue
Block a user