Skip to content

Commit 3558e49

Browse files
committed
Wdeclaration-after-statement fixes
1 parent 0507f33 commit 3558e49

53 files changed

Lines changed: 1586 additions & 1277 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

benchmark/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ARCHFLAGS ?=
4040
# Enable extra C compiler warnings
4141
CFLAGS_EXTRA = -Werror -Wall -Wextra
4242
# Place functions / data into separate sections to allow unused code removal
43-
CFLAGS_EXTRA += -ffunction-sections -fdata-sections
43+
CFLAGS_EXTRA += -ffunction-sections -fdata-sections -Wdeclaration-after-statement
4444

4545
# C standard to use (default to c90 if not specified)
4646
CSTD ?= -std=c90

benchmark/bench_modules/wh_bench_mod_curve25519.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@ uint8_t key2_der[] = {
5252
int wh_Bench_Mod_Curve25519KeyGen(whClientContext* client,
5353
whBenchOpContext* ctx, int id, void* params)
5454
{
55-
(void)client;
56-
(void)params;
57-
5855
int ret = 0;
5956
curve25519_key key[1] = {0};
6057
WC_RNG rng[1] = {0};
6158
int i;
6259
int initialized_rng = 0;
6360
int initialized_key = 0;
6461

62+
(void)client;
63+
(void)params;
64+
6565
/* Initialize the RNG for key generation */
6666
ret = wc_InitRng_ex(rng, NULL, WH_DEV_ID);
6767
if (ret != 0) {
@@ -126,8 +126,6 @@ int wh_Bench_Mod_Curve25519SharedSecret(whClientContext* client,
126126
whBenchOpContext* ctx, int id,
127127
void* params)
128128
{
129-
(void)params;
130-
131129
int ret = 0;
132130
word32 outLen;
133131
curve25519_key keyAlice[1] = {0};
@@ -140,6 +138,8 @@ int wh_Bench_Mod_Curve25519SharedSecret(whClientContext* client,
140138
whKeyId keyIdBob = WH_KEYID_ERASED;
141139
char keyLabel[] = "bench-key";
142140

141+
(void)params;
142+
143143
/* Cache Alice's key in the HSM */
144144
ret = wh_Client_KeyCache(client, WH_NVM_FLAGS_USAGE_ANY, (uint8_t*)keyLabel,
145145
strlen(keyLabel), key1_der, sizeof(key1_der),

benchmark/bench_modules/wh_bench_mod_ecc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,15 @@ int _benchEccVerify(whClientContext* client, whBenchOpContext* ctx, int id,
293293
int _benchEccKeyGen(whClientContext* client, whBenchOpContext* ctx, int id,
294294
int curveSize, int devId)
295295
{
296-
(void)client;
297-
298296
int ret = 0;
299297
ecc_key key[1] = {0};
300298
WC_RNG rng[1] = {0};
301299
int i;
302300
int initialized_rng = 0;
303301
int initialized_key = 0;
304302

303+
(void)client;
304+
305305
/* Initialize the RNG for key generation */
306306
ret = wc_InitRng_ex(rng, NULL, devId);
307307
if (ret != 0) {

benchmark/bench_modules/wh_bench_mod_echo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
int wh_Bench_Mod_Echo(whClientContext* client, whBenchOpContext* benchCtx,
2626
int id, void* params)
2727
{
28-
(void)params;
29-
3028
int i;
3129
int ret;
3230
uint16_t send_len;
@@ -36,6 +34,8 @@ int wh_Bench_Mod_Echo(whClientContext* client, whBenchOpContext* benchCtx,
3634
int startRet;
3735
int stopRet;
3836

37+
(void)params;
38+
3939
/* Send an entire comm buffer's worth of data */
4040
memset(send_buffer, 0xAA, sizeof(send_buffer));
4141
memset(recv_buffer, 0x55, sizeof(recv_buffer));

benchmark/bench_modules/wh_bench_mod_hmac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ static const size_t keyLen = sizeof(key) - 1; /* -1 for null terminator */
3434
int _benchHmacSha256(whClientContext* client, whBenchOpContext* ctx, int id,
3535
int devId)
3636
{
37-
(void)client;
38-
3937
int ret = 0;
4038
Hmac hmac[1];
4139
uint8_t out[WC_SHA256_DIGEST_SIZE];
@@ -44,6 +42,8 @@ int _benchHmacSha256(whClientContext* client, whBenchOpContext* ctx, int id,
4442
const uint8_t* in;
4543
size_t inLen;
4644

45+
(void)client;
46+
4747
#if defined(WOLFHSM_CFG_DMA)
4848
if (devId == WH_DEV_ID_DMA) {
4949
in = WH_BENCH_DMA_BUFFER;

benchmark/bench_modules/wh_bench_mod_mldsa.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,15 +898,15 @@ static int _benchMlDsaVerify(whClientContext* client, whBenchOpContext* ctx,
898898
static int _benchMlDsaKeyGen(whClientContext* client, whBenchOpContext* ctx,
899899
int id, int securityLevel, int devId)
900900
{
901-
(void)client;
902-
903901
int ret = 0;
904902
MlDsaKey key;
905903
WC_RNG rng[1] = {0};
906904
int i;
907905
int initialized_rng = 0;
908906
int initialized_key = 0;
909907

908+
(void)client;
909+
910910
/* Initialize the RNG */
911911
ret = wc_InitRng_ex(rng, NULL, devId);
912912
if (ret != 0) {

benchmark/bench_modules/wh_bench_mod_rng.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727

2828
int _benchRng(whClientContext* client, whBenchOpContext* ctx, int id, int devId)
2929
{
30-
(void)client;
31-
3230
int ret = 0;
3331
WC_RNG rng;
3432
int i = 0;
3533
int rngInitialized = 0;
3634
uint8_t* out = WH_BENCH_DATA_OUT_BUFFER;
3735
word32 outLen = WOLFHSM_CFG_BENCH_DATA_BUFFER_SIZE;
3836

37+
(void)client;
38+
3939
ret = wc_InitRng_ex(&rng, NULL, devId);
4040
if (ret != 0) {
4141
WH_BENCH_PRINTF("Failed to wc_InitRng_ex %d\n", ret);

benchmark/bench_modules/wh_bench_mod_rsa.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,6 @@ int _benchRsaSign(whClientContext* client, whBenchOpContext* ctx, int id,
696696
int _benchRsaKeyGen(whClientContext* client, whBenchOpContext* ctx, int id,
697697
int keySize, int devId)
698698
{
699-
(void)client;
700-
701699
int ret = 0;
702700
RsaKey rsa[1];
703701
WC_RNG rng[1];
@@ -706,6 +704,8 @@ int _benchRsaKeyGen(whClientContext* client, whBenchOpContext* ctx, int id,
706704
int initialized_rsa = 0;
707705
long exponent = WC_RSA_EXPONENT; /* Standard RSA exponent (65537) */
708706

707+
(void)client;
708+
709709
/* Initialize RNG for RSA operations */
710710
ret = wc_InitRng_ex(rng, NULL, devId);
711711
if (ret != 0) {

benchmark/bench_modules/wh_bench_mod_sha2.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
int _benchSha256(whClientContext* client, whBenchOpContext* ctx, int id,
3535
int devId)
3636
{
37-
(void)client;
38-
3937
int ret = 0;
4038
wc_Sha256* sha256 = NULL;
4139
wc_Sha256 sha256Stack;
@@ -46,6 +44,8 @@ int _benchSha256(whClientContext* client, whBenchOpContext* ctx, int id,
4644
const uint8_t* in;
4745
size_t inLen;
4846

47+
(void)client;
48+
4949
sha256 = &sha256Stack;
5050
out = outStack;
5151

@@ -192,8 +192,6 @@ int wh_Bench_Mod_Sha256Dma(whClientContext* client, whBenchOpContext* ctx,
192192
int _benchSha224(whClientContext* client, whBenchOpContext* ctx, int id,
193193
int devId)
194194
{
195-
(void)client;
196-
197195
int ret = 0;
198196
wc_Sha224 sha224[1];
199197
uint8_t out[WC_SHA224_DIGEST_SIZE];
@@ -202,6 +200,8 @@ int _benchSha224(whClientContext* client, whBenchOpContext* ctx, int id,
202200
const uint8_t* in;
203201
size_t inLen;
204202

203+
(void)client;
204+
205205
#if defined(WOLFHSM_CFG_DMA)
206206
if (devId == WH_DEV_ID_DMA) {
207207
in = WH_BENCH_DMA_BUFFER;
@@ -313,8 +313,6 @@ int wh_Bench_Mod_Sha224Dma(whClientContext* client, whBenchOpContext* ctx,
313313
int _benchSha384(whClientContext* client, whBenchOpContext* ctx, int id,
314314
int devId)
315315
{
316-
(void)client;
317-
318316
int ret = 0;
319317
wc_Sha384 sha384[1];
320318
uint8_t out[WC_SHA384_DIGEST_SIZE];
@@ -323,6 +321,8 @@ int _benchSha384(whClientContext* client, whBenchOpContext* ctx, int id,
323321
const uint8_t* in;
324322
size_t inLen;
325323

324+
(void)client;
325+
326326
#if defined(WOLFHSM_CFG_DMA)
327327
if (devId == WH_DEV_ID_DMA) {
328328
in = WH_BENCH_DMA_BUFFER;
@@ -433,8 +433,6 @@ int wh_Bench_Mod_Sha384Dma(whClientContext* client, whBenchOpContext* ctx,
433433
int _benchSha512(whClientContext* client, whBenchOpContext* ctx, int id,
434434
int devId)
435435
{
436-
(void)client;
437-
438436
int ret = 0;
439437
wc_Sha512 sha512[1];
440438
uint8_t out[WC_SHA512_DIGEST_SIZE];
@@ -443,6 +441,8 @@ int _benchSha512(whClientContext* client, whBenchOpContext* ctx, int id,
443441
const uint8_t* in;
444442
size_t inLen;
445443

444+
(void)client;
445+
446446
#if defined(WOLFHSM_CFG_DMA)
447447
if (devId == WH_DEV_ID_DMA) {
448448
in = WH_BENCH_DMA_BUFFER;

benchmark/wh_bench.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,19 +1029,6 @@ int wh_Bench_ClientServer_Posix(int transport, int moduleIndex)
10291029
/* Server configuration/contexts */
10301030
whServerConfig s_conf[1] = {{0}};
10311031

1032-
/* Configure transport based on type */
1033-
ret = _configureClientTransport(transport, c_conf);
1034-
if (ret != WH_ERROR_OK) {
1035-
WH_BENCH_PRINTF("Failed to configure client transport: %d\n", ret);
1036-
return ret;
1037-
}
1038-
1039-
ret = _configureServerTransport(transport, s_conf);
1040-
if (ret != WH_ERROR_OK) {
1041-
WH_BENCH_PRINTF("Failed to configure server transport: %d\n", ret);
1042-
return ret;
1043-
}
1044-
10451032
/* RamSim Flash state and configuration */
10461033
whFlashRamsimCtx fc[1] = {0};
10471034
whFlashRamsimCfg fc_conf[1] = {{
@@ -1074,6 +1061,19 @@ int wh_Bench_ClientServer_Posix(int transport, int moduleIndex)
10741061
whServerCryptoContext crypto[1] = {0};
10751062
#endif
10761063

1064+
/* Configure transport based on type */
1065+
ret = _configureClientTransport(transport, c_conf);
1066+
if (ret != WH_ERROR_OK) {
1067+
WH_BENCH_PRINTF("Failed to configure client transport: %d\n", ret);
1068+
return ret;
1069+
}
1070+
1071+
ret = _configureServerTransport(transport, s_conf);
1072+
if (ret != WH_ERROR_OK) {
1073+
WH_BENCH_PRINTF("Failed to configure server transport: %d\n", ret);
1074+
return ret;
1075+
}
1076+
10771077
/* Set up server configuration with NVM and crypto */
10781078
s_conf[0].nvm = nvm;
10791079
#ifndef WOLFHSM_CFG_NO_CRYPTO

0 commit comments

Comments
 (0)