SHA 256,512: Only write hash if no error has occurred

ZD 11649
This commit is contained in:
Guido Vranken
2021-02-06 08:15:30 +01:00
parent 714aa97490
commit 3fd2647383
2 changed files with 2 additions and 2 deletions

View File

@@ -1094,7 +1094,7 @@ static int InitSha256(wc_Sha256* sha256)
#endif
/* save remainder */
if (len > 0) {
if (ret == 0 && len > 0) {
XMEMCPY(local, data, len);
sha256->buffLen = len;
}

View File

@@ -717,7 +717,7 @@ static WC_INLINE int Sha512Update(wc_Sha512* sha512, const byte* data, word32 le
}
#endif
if (len > 0) {
if (ret == 0 && len > 0) {
XMEMCPY(local, data, len);
sha512->buffLen = len;
}