Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/wh_client_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -4417,7 +4417,7 @@ int wh_Client_Sha256(whClientContext* ctx, wc_Sha256* sha256, const uint8_t* in,
}

/* Process as many full blocks from the input data as we can */
while ((inLen - i) >= WC_SHA256_BLOCK_SIZE) {
while (ret == 0 && (inLen - i) >= WC_SHA256_BLOCK_SIZE) {
memcpy(sha256BufferBytes, in + i, WC_SHA256_BLOCK_SIZE);
ret = _xferSha256BlockAndUpdateDigest(ctx, sha256, 0);
i += WC_SHA256_BLOCK_SIZE;
Expand All @@ -4433,7 +4433,7 @@ int wh_Client_Sha256(whClientContext* ctx, wc_Sha256* sha256, const uint8_t* in,

/* Caller invoked SHA finalize:
* wc_CryptoCb_Sha256Hash(sha256, NULL, 0, * hash) */
if (out != NULL) {
if (ret == 0 && out != NULL) {
ret = _xferSha256BlockAndUpdateDigest(ctx, sha256, 1);

/* Copy out the final hash value */
Expand Down Expand Up @@ -4707,7 +4707,7 @@ int wh_Client_Sha224(whClientContext* ctx, wc_Sha224* sha224, const uint8_t* in,
}

/* Process as many full blocks from the input data as we can */
while ((inLen - i) >= WC_SHA224_BLOCK_SIZE) {
while (ret == 0 && (inLen - i) >= WC_SHA224_BLOCK_SIZE) {
memcpy(sha224BufferBytes, in + i, WC_SHA224_BLOCK_SIZE);
ret = _xferSha224BlockAndUpdateDigest(ctx, sha224, 0);
i += WC_SHA224_BLOCK_SIZE;
Expand All @@ -4723,7 +4723,7 @@ int wh_Client_Sha224(whClientContext* ctx, wc_Sha224* sha224, const uint8_t* in,

/* Caller invoked SHA finalize:
* wc_CryptoCb_Sha224Hash(sha224, NULL, 0, * hash) */
if (out != NULL) {
if (ret == 0 && out != NULL) {
ret = _xferSha224BlockAndUpdateDigest(ctx, sha224, 1);

/* Copy out the final hash value */
Expand Down Expand Up @@ -4988,7 +4988,7 @@ int wh_Client_Sha384(whClientContext* ctx, wc_Sha384* sha384, const uint8_t* in,
}

/* Process as many full blocks from the input data as we can */
while ((inLen - i) >= WC_SHA384_BLOCK_SIZE) {
while (ret == 0 && (inLen - i) >= WC_SHA384_BLOCK_SIZE) {
memcpy(sha384BufferBytes, in + i, WC_SHA384_BLOCK_SIZE);
ret = _xferSha384BlockAndUpdateDigest(ctx, sha384, 0);
i += WC_SHA384_BLOCK_SIZE;
Expand All @@ -5004,7 +5004,7 @@ int wh_Client_Sha384(whClientContext* ctx, wc_Sha384* sha384, const uint8_t* in,

/* Caller invoked SHA finalize:
* wc_CryptoCb_Sha384Hash(sha384, NULL, 0, * hash) */
if (out != NULL) {
if (ret == 0 && out != NULL) {
ret = _xferSha384BlockAndUpdateDigest(ctx, sha384, 1);

/* Copy out the final hash value */
Expand Down Expand Up @@ -5268,7 +5268,7 @@ int wh_Client_Sha512(whClientContext* ctx, wc_Sha512* sha512, const uint8_t* in,
}

/* Process as many full blocks from the input data as we can */
while ((inLen - i) >= WC_SHA512_BLOCK_SIZE) {
while (ret == 0 && (inLen - i) >= WC_SHA512_BLOCK_SIZE) {
memcpy(sha512BufferBytes, in + i, WC_SHA512_BLOCK_SIZE);
ret = _xferSha512BlockAndUpdateDigest(ctx, sha512, 0);
i += WC_SHA512_BLOCK_SIZE;
Expand All @@ -5284,7 +5284,7 @@ int wh_Client_Sha512(whClientContext* ctx, wc_Sha512* sha512, const uint8_t* in,

/* Caller invoked SHA finalize:
* wc_CryptoCb_Sha512Hash(sha512, NULL, 0, * hash) */
if (out != NULL) {
if (ret == 0 && out != NULL) {
ret = _xferSha512BlockAndUpdateDigest(ctx, sha512, 1);

/* Copy out the final hash value */
Expand Down
Loading