mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-06 00:40:49 +02:00
wolfcrypt/src/random.c:
* add workaround in Hash512_df() for gcc compiler bug around AVX512 and object alignment. * add missing WC_VERBOSE_RNG clause.
This commit is contained in:
@@ -1058,8 +1058,16 @@ static int Hash512_df(DRBG_SHA512_internal* drbg, byte* out, word32 outSz,
|
|||||||
byte* digest = drbg->digest_scratch;
|
byte* digest = drbg->digest_scratch;
|
||||||
#elif defined(WOLFSSL_SMALL_STACK)
|
#elif defined(WOLFSSL_SMALL_STACK)
|
||||||
byte* digest;
|
byte* digest;
|
||||||
|
#else
|
||||||
|
#if defined(__GNUC__) && !defined(__clang__) && defined(__AVX512F__)
|
||||||
|
/* Use a jumbo alignment to work around a gcc compiler/optimizer bug that
|
||||||
|
* assumes AVX512 alignment in an object sized correctly for AVX512 passed
|
||||||
|
* to builtin memcpy(), which promptly crashes if not thus aligned.
|
||||||
|
*/
|
||||||
|
byte digest[WC_SHA512_DIGEST_SIZE] WOLFSSL_ALIGN(WC_SHA512_DIGEST_SIZE);
|
||||||
#else
|
#else
|
||||||
byte digest[WC_SHA512_DIGEST_SIZE];
|
byte digest[WC_SHA512_DIGEST_SIZE];
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (drbg == NULL) {
|
if (drbg == NULL) {
|
||||||
@@ -1135,6 +1143,12 @@ static int Hash512_df(DRBG_SHA512_internal* drbg, byte* out, word32 outSz,
|
|||||||
XFREE(digest, drbg->heap, DYNAMIC_TYPE_DIGEST);
|
XFREE(digest, drbg->heap, DYNAMIC_TYPE_DIGEST);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WC_VERBOSE_RNG
|
||||||
|
if (ret != 0)
|
||||||
|
WOLFSSL_DEBUG_PRINTF("ERROR: %s failed with err = %d", __FUNCTION__,
|
||||||
|
ret);
|
||||||
|
#endif
|
||||||
|
|
||||||
return (ret == 0) ? DRBG_SUCCESS : DRBG_FAILURE;
|
return (ret == 0) ? DRBG_SUCCESS : DRBG_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user