Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions wolfcrypt/src/aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -10185,20 +10185,20 @@ void GHASH(Gcm* gcm, const byte* a, word32 aSz, const byte* c,
#define GCM_GMULT_LEN(gcm, x, a, len) \
GCM_gmult_len_NEON(x, (const byte*)((gcm)->H), a, len)
#define GMULT(x, m) \
GCM_gmult_NEON(x, (const byte**)m)
GCM_gmult_NEON(x, (const byte**)(m))
#else
#define GCM_GMULT_LEN(gcm, x, a, len) \
GCM_gmult_len(x, (const byte**)((gcm)->M0), a, len)
#define GMULT(x, m) \
GCM_gmult(x, (const byte**)m)
GCM_gmult(x, (const byte**)(m))
#endif

/* PPC64 assembly */
#elif (defined(WOLFSSL_PPC64_ASM) || defined(WOLFSSL_PPC32_ASM))
#define GCM_GMULT_LEN(gcm, x, a, len) \
GCM_gmult_len(x, (const byte**)((gcm)->M0), a, len)
#define GMULT(x, m) \
GCM_gmult(x, (const byte**)m)
GCM_gmult(x, (const byte**)(m))

#else
/* remainder = x^7 + x^2 + x^1 + 1 => 0xe1
Expand Down
25 changes: 14 additions & 11 deletions wolfcrypt/src/sha3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,7 @@ static int Sha3Update(wc_Sha3* sha3, const byte* data, word32 len, word32 p)
{
word32 i;
word32 blocks;
word32 blockSz;
int ret = 0;
#ifdef WC_SHA3_FAULT_HARDEN
word32 check = 0;
Expand All @@ -1037,6 +1038,8 @@ static int Sha3Update(wc_Sha3* sha3, const byte* data, word32 len, word32 p)
if ((p < WC_SHA3_512_COUNT) || (p > WC_SHA3_128_COUNT))
return BAD_STATE_E;

blockSz = p * 8U;

#if defined(USE_INTEL_SPEEDUP) || defined(SHA3_NEEDS_VREG_CLAIM)
if (SHA3_BLOCK_VREGS(sha3_block)) {
ret = SAVE_VECTOR_REGISTERS2();
Expand All @@ -1055,11 +1058,11 @@ static int Sha3Update(wc_Sha3* sha3, const byte* data, word32 len, word32 p)
if (sha3->i > 0) {
byte *t;
word32 l;
if (p * 8 < sha3->i) {
if (blockSz < sha3->i) {
ret = BAD_STATE_E;
goto out;
}
l = (p * 8 - sha3->i);
l = (blockSz - sha3->i);
if (l > len) {
l = len;
}
Expand All @@ -1082,10 +1085,10 @@ static int Sha3Update(wc_Sha3* sha3, const byte* data, word32 len, word32 p)
len -= i;
sha3->i += i;

if (sha3->i == p * 8) {
if (sha3->i == blockSz) {
#if !defined(BIG_ENDIAN_ORDER) && !defined(WC_SHA3_FAULT_HARDEN) && \
!defined(WOLFSSL_WIDE_BYTE)
xorbuf(sha3->s, sha3->t, (word32)(p * 8));
xorbuf(sha3->s, sha3->t, blockSz);
#else
for (i = 0; i < p; i++) {
sha3->s[i] ^= Load64BitLittleEndian(sha3->t + 8 * i);
Expand All @@ -1109,12 +1112,12 @@ static int Sha3Update(wc_Sha3* sha3, const byte* data, word32 len, word32 p)
sha3->i = 0;
}
}
blocks = len / (p * 8U);
blocks = len / blockSz;
#ifdef SHA3_FUNC_PTR
if ((sha3_block_n != NULL) && (blocks > 0)) {
(*sha3_block_n)(sha3->s, data, blocks, p * 8U);
len -= blocks * (p * 8U);
data += blocks * (p * 8U);
(*sha3_block_n)(sha3->s, data, blocks, blockSz);
len -= blocks * blockSz;
data += blocks * blockSz;
blocks = 0;
}
#endif
Expand All @@ -1124,7 +1127,7 @@ static int Sha3Update(wc_Sha3* sha3, const byte* data, word32 len, word32 p)
for (; blocks > 0; blocks--) {
#if !defined(BIG_ENDIAN_ORDER) && !defined(WC_SHA3_FAULT_HARDEN) && \
!defined(WOLFSSL_WIDE_BYTE)
xorbuf(sha3->s, data, (word32)(p * 8));
xorbuf(sha3->s, data, blockSz);
#else
for (i = 0; i < p; i++) {
sha3->s[i] ^= Load64Unaligned(data + 8 * i);
Expand All @@ -1144,8 +1147,8 @@ static int Sha3Update(wc_Sha3* sha3, const byte* data, word32 len, word32 p)
#else
BlockSha3(sha3->s);
#endif
len -= p * 8U;
data += p * 8U;
len -= blockSz;
data += blockSz;
}
#ifdef WC_SHA3_FAULT_HARDEN
if (check != total_check) {
Expand Down
1 change: 0 additions & 1 deletion wolfcrypt/test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -39161,7 +39161,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t cert_test(void)
#ifndef WOLFSSL_NO_ASN_STRICT
if (ret != WC_NO_ERR_TRACE(ASN_CRIT_EXT_E))
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), done);
ret = 0;
#else
if (ret != 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), done);
Expand Down
Loading