File tree Expand file tree Collapse file tree 5 files changed +13
-5
lines changed
Expand file tree Collapse file tree 5 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 6969 tests/fuzz/corpus/ \
7070 -dict=tests/fuzz/tpm2.dict \
7171 -max_len=4096 \
72- -timeout=10 \
72+ -timeout=30 \
7373 -rss_limit_mb=2048 \
7474 -print_final_stats=1 \
7575 || FUZZ_RC=$?
Original file line number Diff line number Diff line change @@ -181,6 +181,7 @@ int TPM2_KDFe_ex(
181181 int hashTypeInt ;
182182 enum wc_HashType hashType ;
183183 wc_HashAlg hash_ctx ;
184+ int hashInited = 0 ;
184185 word32 counter = 0 ;
185186 int hLen , copyLen , lLen = 0 ;
186187 byte uint32Buf [sizeof (UINT32 )];
@@ -210,6 +211,7 @@ int TPM2_KDFe_ex(
210211 if (ret != 0 ) {
211212 return ret ;
212213 }
214+ hashInited = 1 ;
213215
214216 for (pos = 0 ; pos < keySz ; pos += hLen ) {
215217 counter ++ ;
@@ -219,10 +221,12 @@ int TPM2_KDFe_ex(
219221 * computed independently: H(counter || Z || label || partyU || partyV) */
220222 if (pos > 0 ) {
221223 wc_HashFree (& hash_ctx , hashType );
224+ hashInited = 0 ;
222225 ret = wc_HashInit (& hash_ctx , hashType );
223226 if (ret != 0 ) {
224227 break ;
225228 }
229+ hashInited = 1 ;
226230 }
227231
228232 /* counter (big-endian) */
@@ -259,7 +263,9 @@ int TPM2_KDFe_ex(
259263 XMEMCPY (key + pos , hash , copyLen );
260264 }
261265
262- wc_HashFree (& hash_ctx , hashType );
266+ if (hashInited ) {
267+ wc_HashFree (& hash_ctx , hashType );
268+ }
263269 TPM2_ForceZero (hash , sizeof (hash ));
264270
265271 if (ret == 0 ) {
Original file line number Diff line number Diff line change 5858#include <netinet/in.h>
5959#include <arpa/inet.h>
6060#endif
61- #ifdef WOLFTPM_SWTPM_UART
61+ #ifndef NO_GETENV
6262#include <stdlib.h>
63+ #endif
64+ #ifdef WOLFTPM_SWTPM_UART
6365#include <fcntl.h>
6466#include <termios.h>
6567#endif
Original file line number Diff line number Diff line change 2929 * CFLAGS="-fsanitize=fuzzer-no-link,address -g" \
3030 * LDFLAGS="-fsanitize=fuzzer,address"
3131 *
32- * Run: ./tests/fuzz/fwtpm_fuzz corpus/ -max_len=4096 -timeout=10
32+ * Run: ./tests/fuzz/fwtpm_fuzz corpus/ -max_len=4096 -timeout=30
3333 */
3434
3535#ifdef HAVE_CONFIG_H
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ check_port_in_use() {
5656 elif netstat -tln 2> /dev/null | grep -q " :${port} " ; then
5757 return 0
5858 fi
59- return 1 # no tool available, assume in use to be safe
59+ return 1 # no tool available, skip this port
6060}
6161
6262# Pick an available random port (returns port on stdout)
You can’t perform that action at this time.
0 commit comments