Fix for possible unused local32 warning.

pull/2481/head
David Garske 2019-09-27 09:22:18 -07:00
parent 78f6bbcdb8
commit b47039b7ec
3 changed files with 9 additions and 11 deletions

View File

@ -311,8 +311,7 @@ int wc_Md5Update(wc_Md5* md5, const byte* data, word32 len)
{
int ret = 0;
word32 blocksLen;
byte* local;
word32* local32;
byte* local;
if (md5 == NULL || (data == NULL && len > 0)) {
return BAD_FUNC_ARG;
@ -339,7 +338,6 @@ int wc_Md5Update(wc_Md5* md5, const byte* data, word32 len)
AddLength(md5, len);
local = (byte*)md5->buffer;
local32 = md5->buffer;
/* process any remainder from previous operation */
if (md5->buffLen > 0) {
@ -352,7 +350,7 @@ int wc_Md5Update(wc_Md5* md5, const byte* data, word32 len)
if (md5->buffLen == WC_MD5_BLOCK_SIZE) {
#if defined(BIG_ENDIAN_ORDER) && !defined(FREESCALE_MMCAU_SHA)
ByteReverseWords(local32, local32, WC_MD5_BLOCK_SIZE);
ByteReverseWords(md5->buffer, md5->buffer, WC_MD5_BLOCK_SIZE);
#endif
ret = XTRANSFORM(md5, (const byte*)local);
@ -377,6 +375,7 @@ int wc_Md5Update(wc_Md5* md5, const byte* data, word32 len)
}
#else
while (len >= WC_MD5_BLOCK_SIZE) {
word32* local32 = md5->buffer;
/* optimization to avoid memcpy if data pointer is properly aligned */
/* Big Endian requires byte swap, so can't use data directly */
#if defined(WC_HASH_DATA_ALIGNMENT) && !defined(BIG_ENDIAN_ORDER)

View File

@ -489,7 +489,6 @@ int wc_ShaUpdate(wc_Sha* sha, const byte* data, word32 len)
int ret = 0;
word32 blocksLen;
byte* local;
word32* local32;
if (sha == NULL || (data == NULL && len > 0)) {
return BAD_FUNC_ARG;
@ -524,7 +523,6 @@ int wc_ShaUpdate(wc_Sha* sha, const byte* data, word32 len)
AddLength(sha, len);
local = (byte*)sha->buffer;
local32 = sha->buffer;
/* process any remainder from previous operation */
if (sha->buffLen > 0) {
@ -537,7 +535,7 @@ int wc_ShaUpdate(wc_Sha* sha, const byte* data, word32 len)
if (sha->buffLen == WC_SHA_BLOCK_SIZE) {
#if defined(LITTLE_ENDIAN_ORDER) && !defined(FREESCALE_MMCAU_SHA)
ByteReverseWords(local32, local32, WC_SHA_BLOCK_SIZE);
ByteReverseWords(sha->buffer, sha->buffer, WC_SHA_BLOCK_SIZE);
#endif
#if defined(WOLFSSL_ESP32WROOM32_CRYPT) && \
@ -574,6 +572,7 @@ int wc_ShaUpdate(wc_Sha* sha, const byte* data, word32 len)
}
#else
while (len >= WC_SHA_BLOCK_SIZE) {
word32* local32 = sha->buffer;
/* optimization to avoid memcpy if data pointer is properly aligned */
/* Little Endian requires byte swap, so can't use data directly */
#if defined(WC_HASH_DATA_ALIGNMENT) && !defined(LITTLE_ENDIAN_ORDER)

View File

@ -810,8 +810,7 @@ static int InitSha256(wc_Sha256* sha256)
{
int ret = 0;
word32 blocksLen;
byte* local;
word32* local32;
byte* local;
if (sha256 == NULL || (data == NULL && len > 0)) {
return BAD_FUNC_ARG;
@ -831,7 +830,6 @@ static int InitSha256(wc_Sha256* sha256)
AddLength(sha256, len);
local = (byte*)sha256->buffer;
local32 = sha256->buffer;
/* process any remainder from previous operation */
if (sha256->buffLen > 0) {
@ -848,7 +846,8 @@ static int InitSha256(wc_Sha256* sha256)
if (!IS_INTEL_AVX1(intel_flags) && !IS_INTEL_AVX2(intel_flags))
#endif
{
ByteReverseWords(local32, local32, WC_SHA256_BLOCK_SIZE);
ByteReverseWords(sha256->buffer, sha256->buffer,
WC_SHA256_BLOCK_SIZE);
}
#endif
@ -897,6 +896,7 @@ static int InitSha256(wc_Sha256* sha256)
#if !defined(XTRANSFORM_LEN) || defined(HAVE_INTEL_AVX1) || defined(HAVE_INTEL_AVX2)
{
while (len >= WC_SHA256_BLOCK_SIZE) {
word32* local32 = sha256->buffer;
/* optimization to avoid memcpy if data pointer is properly aligned */
/* Intel transform function requires use of sha256->buffer */
/* Little Endian requires byte swap, so can't use data directly */