Skip to content

Commit 3699d72

Browse files
fix typo in benchmark printf and run git-clang-format
1 parent 66bb141 commit 3699d72

File tree

12 files changed

+48
-50
lines changed

12 files changed

+48
-50
lines changed

benchmark/bench_modules/wh_bench_mod_sha2.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ int _benchSha256(whClientContext* client, whBenchOpContext* ctx, int id,
5555
inLen = WOLFHSM_CFG_BENCH_DMA_BUFFER_SIZE;
5656
if (ctx->transportType == WH_BENCH_TRANSPORT_POSIX_DMA) {
5757
/* if static memory was used with DMA then use XMALLOC */
58-
void* heap = posixTransportShm_GetDmaHeap(client->comm->transport_context);
59-
in = XMALLOC(inLen, heap, DYNAMIC_TYPE_TMP_BUFFER);
58+
void* heap =
59+
posixTransportShm_GetDmaHeap(client->comm->transport_context);
60+
in = XMALLOC(inLen, heap, DYNAMIC_TYPE_TMP_BUFFER);
6061
if (in == NULL) {
6162
WH_BENCH_PRINTF("Failed to allocate memory for DMA\n");
6263
return WH_ERROR_NOSPACE;
@@ -141,7 +142,8 @@ int _benchSha256(whClientContext* client, whBenchOpContext* ctx, int id,
141142
if (devId == WH_DEV_ID_DMA &&
142143
ctx->transportType == WH_BENCH_TRANSPORT_POSIX_DMA) {
143144
/* if static memory was used with DMA then use XFREE */
144-
void* heap = posixTransportShm_GetDmaHeap(client->comm->transport_context);
145+
void* heap =
146+
posixTransportShm_GetDmaHeap(client->comm->transport_context);
145147
XFREE((uint8_t*)in, heap, DYNAMIC_TYPE_TMP_BUFFER);
146148
XFREE(out, heap, DYNAMIC_TYPE_TMP_BUFFER);
147149
}

benchmark/wh_bench.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ int wh_Bench_ClientCfg(whClientConfig* clientCfg, int transport)
582582
return ret;
583583
}
584584
ret = posixTransportShm_SetDmaHeap(clientCfg->comm->transport_context,
585-
(void*)heap);
585+
(void*)heap);
586586
if (ret != 0) {
587587
WH_BENCH_PRINTF("Failed to set heap: %d\n", ret);
588588
return ret;
@@ -826,8 +826,7 @@ static int _configureClientTransport(whBenchTransportType transport,
826826
case WH_BENCH_TRANSPORT_POSIX_DMA: {
827827
static whClientDmaConfig dmaConfig;
828828

829-
dmaConfig.cb =
830-
posixTransportShm_ClientStaticMemDmaCallback;
829+
dmaConfig.cb = posixTransportShm_ClientStaticMemDmaCallback;
831830
dmaConfig.dmaAddrAllowList = NULL;
832831
c_conf->dmaConfig = &dmaConfig;
833832
};
@@ -902,8 +901,7 @@ static int _configureServerTransport(whBenchTransportType transport,
902901
case WH_BENCH_TRANSPORT_POSIX_DMA: {
903902
static whServerDmaConfig dmaConfig;
904903

905-
dmaConfig.cb =
906-
posixTransportShm_ServerStaticMemDmaCallback;
904+
dmaConfig.cb = posixTransportShm_ServerStaticMemDmaCallback;
907905
dmaConfig.dmaAddrAllowList = NULL;
908906
s_conf->dmaConfig = &dmaConfig;
909907
};

benchmark/wh_bench_ops.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ typedef enum {
4040
/* Transport type enumeration for benchmark testing */
4141
typedef enum {
4242
WH_BENCH_TRANSPORT_MEM =
43-
0, /* Memory transport (WH_TRANSPORT_MEM_CLIENT_CB) */
43+
0, /* Memory transport (WH_TRANSPORT_MEM_CLIENT_CB) */
4444
WH_BENCH_TRANSPORT_POSIX_SHM, /* Shared memory transport
4545
(POSIX_TRANSPORT_SHM_CLIENT_CB) */
4646
WH_BENCH_TRANSPORT_POSIX_TCP, /* TCP transport (PTT_CLIENT_CB) */
47-
WH_BENCH_TRANSPORT_POSIX_DMA, /* DMA transport (POSIX_TRANSPORT_REF_CLIENT_CB) */
47+
WH_BENCH_TRANSPORT_POSIX_DMA, /* DMA transport
48+
(POSIX_TRANSPORT_REF_CLIENT_CB) */
4849
} whBenchTransportType;
4950

5051
typedef struct whBenchOp {

examples/posix/wh_posix_client/wh_posix_client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static int wh_ClientTask(void* cf, const char* type, int test)
100100
ret = wh_Client_EchoRequest(client, tx_req_len, tx_req);
101101
if (ret != WH_ERROR_NOTREADY) {
102102
if (ret != 0) {
103-
printf("wh_CLient_EchoRequest failed with ret=%d\n", ret);
103+
printf("wh_Client_EchoRequest failed with ret=%d\n", ret);
104104
}
105105
}
106106
_sleepMs(ONE_MS);

examples/posix/wh_posix_server/user_settings.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ extern "C" {
183183
#define WOLFSSL_NO_MALLOC
184184
#if 1
185185
#define WOLFSSL_MALLOC_CHECK /* trap malloc failure */
186-
#endif /* optional malloc check */
187-
#endif /* optional static memory */
186+
#endif /* optional malloc check */
187+
#endif /* optional static memory */
188188

189189
#ifdef WOLFHSM_CFG_DMA
190190
#undef WOLFSSL_STATIC_MEMORY

port/posix/posix_transport_shm.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -549,9 +549,9 @@ int posixTransportShm_RecvResponse(void* c, uint16_t* out_len, void* data)
549549
* the POSIX shared memory transport.
550550
*/
551551

552-
int posixTransportShm_ClientStaticMemDmaCallback(struct whClientContext_t* client,
553-
uintptr_t clientAddr, void** xformedCliAddr,
554-
size_t len, whDmaOper oper, whDmaFlags flags)
552+
int posixTransportShm_ClientStaticMemDmaCallback(
553+
struct whClientContext_t* client, uintptr_t clientAddr,
554+
void** xformedCliAddr, size_t len, whDmaOper oper, whDmaFlags flags)
555555
{
556556
int ret = WH_ERROR_OK;
557557
int isInDma = 0;
@@ -686,10 +686,9 @@ int posixTransportShm_RecvRequest(void* c, uint16_t* out_len, void* data)
686686
/* Generic offset into the DMA area. This function can operate with no knowledge
687687
* of what structures the DMA area is. It takes in an offset, validates it, and
688688
* returns the pointer into the DMA area based off of the offset. */
689-
int posixTransportShm_ServerStaticMemDmaCallback(whServerContext* server,
690-
uintptr_t clientAddr, void** xformedCliAddr,
691-
size_t len, whServerDmaOper oper,
692-
whServerDmaFlags flags)
689+
int posixTransportShm_ServerStaticMemDmaCallback(
690+
whServerContext* server, uintptr_t clientAddr, void** xformedCliAddr,
691+
size_t len, whServerDmaOper oper, whServerDmaFlags flags)
693692
{
694693
posixTransportShmContext* ctx;
695694
void* dma_ptr;
@@ -731,8 +730,7 @@ int posixTransportShm_ServerStaticMemDmaCallback(whServerContext* server,
731730
#endif /* WOLFHSM_CFG_ENABLE_SERVER */
732731

733732
#if defined(WOLFHSM_CFG_DMA)
734-
int posixTransportShm_SetDmaHeap(posixTransportShmContext* ctx,
735-
void* heap)
733+
int posixTransportShm_SetDmaHeap(posixTransportShmContext* ctx, void* heap)
736734
{
737735
if (ctx == NULL) {
738736
return WH_ERROR_BADARGS;

port/posix/posix_transport_shm.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ int posixTransportShm_GetDma(posixTransportShmContext* ctx,
117117
* @return int Returns WH_ERROR_OK on success, or WH_ERROR_BADARGS if the
118118
* arguments are invalid.
119119
*/
120-
int posixTransportShm_SetDmaHeap(posixTransportShmContext* ctx,
121-
void* heap);
120+
int posixTransportShm_SetDmaHeap(posixTransportShmContext* ctx, void* heap);
122121

123122
/**
124123
* @brief Getter function for the current heap hint
@@ -128,7 +127,7 @@ int posixTransportShm_SetDmaHeap(posixTransportShmContext* ctx,
128127
*
129128
* @param[in] ctx Pointer to the transport context.
130129
* @return a pointer to the heap hint
131-
*/
130+
*/
132131
void* posixTransportShm_GetDmaHeap(posixTransportShmContext* ctx);
133132

134133

@@ -167,16 +166,16 @@ int posixTransportShm_RecvResponse(void* c, uint16_t* out_len, void* data);
167166
#include "wolfhsm/wh_dma.h"
168167

169168
#include "wolfhsm/wh_server.h"
170-
int posixTransportShm_ServerStaticMemDmaCallback(whServerContext* server,
171-
uintptr_t clientAddr, void** xformedCliAddr,
172-
size_t len, whServerDmaOper oper,
173-
whServerDmaFlags flags);
169+
int posixTransportShm_ServerStaticMemDmaCallback(
170+
whServerContext* server, uintptr_t clientAddr, void** xformedCliAddr,
171+
size_t len, whServerDmaOper oper, whServerDmaFlags flags);
174172

175173
#include "wolfhsm/wh_client.h"
176174
int posixTransportShm_ClientStaticMemDmaCallback(whClientContext* client,
177-
uintptr_t clientAddr, void** xformedCliAddr,
178-
size_t len, whDmaOper oper,
179-
whDmaFlags flags);
175+
uintptr_t clientAddr,
176+
void** xformedCliAddr,
177+
size_t len, whDmaOper oper,
178+
whDmaFlags flags);
180179

181180
#endif
182181
#endif /* !PORT_POSIX_POSIX_TRANSPORT_SHM_H_ */

src/wh_client_dma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ int wh_Client_DmaProcessClientAddress(whClientContext* client,
8989

9090
/* if the client has a allowlist registered, check address against it */
9191
if (rc == WH_ERROR_OK && len > 0) {
92-
rc = wh_Dma_CheckMemOperAgainstAllowList(client->dma.dmaAddrAllowList, oper,
93-
*xformedCliAddr, len);
92+
rc = wh_Dma_CheckMemOperAgainstAllowList(client->dma.dmaAddrAllowList,
93+
oper, *xformedCliAddr, len);
9494
}
9595
return rc;
9696
}

src/wh_dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static int _checkMemOperAgainstAllowList(const whDmaAddrAllowList* allowlist,
110110

111111

112112
int wh_Dma_CheckMemOperAgainstAllowList(const whDmaAddrAllowList* allowlist,
113-
whDmaOper oper, void* addr, size_t size)
113+
whDmaOper oper, void* addr, size_t size)
114114
{
115115
if (0 == size) {
116116
return WH_ERROR_BADARGS;

src/wh_server_crypto.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2908,7 +2908,7 @@ int wh_Server_HandleCryptoRequest(whServerContext* ctx, uint16_t magic,
29082908

29092909
/* Propagate error code to client in response packet header. Crypto handlers
29102910
* have already populated the response packet with the output data. */
2911-
respHeader.rc = ret;
2911+
respHeader.rc = ret;
29122912
respHeader.algoType = rqstHeader.algoType;
29132913
wh_MessageCrypto_TranslateGenericResponseHeader(
29142914
magic, &respHeader,
@@ -2946,11 +2946,11 @@ static int _HandleSha256Dma(whServerContext* ctx, uint16_t magic, uint16_t seq,
29462946
(void)seq;
29472947
(void)inSize;
29482948

2949-
int ret = 0;
2950-
whMessageCrypto_Sha2DmaRequest req;
2951-
whMessageCrypto_Sha2DmaResponse res;
2952-
wc_Sha256 sha256[1];
2953-
int clientDevId;
2949+
int ret = 0;
2950+
whMessageCrypto_Sha2DmaRequest req;
2951+
whMessageCrypto_Sha2DmaResponse res;
2952+
wc_Sha256 sha256[1];
2953+
int clientDevId;
29542954

29552955
/* Translate the request */
29562956
ret = wh_MessageCrypto_TranslateSha2DmaRequest(

0 commit comments

Comments
 (0)