Skip to content

Commit f3c93a7

Browse files
committed
wolfssl/wolfcrypt/sha256.h: in definition of struct wc_Sha256, conditionalize alignment optimization of digest and buffer slots on defined(WC_64BIT_CPU), to avoid overalignment warnings on 32 bit targets. this also fixes overalignment of struct Hmac.
1 parent 7018f46 commit f3c93a7

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

wolfssl/wolfcrypt/sha256.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,14 @@ struct wc_Sha256 {
179179
#elif defined(WOLFSSL_HAVE_PSA) && !defined(WOLFSSL_PSA_NO_HASH)
180180
psa_hash_operation_t psa_ctx;
181181
#else
182+
#ifdef WC_64BIT_CPU
182183
/* alignment on digest and buffer speeds up ARMv8 crypto operations */
183184
ALIGN16 word32 digest[WC_SHA256_DIGEST_SIZE / sizeof(word32)];
184185
ALIGN16 word32 buffer[WC_SHA256_BLOCK_SIZE / sizeof(word32)];
186+
#else
187+
word32 digest[WC_SHA256_DIGEST_SIZE / sizeof(word32)];
188+
word32 buffer[WC_SHA256_BLOCK_SIZE / sizeof(word32)];
189+
#endif
185190
word32 buffLen; /* in bytes */
186191
word32 loLen; /* length in bytes */
187192
word32 hiLen; /* length in bytes */

0 commit comments

Comments
 (0)