mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-08 11:20:50 +02:00
Revert XMEMSET 0 after free in copy process for digest/hashing functions
This commit is contained in:
@@ -540,8 +540,6 @@ int wc_Md5Copy(wc_Md5* src, wc_Md5* dst)
|
||||
/* Free dst resources before copy to prevent memory leaks (e.g.,
|
||||
* hardware contexts). XMEMCPY overwrites dst. */
|
||||
wc_Md5Free(dst);
|
||||
XMEMSET(dst, 0, sizeof(wc_Md5));
|
||||
|
||||
XMEMCPY(dst, src, sizeof(wc_Md5));
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_MD5)
|
||||
|
||||
@@ -1175,8 +1175,6 @@ int wc_ShaCopy(wc_Sha* src, wc_Sha* dst)
|
||||
/* Free dst resources before copy to prevent memory leaks (e.g., msg
|
||||
* buffer, W cache, hardware contexts). XMEMCPY overwrites dst. */
|
||||
wc_ShaFree(dst);
|
||||
XMEMSET(dst, 0, sizeof(wc_Sha));
|
||||
|
||||
XMEMCPY(dst, src, sizeof(wc_Sha));
|
||||
|
||||
#if defined(WOLFSSL_SILABS_SE_ACCEL) && defined(WOLFSSL_SILABS_SE_ACCEL_3)
|
||||
|
||||
@@ -2585,8 +2585,6 @@ int wc_Sha224_Grow(wc_Sha224* sha224, const byte* in, int inSz)
|
||||
/* Free dst resources before copy to prevent memory leaks (e.g., msg
|
||||
* buffer, W cache, hardware contexts). XMEMCPY overwrites dst. */
|
||||
wc_Sha224Free(dst);
|
||||
XMEMSET(dst, 0, sizeof(wc_Sha224));
|
||||
|
||||
XMEMCPY(dst, src, sizeof(wc_Sha224));
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK_CACHE
|
||||
@@ -2736,8 +2734,6 @@ int wc_Sha256Copy(wc_Sha256* src, wc_Sha256* dst)
|
||||
/* Free dst resources before copy to prevent memory leaks (e.g., msg
|
||||
* buffer, W cache, hardware contexts). XMEMCPY overwrites dst. */
|
||||
wc_Sha256Free(dst);
|
||||
XMEMSET(dst, 0, sizeof(wc_Sha256));
|
||||
|
||||
XMEMCPY(dst, src, sizeof(wc_Sha256));
|
||||
|
||||
#ifdef WOLFSSL_MAXQ10XX_CRYPTO
|
||||
|
||||
@@ -1309,8 +1309,6 @@ static int wc_Sha3Copy(wc_Sha3* src, wc_Sha3* dst)
|
||||
/* Free dst resources before copy to prevent memory leaks (e.g.,
|
||||
* hardware contexts). XMEMCPY overwrites dst. */
|
||||
wc_Sha3Free(dst);
|
||||
XMEMSET(dst, 0, sizeof(wc_Sha3));
|
||||
|
||||
XMEMCPY(dst, src, sizeof(wc_Sha3));
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_SHA3)
|
||||
|
||||
@@ -2252,8 +2252,6 @@ int wc_Sha512Copy(wc_Sha512* src, wc_Sha512* dst)
|
||||
/* Free dst resources before copy to prevent memory leaks (e.g., msg
|
||||
* buffer, W cache, hardware contexts). XMEMCPY overwrites dst. */
|
||||
wc_Sha512Free(dst);
|
||||
XMEMSET(dst, 0, sizeof(wc_Sha512));
|
||||
|
||||
XMEMCPY(dst, src, sizeof(wc_Sha512));
|
||||
#ifdef WOLFSSL_SMALL_STACK_CACHE
|
||||
/* This allocation combines the customary W buffer used by
|
||||
@@ -2695,8 +2693,6 @@ int wc_Sha384Copy(wc_Sha384* src, wc_Sha384* dst)
|
||||
/* Free dst resources before copy to prevent memory leaks (e.g., msg
|
||||
* buffer, W cache, hardware contexts). XMEMCPY overwrites dst. */
|
||||
wc_Sha384Free(dst);
|
||||
XMEMSET(dst, 0, sizeof(wc_Sha384));
|
||||
|
||||
XMEMCPY(dst, src, sizeof(wc_Sha384));
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK_CACHE
|
||||
|
||||
Reference in New Issue
Block a user