Allow zero length inputs to _wc_Hash_Grow to be a succesful no-op

Added '--enable-all CPPFLAGS=-DWOLFSSL_HASH_KEEP' to the make_check matrix in os-check.yml.
This commit is contained in:
night1rider
2026-03-20 13:48:14 -06:00
parent 994a1fbacc
commit 5b3750c39f
2 changed files with 7 additions and 1 deletions
+1
View File
@@ -98,6 +98,7 @@ jobs:
'--enable-curve25519=nonblock --enable-ecc=nonblock --enable-sp=yes,nonblock CPPFLAGS="-DWOLFSSL_PUBLIC_MP -DWOLFSSL_DEBUG_NONBLOCK"',
'--enable-certreq --enable-certext --enable-certgen --disable-secure-renegotiation-info CPPFLAGS="-DNO_TLS"',
'--enable-ocsp --enable-ocsp-responder --enable-ocspstapling CPPFLAGS="-DWOLFSSL_NONBLOCK_OCSP" --enable-maxfragment',
'--enable-all CPPFLAGS=-DWOLFSSL_HASH_KEEP',
]
name: make check
if: github.repository_owner == 'wolfssl'
+6 -1
View File
@@ -1956,9 +1956,14 @@ int _wc_Hash_Grow(byte** msg, word32* used, word32* len, const byte* in,
{
word32 usedSz = 0;
if (inSz <= 0 || !WC_SAFE_SUM_WORD32(*used, (word32)inSz, usedSz))
if (inSz < 0 || !WC_SAFE_SUM_WORD32(*used, (word32)inSz, usedSz))
return BAD_FUNC_ARG;
/* Allow zero-length input as a no-op. Some callers may pass zero-length
* data during hash operations and this should not be treated as an error. */
if (inSz == 0)
return 0;
if (*len < usedSz) {
if (*msg == NULL) {
*msg = (byte*)XMALLOC(usedSz, heap, DYNAMIC_TYPE_TMP_BUFFER);