Skip to content

Commit 343d72b

Browse files
committed
Fix static-analyizer warnings
Initialize the key wrap structs to 0. Also make the clang-tidy-builder.sh user executable to make it easier to run locally
1 parent f287f2b commit 343d72b

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/wh_server_keystore.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,8 +1181,8 @@ int wh_Server_HandleKeyRequest(whServerContext* server, uint16_t magic,
11811181
}
11821182
} break;
11831183
case WH_KEY_WRAP: {
1184-
whMessageKeystore_WrapRequest wrapReq;
1185-
whMessageKeystore_WrapResponse wrapResp;
1184+
whMessageKeystore_WrapRequest wrapReq = {0};
1185+
whMessageKeystore_WrapResponse wrapResp = {0};
11861186
uint8_t* reqData;
11871187
uint8_t* respData;
11881188
uint32_t reqDataSz = WOLFHSM_CFG_COMM_DATA_LEN - sizeof(wrapReq);
@@ -1217,8 +1217,8 @@ int wh_Server_HandleKeyRequest(whServerContext* server, uint16_t magic,
12171217
} break;
12181218

12191219
case WH_KEY_UNWRAPEXPORT: {
1220-
whMessageKeystore_UnwrapAndExportRequest unwrapReq;
1221-
whMessageKeystore_UnwrapAndExportResponse unwrapResp;
1220+
whMessageKeystore_UnwrapAndExportRequest unwrapReq = {0};
1221+
whMessageKeystore_UnwrapAndExportResponse unwrapResp = {0};
12221222
uint8_t* reqData;
12231223
uint8_t* respData;
12241224
uint32_t reqDataSz = WOLFHSM_CFG_COMM_DATA_LEN - sizeof(unwrapReq);
@@ -1255,8 +1255,8 @@ int wh_Server_HandleKeyRequest(whServerContext* server, uint16_t magic,
12551255
} break;
12561256

12571257
case WH_KEY_UNWRAPCACHE: {
1258-
whMessageKeystore_UnwrapAndCacheRequest cacheReq;
1259-
whMessageKeystore_UnwrapAndCacheResponse cacheResp;
1258+
whMessageKeystore_UnwrapAndCacheRequest cacheReq = {0};
1259+
whMessageKeystore_UnwrapAndCacheResponse cacheResp = {0};
12601260
uint8_t* reqData;
12611261
uint8_t* respData;
12621262
uint32_t reqDataSz = WOLFHSM_CFG_COMM_DATA_LEN - sizeof(cacheReq);

test/wh_test_keywrap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929

3030
#include "wolfhsm/wh_error.h"
3131

32+
#ifndef WOLFHSM_CFG_NO_CRYPTO
33+
3234
#ifdef WOLFHSM_CFG_ENABLE_CLIENT
3335
#include "wolfhsm/wh_client.h"
3436
#include "wolfhsm/wh_client_crypto.h"
@@ -200,5 +202,4 @@ int whTest_KeyWrapClientConfig(whClientConfig* config)
200202
return ret;
201203
}
202204
#endif /* WOLFHSM_CFG_ENABLE_CLIENT */
203-
204205
#endif /* !WOLFHSM_CFG_NO_CRYPTO */

tools/static-analysis/clang-tidy-builder.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)