We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d111d7d commit 83169f9Copy full SHA for 83169f9
1 file changed
wolfcrypt/src/sha.c
@@ -841,7 +841,10 @@ int wc_ShaFinal(wc_Sha* sha, byte* hash)
841
842
/* pad with zeros */
843
if (sha->buffLen > WC_SHA_PAD_SIZE) {
844
- XMEMSET(&local[sha->buffLen], 0, WC_SHA_BLOCK_SIZE - sha->buffLen);
+ if (sha->buffLen < WC_SHA_BLOCK_SIZE) {
845
+ XMEMSET(&local[sha->buffLen], 0, WC_SHA_BLOCK_SIZE - sha->buffLen);
846
+ }
847
+
848
sha->buffLen += WC_SHA_BLOCK_SIZE - sha->buffLen;
849
850
#if defined(WOLFSSL_USE_ESP32_CRYPT_HASH_HW)
0 commit comments