From 6ec75388133fb6259f3bd41720c451d2d271048e Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Sun, 2 Nov 2025 20:05:41 -0700 Subject: [PATCH 1/2] fix for checking on if RNG was init'd in test before free'ing it --- test/wh_test_crypto.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/wh_test_crypto.c b/test/wh_test_crypto.c index 35310c6ea..4ea731b56 100644 --- a/test/wh_test_crypto.c +++ b/test/wh_test_crypto.c @@ -3734,6 +3734,7 @@ int whTestCrypto_MlDsaVerifyOnlyDma(whClientContext* ctx, int devId, int whTest_CryptoClientConfig(whClientConfig* config) { int i; + int rngInited = 0; whClientContext client[1] = {0}; int ret = 0; /* wolfcrypt */ @@ -3775,6 +3776,9 @@ int whTest_CryptoClientConfig(whClientConfig* config) if (ret != 0) { WH_ERROR_PRINT("Failed to reinitialize RNG %d\n", ret); } + else { + rngInited = 1; + } } if (ret == 0) { @@ -3935,7 +3939,9 @@ int whTest_CryptoClientConfig(whClientConfig* config) #endif /* WOLFHSM_CFG_TEST_VERBOSE */ /* Clean up used resources */ - (void)wc_FreeRng(rng); + if (rngInited) { + (void)wc_FreeRng(rng); + } (void)wh_Client_CommClose(client); (void)wh_Client_Cleanup(client); From 0816fc1fd67deb2d259c3732cfc1db6877a4bbac Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Mon, 3 Nov 2025 10:01:41 -0700 Subject: [PATCH 2/2] null check on TCP fd parameter before set --- port/posix/posix_transport_tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/port/posix/posix_transport_tcp.c b/port/posix/posix_transport_tcp.c index 2b014954b..1b2247b64 100644 --- a/port/posix/posix_transport_tcp.c +++ b/port/posix/posix_transport_tcp.c @@ -454,7 +454,7 @@ int posixTransportTcp_GetConnectFd(posixTransportTcpClientContext *context, case PTT_STATE_CONNECT_WAIT: case PTT_STATE_CONNECTED: ret = WH_ERROR_OK; - if (*out_fd) { + if (out_fd) { *out_fd = context->connect_fd_p1 - 1; } break;