Skip to content

Commit

Permalink
wolfssl/wolfcrypt/sha256.h: in definition of struct wc_Sha256, condit…
Browse files Browse the repository at this point in the history
…ionalize 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.
  • Loading branch information
douzzer committed Jun 18, 2024
1 parent 7018f46 commit f3c93a7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions wolfssl/wolfcrypt/sha256.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,14 @@ struct wc_Sha256 {
#elif defined(WOLFSSL_HAVE_PSA) && !defined(WOLFSSL_PSA_NO_HASH)
psa_hash_operation_t psa_ctx;
#else
#ifdef WC_64BIT_CPU
/* alignment on digest and buffer speeds up ARMv8 crypto operations */
ALIGN16 word32 digest[WC_SHA256_DIGEST_SIZE / sizeof(word32)];
ALIGN16 word32 buffer[WC_SHA256_BLOCK_SIZE / sizeof(word32)];
#else
word32 digest[WC_SHA256_DIGEST_SIZE / sizeof(word32)];
word32 buffer[WC_SHA256_BLOCK_SIZE / sizeof(word32)];
#endif
word32 buffLen; /* in bytes */
word32 loLen; /* length in bytes */
word32 hiLen; /* length in bytes */
Expand Down

0 comments on commit f3c93a7

Please sign in to comment.