From f3c93a7b57a3a33bf2f21c221cb6c9b134e7983e Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Mon, 17 Jun 2024 17:42:22 -0500 Subject: [PATCH 1/2] 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. --- wolfssl/wolfcrypt/sha256.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wolfssl/wolfcrypt/sha256.h b/wolfssl/wolfcrypt/sha256.h index d8239c2e34..a6c4ea46a3 100644 --- a/wolfssl/wolfcrypt/sha256.h +++ b/wolfssl/wolfcrypt/sha256.h @@ -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 */ From 87114faa9481dc9158930f6c408846d333d84359 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Mon, 17 Jun 2024 19:04:19 -0500 Subject: [PATCH 2/2] Revert "compatibility for EVP_CipherUpdate with AES-GCM" This reverts commit b7a28cc704165feb42b07c2d254bef6907d26249. WOLFSSL_AESGCM_STREAM needs to be conditional as arranged by configure.ac. --- wolfssl/wolfcrypt/settings.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index e1fd851f45..146e5c5948 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -3086,12 +3086,6 @@ extern void uITRON4_free(void *p) ; #define OPENSSL_EXTRA_X509_SMALL #endif /* OPENSSL_EXTRA */ -/* compatibility for EVP_CipherUpdate with AES-GCM */ -#if defined(OPENSSL_EXTRA) || defined(OPENSSL_ALL) - #undef WOLFSSL_AESGCM_STREAM - #define WOLFSSL_AESGCM_STREAM -#endif - /* support for converting DER to PEM */ #if (defined(WOLFSSL_KEY_GEN) && !defined(WOLFSSL_NO_DER_TO_PEM)) || \ defined(WOLFSSL_CERT_GEN) || defined(OPENSSL_EXTRA)