VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto/Whirlpool.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Crypto/Whirlpool.c')
-rw-r--r--src/Crypto/Whirlpool.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/Crypto/Whirlpool.c b/src/Crypto/Whirlpool.c
index 35188c63..9af0cb32 100644
--- a/src/Crypto/Whirlpool.c
+++ b/src/Crypto/Whirlpool.c
@@ -643,6 +643,20 @@ static const uint64 Whirlpool_C[8*256+R] = {
void WhirlpoolTransform(uint64 *digest, const uint64 *block)
{
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
+#if defined(__GNUC__) && (CRYPTOPP_GCC_VERSION <= 40407)
+ /* workaround for gcc 4.4.7 bug under CentOS which causes crash
+ * in inline assembly.
+ * This dummy check that is always false since "block" is aligned.
+ */
+ uint64 lb = (uint64) block;
+ if (lb % 16)
+ {
+ TC_THROW_FATAL_EXCEPTION;
+ }
+#endif
+#endif
+
+#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
if (HasISSE())
{
#ifdef __GNUC__
@@ -880,7 +894,7 @@ static uint64 HashMultipleBlocks(WHIRLPOOL_CTX * const ctx, const uint64 *input,
#if BYTE_ORDER == BIG_ENDIAN
WhirlpoolTransform(ctx->state, input);
#else
- CorrectEndianess(dataBuf, input, 64);
+ CorrectEndianness(dataBuf, input, 64);
WhirlpoolTransform(ctx->state, dataBuf);
#endif
input += 8;
@@ -933,7 +947,6 @@ void WHIRLPOOL_add(const unsigned char * input,
HashMultipleBlocks(ctx, dataBuf, 64);
input += (64-num);
len -= (64-num);
- num = 0;
// drop through and do the rest
}
else
@@ -995,7 +1008,7 @@ void WHIRLPOOL_finalize(WHIRLPOOL_CTX * const ctx,
memset(data, 0, 32);
}
#if BYTE_ORDER == LITTLE_ENDIAN
- CorrectEndianess(dataBuf, dataBuf, 32);
+ CorrectEndianness(dataBuf, dataBuf, 32);
#endif
dataBuf[4] = 0;
@@ -1005,7 +1018,7 @@ void WHIRLPOOL_finalize(WHIRLPOOL_CTX * const ctx,
WhirlpoolTransform(stateBuf, dataBuf);
#if BYTE_ORDER == LITTLE_ENDIAN
- CorrectEndianess(stateBuf, stateBuf, 64);
+ CorrectEndianness(stateBuf, stateBuf, 64);
#endif
memcpy(result, stateBuf, 64);
}