@@ -4417,7 +4417,7 @@ int wh_Client_Sha256(whClientContext* ctx, wc_Sha256* sha256, const uint8_t* in,
44174417 }
44184418
44194419 /* Process as many full blocks from the input data as we can */
4420- while ((inLen - i ) >= WC_SHA256_BLOCK_SIZE ) {
4420+ while (ret == 0 && (inLen - i ) >= WC_SHA256_BLOCK_SIZE ) {
44214421 memcpy (sha256BufferBytes , in + i , WC_SHA256_BLOCK_SIZE );
44224422 ret = _xferSha256BlockAndUpdateDigest (ctx , sha256 , 0 );
44234423 i += WC_SHA256_BLOCK_SIZE ;
@@ -4433,7 +4433,7 @@ int wh_Client_Sha256(whClientContext* ctx, wc_Sha256* sha256, const uint8_t* in,
44334433
44344434 /* Caller invoked SHA finalize:
44354435 * wc_CryptoCb_Sha256Hash(sha256, NULL, 0, * hash) */
4436- if (out != NULL ) {
4436+ if (ret == 0 && out != NULL ) {
44374437 ret = _xferSha256BlockAndUpdateDigest (ctx , sha256 , 1 );
44384438
44394439 /* Copy out the final hash value */
@@ -4707,7 +4707,7 @@ int wh_Client_Sha224(whClientContext* ctx, wc_Sha224* sha224, const uint8_t* in,
47074707 }
47084708
47094709 /* Process as many full blocks from the input data as we can */
4710- while ((inLen - i ) >= WC_SHA224_BLOCK_SIZE ) {
4710+ while (ret == 0 && (inLen - i ) >= WC_SHA224_BLOCK_SIZE ) {
47114711 memcpy (sha224BufferBytes , in + i , WC_SHA224_BLOCK_SIZE );
47124712 ret = _xferSha224BlockAndUpdateDigest (ctx , sha224 , 0 );
47134713 i += WC_SHA224_BLOCK_SIZE ;
@@ -4723,7 +4723,7 @@ int wh_Client_Sha224(whClientContext* ctx, wc_Sha224* sha224, const uint8_t* in,
47234723
47244724 /* Caller invoked SHA finalize:
47254725 * wc_CryptoCb_Sha224Hash(sha224, NULL, 0, * hash) */
4726- if (out != NULL ) {
4726+ if (ret == 0 && out != NULL ) {
47274727 ret = _xferSha224BlockAndUpdateDigest (ctx , sha224 , 1 );
47284728
47294729 /* Copy out the final hash value */
@@ -4988,7 +4988,7 @@ int wh_Client_Sha384(whClientContext* ctx, wc_Sha384* sha384, const uint8_t* in,
49884988 }
49894989
49904990 /* Process as many full blocks from the input data as we can */
4991- while ((inLen - i ) >= WC_SHA384_BLOCK_SIZE ) {
4991+ while (ret == 0 && (inLen - i ) >= WC_SHA384_BLOCK_SIZE ) {
49924992 memcpy (sha384BufferBytes , in + i , WC_SHA384_BLOCK_SIZE );
49934993 ret = _xferSha384BlockAndUpdateDigest (ctx , sha384 , 0 );
49944994 i += WC_SHA384_BLOCK_SIZE ;
@@ -5004,7 +5004,7 @@ int wh_Client_Sha384(whClientContext* ctx, wc_Sha384* sha384, const uint8_t* in,
50045004
50055005 /* Caller invoked SHA finalize:
50065006 * wc_CryptoCb_Sha384Hash(sha384, NULL, 0, * hash) */
5007- if (out != NULL ) {
5007+ if (ret == 0 && out != NULL ) {
50085008 ret = _xferSha384BlockAndUpdateDigest (ctx , sha384 , 1 );
50095009
50105010 /* Copy out the final hash value */
@@ -5268,7 +5268,7 @@ int wh_Client_Sha512(whClientContext* ctx, wc_Sha512* sha512, const uint8_t* in,
52685268 }
52695269
52705270 /* Process as many full blocks from the input data as we can */
5271- while ((inLen - i ) >= WC_SHA512_BLOCK_SIZE ) {
5271+ while (ret == 0 && (inLen - i ) >= WC_SHA512_BLOCK_SIZE ) {
52725272 memcpy (sha512BufferBytes , in + i , WC_SHA512_BLOCK_SIZE );
52735273 ret = _xferSha512BlockAndUpdateDigest (ctx , sha512 , 0 );
52745274 i += WC_SHA512_BLOCK_SIZE ;
@@ -5284,7 +5284,7 @@ int wh_Client_Sha512(whClientContext* ctx, wc_Sha512* sha512, const uint8_t* in,
52845284
52855285 /* Caller invoked SHA finalize:
52865286 * wc_CryptoCb_Sha512Hash(sha512, NULL, 0, * hash) */
5287- if (out != NULL ) {
5287+ if (ret == 0 && out != NULL ) {
52885288 ret = _xferSha512BlockAndUpdateDigest (ctx , sha512 , 1 );
52895289
52905290 /* Copy out the final hash value */
0 commit comments