Skip to content

Commit 1c2293d

Browse files
run git-clang-format
1 parent 577a46b commit 1c2293d

File tree

3 files changed

+49
-49
lines changed

3 files changed

+49
-49
lines changed

benchmark/bench_modules/wh_bench_mod_cmac.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ int _benchCmacAes(whClientContext* client, whBenchOpContext* ctx, int id,
6969
inLen = WOLFHSM_CFG_BENCH_DMA_BUFFER_SIZE;
7070
if (ctx->transportType == WH_BENCH_TRANSPORT_POSIX_DMA) {
7171
/* if static memory was used with DMA then use XMALLOC */
72-
void* heap = posixTransportShm_GetDmaHeap(
73-
client->comm->transport_context);
72+
void* heap =
73+
posixTransportShm_GetDmaHeap(client->comm->transport_context);
7474
in = (uint8_t*)XMALLOC(inLen, heap, DYNAMIC_TYPE_TMP_BUFFER);
7575
if (in == NULL) {
7676
WH_BENCH_PRINTF("Failed to allocate memory for DMA\n");
7777
return WH_ERROR_NOSPACE;
7878
}
7979
out = (uint8_t*)XMALLOC(WC_CMAC_TAG_MAX_SZ, heap,
80-
DYNAMIC_TYPE_TMP_BUFFER);
80+
DYNAMIC_TYPE_TMP_BUFFER);
8181
if (out == NULL) {
8282
WH_BENCH_PRINTF("Failed to allocate memory for DMA\n");
8383
return WH_ERROR_NOSPACE;
@@ -160,8 +160,8 @@ int _benchCmacAes(whClientContext* client, whBenchOpContext* ctx, int id,
160160
if (devId == WH_DEV_ID_DMA &&
161161
ctx->transportType == WH_BENCH_TRANSPORT_POSIX_DMA) {
162162
/* if static memory was used with DMA then use XFREE */
163-
void* heap = posixTransportShm_GetDmaHeap(
164-
client->comm->transport_context);
163+
void* heap =
164+
posixTransportShm_GetDmaHeap(client->comm->transport_context);
165165
XFREE(in, heap, DYNAMIC_TYPE_TMP_BUFFER);
166166
XFREE(out, heap, DYNAMIC_TYPE_TMP_BUFFER);
167167
}

src/wh_client.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,9 +1336,9 @@ int wh_Client_KeyCacheDmaRequest(whClientContext* c, uint32_t flags,
13361336
const void* keyAddr, uint16_t keySz,
13371337
uint16_t keyId)
13381338
{
1339-
int ret;
1339+
int ret;
13401340
whMessageKeystore_CacheDmaRequest* req = NULL;
1341-
uintptr_t keyAddrPtr = 0;
1341+
uintptr_t keyAddrPtr = 0;
13421342

13431343
if (c == NULL || (labelSz > 0 && label == NULL)) {
13441344
return WH_ERROR_BADARGS;
@@ -1355,7 +1355,7 @@ int wh_Client_KeyCacheDmaRequest(whClientContext* c, uint32_t flags,
13551355

13561356
/* Set up DMA buffer info */
13571357
req->key.sz = keySz;
1358-
ret = wh_Client_DmaProcessClientAddress(
1358+
ret = wh_Client_DmaProcessClientAddress(
13591359
c, (uintptr_t)keyAddr, (void**)&keyAddrPtr, keySz,
13601360
WH_DMA_OPER_CLIENT_READ_PRE, (whDmaFlags){0});
13611361
req->key.addr = keyAddrPtr;
@@ -1370,12 +1370,12 @@ int wh_Client_KeyCacheDmaRequest(whClientContext* c, uint32_t flags,
13701370

13711371
if (ret == WH_ERROR_OK) {
13721372
ret = wh_Client_SendRequest(c, WH_MESSAGE_GROUP_KEY, WH_KEY_CACHE_DMA,
1373-
sizeof(*req), (uint8_t*)req);
1373+
sizeof(*req), (uint8_t*)req);
13741374
}
13751375

13761376
(void)wh_Client_DmaProcessClientAddress(
1377-
c, (uintptr_t)keyAddr, (void**)&keyAddrPtr, keySz,
1378-
WH_DMA_OPER_CLIENT_READ_POST, (whDmaFlags){0});
1377+
c, (uintptr_t)keyAddr, (void**)&keyAddrPtr, keySz,
1378+
WH_DMA_OPER_CLIENT_READ_POST, (whDmaFlags){0});
13791379
return ret;
13801380
}
13811381

src/wh_client_crypto.c

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2526,7 +2526,7 @@ int wh_Client_CmacDma(whClientContext* ctx, Cmac* cmac, CmacType type,
25262526

25272527
/* Set up DMA state buffer in client address space */
25282528
req->state.sz = sizeof(*cmac);
2529-
ret = wh_Client_DmaProcessClientAddress(
2529+
ret = wh_Client_DmaProcessClientAddress(
25302530
ctx, (uintptr_t)cmac, (void**)&stateAddr, req->state.sz,
25312531
WH_DMA_OPER_CLIENT_READ_PRE, (whDmaFlags){0});
25322532
req->state.addr = stateAddr;
@@ -2535,7 +2535,7 @@ int wh_Client_CmacDma(whClientContext* ctx, Cmac* cmac, CmacType type,
25352535
if (ret == WH_ERROR_OK && key != NULL) {
25362536
/* Initialize with provided key */
25372537
req->key.sz = keyLen;
2538-
ret = wh_Client_DmaProcessClientAddress(
2538+
ret = wh_Client_DmaProcessClientAddress(
25392539
ctx, (uintptr_t)key, (void**)&keyAddr, req->key.sz,
25402540
WH_DMA_OPER_CLIENT_READ_PRE, (whDmaFlags){0});
25412541
req->key.addr = keyAddr;
@@ -2544,7 +2544,7 @@ int wh_Client_CmacDma(whClientContext* ctx, Cmac* cmac, CmacType type,
25442544
if (ret == WH_ERROR_OK && in != NULL) {
25452545
/* Update operation */
25462546
req->input.sz = inLen;
2547-
ret = wh_Client_DmaProcessClientAddress(
2547+
ret = wh_Client_DmaProcessClientAddress(
25482548
ctx, (uintptr_t)in, (void**)&inAddr, req->input.sz,
25492549
WH_DMA_OPER_CLIENT_READ_PRE, (whDmaFlags){0});
25502550
req->input.addr = inAddr;
@@ -2553,7 +2553,7 @@ int wh_Client_CmacDma(whClientContext* ctx, Cmac* cmac, CmacType type,
25532553
if (ret == WH_ERROR_OK && outMac != NULL) {
25542554
/* Finalize operation */
25552555
req->output.sz = (size_t)*outMacLen;
2556-
ret = wh_Client_DmaProcessClientAddress(
2556+
ret = wh_Client_DmaProcessClientAddress(
25572557
ctx, (uintptr_t)outMac, (void**)&outAddr, req->output.sz,
25582558
WH_DMA_OPER_CLIENT_WRITE_PRE, (whDmaFlags){0});
25592559
req->output.addr = outAddr;
@@ -3079,9 +3079,9 @@ int wh_Client_Sha224Dma(whClientContext* ctx, wc_Sha224* sha, const uint8_t* in,
30793079
uint8_t* dataPtr = NULL;
30803080
whMessageCrypto_Sha2DmaRequest* req = NULL;
30813081
whMessageCrypto_Sha2DmaResponse* resp = NULL;
3082-
uintptr_t inAddr = 0;
3083-
uintptr_t outAddr = 0;
3084-
uintptr_t stateAddr = 0;
3082+
uintptr_t inAddr = 0;
3083+
uintptr_t outAddr = 0;
3084+
uintptr_t stateAddr = 0;
30853085

30863086
/* Get data pointer from the context to use as request/response storage */
30873087
dataPtr = (uint8_t*)wh_CommClient_GetDataPtr(ctx->comm);
@@ -3094,9 +3094,9 @@ int wh_Client_Sha224Dma(whClientContext* ctx, wc_Sha224* sha, const uint8_t* in,
30943094
dataPtr, WC_HASH_TYPE_SHA224);
30953095

30963096
if (in != NULL || out != NULL) {
3097-
req->state.sz = sizeof(*sha224);
3098-
req->input.sz = inLen;
3099-
req->output.sz = WC_SHA224_DIGEST_SIZE; /* not needed, but YOLO */
3097+
req->state.sz = sizeof(*sha224);
3098+
req->input.sz = inLen;
3099+
req->output.sz = WC_SHA224_DIGEST_SIZE; /* not needed, but YOLO */
31003100

31013101
/* Perform address translations */
31023102
ret = wh_Client_DmaProcessClientAddress(
@@ -3153,7 +3153,7 @@ int wh_Client_Sha224Dma(whClientContext* ctx, wc_Sha224* sha, const uint8_t* in,
31533153
* wc_CryptoCb_Sha224Hash(sha224, NULL, 0, * hash) */
31543154
if ((ret == WH_ERROR_OK) && (out != NULL)) {
31553155
/* Packet will have been trashed, so re-populate all fields */
3156-
req->finalize = 1;
3156+
req->finalize = 1;
31573157

31583158
#ifdef DEBUG_CRYPTOCB_VERBOSE
31593159
printf("[client] SHA224 DMA FINAL: outAddr=%p\n", out);
@@ -3364,9 +3364,9 @@ int wh_Client_Sha384Dma(whClientContext* ctx, wc_Sha384* sha, const uint8_t* in,
33643364
uint8_t* dataPtr = NULL;
33653365
whMessageCrypto_Sha2DmaRequest* req = NULL;
33663366
whMessageCrypto_Sha2DmaResponse* resp = NULL;
3367-
uintptr_t inAddr = 0;
3368-
uintptr_t outAddr = 0;
3369-
uintptr_t stateAddr = 0;
3367+
uintptr_t inAddr = 0;
3368+
uintptr_t outAddr = 0;
3369+
uintptr_t stateAddr = 0;
33703370

33713371
/* Get data pointer from the context to use as request/response storage */
33723372
dataPtr = (uint8_t*)wh_CommClient_GetDataPtr(ctx->comm);
@@ -3379,9 +3379,9 @@ int wh_Client_Sha384Dma(whClientContext* ctx, wc_Sha384* sha, const uint8_t* in,
33793379
dataPtr, WC_HASH_TYPE_SHA384);
33803380

33813381
if (in != NULL || out != NULL) {
3382-
req->state.sz = sizeof(*sha384);
3383-
req->input.sz = inLen;
3384-
req->output.sz = WC_SHA384_DIGEST_SIZE; /* not needed, but YOLO */
3382+
req->state.sz = sizeof(*sha384);
3383+
req->input.sz = inLen;
3384+
req->output.sz = WC_SHA384_DIGEST_SIZE; /* not needed, but YOLO */
33853385

33863386
/* Perform address translations */
33873387
ret = wh_Client_DmaProcessClientAddress(
@@ -3407,7 +3407,7 @@ int wh_Client_Sha384Dma(whClientContext* ctx, wc_Sha384* sha, const uint8_t* in,
34073407
/* Caller invoked SHA Update:
34083408
* wc_CryptoCb_Sha384Hash(sha384, data, len, NULL) */
34093409
if (in != NULL) {
3410-
req->finalize = 0;
3410+
req->finalize = 0;
34113411
#ifdef DEBUG_CRYPTOCB_VERBOSE
34123412
printf("[client] SHA384 DMA UPDATE: inAddr=%p, inSz=%u\n", in, inLen);
34133413
#endif
@@ -3437,7 +3437,7 @@ int wh_Client_Sha384Dma(whClientContext* ctx, wc_Sha384* sha, const uint8_t* in,
34373437
* wc_CryptoCb_Sha384Hash(sha384, NULL, 0, * hash) */
34383438
if ((ret == WH_ERROR_OK) && (out != NULL)) {
34393439
/* Packet will have been trashed, so re-populate all fields */
3440-
req->finalize = 1;
3440+
req->finalize = 1;
34413441

34423442
#ifdef DEBUG_CRYPTOCB_VERBOSE
34433443
printf("[client] SHA384 DMA FINAL: outAddr=%p\n", out);
@@ -3660,9 +3660,9 @@ int wh_Client_Sha512Dma(whClientContext* ctx, wc_Sha512* sha, const uint8_t* in,
36603660
uint8_t* dataPtr = NULL;
36613661
whMessageCrypto_Sha2DmaRequest* req = NULL;
36623662
whMessageCrypto_Sha2DmaResponse* resp = NULL;
3663-
uintptr_t inAddr = 0;
3664-
uintptr_t outAddr = 0;
3665-
uintptr_t stateAddr = 0;
3663+
uintptr_t inAddr = 0;
3664+
uintptr_t outAddr = 0;
3665+
uintptr_t stateAddr = 0;
36663666

36673667
/* Get data pointer from the context to use as request/response storage */
36683668
dataPtr = (uint8_t*)wh_CommClient_GetDataPtr(ctx->comm);
@@ -3675,9 +3675,9 @@ int wh_Client_Sha512Dma(whClientContext* ctx, wc_Sha512* sha, const uint8_t* in,
36753675
dataPtr, WC_HASH_TYPE_SHA512);
36763676

36773677
if (in != NULL || out != NULL) {
3678-
req->state.sz = sizeof(*sha512);
3679-
req->input.sz = inLen;
3680-
req->output.sz = WC_SHA512_DIGEST_SIZE; /* not needed, but YOLO */
3678+
req->state.sz = sizeof(*sha512);
3679+
req->input.sz = inLen;
3680+
req->output.sz = WC_SHA512_DIGEST_SIZE; /* not needed, but YOLO */
36813681

36823682
/* Perform address translations */
36833683
ret = wh_Client_DmaProcessClientAddress(
@@ -3734,7 +3734,7 @@ int wh_Client_Sha512Dma(whClientContext* ctx, wc_Sha512* sha, const uint8_t* in,
37343734
* wc_CryptoCb_Sha512Hash(sha512, NULL, 0, * hash) */
37353735
if ((ret == WH_ERROR_OK) && (out != NULL)) {
37363736
/* Packet will have been trashed, so re-populate all fields */
3737-
req->finalize = 1;
3737+
req->finalize = 1;
37383738

37393739
#ifdef DEBUG_CRYPTOCB_VERBOSE
37403740
printf("[client] SHA512 DMA FINAL: outAddr=%p\n", out);
@@ -4350,8 +4350,8 @@ static int _MlDsaMakeKeyDma(whClientContext* ctx, int level,
43504350
uint8_t* dataPtr = NULL;
43514351
whMessageCrypto_MlDsaKeyGenDmaRequest* req = NULL;
43524352
whMessageCrypto_MlDsaKeyGenDmaResponse* res = NULL;
4353-
uintptr_t keyAddr = 0;
4354-
uint64_t keyAddrSz = 0;
4353+
uintptr_t keyAddr = 0;
4354+
uint64_t keyAddrSz = 0;
43554355

43564356
if (ctx == NULL) {
43574357
return WH_ERROR_BADARGS;
@@ -4385,7 +4385,7 @@ static int _MlDsaMakeKeyDma(whClientContext* ctx, int level,
43854385
req->level = level;
43864386
req->flags = flags;
43874387
req->keyId = key_id;
4388-
req->key.sz = keyAddrSz = sizeof(buffer);
4388+
req->key.sz = keyAddrSz = sizeof(buffer);
43894389

43904390
ret = wh_Client_DmaProcessClientAddress(
43914391
ctx, (uintptr_t)buffer, (void**)&keyAddr, keyAddrSz,
@@ -4416,11 +4416,11 @@ static int _MlDsaMakeKeyDma(whClientContext* ctx, int level,
44164416

44174417
if (ret == WH_ERROR_OK) {
44184418
/* Get response structure pointer, validates generic header
4419-
* rc */
4419+
* rc */
44204420
ret = _getCryptoResponse(dataPtr, WC_PK_TYPE_PQC_SIG_KEYGEN,
4421-
(uint8_t**)&res);
4421+
(uint8_t**)&res);
44224422
/* wolfCrypt allows positive error codes on success in some
4423-
* scenarios */
4423+
* scenarios */
44244424
if (ret >= 0) {
44254425
/* Key is cached on server or is ephemeral */
44264426
key_id = (whKeyId)(res->keyId);
@@ -4470,8 +4470,8 @@ int wh_Client_MlDsaSignDma(whClientContext* ctx, const byte* in, word32 in_len,
44704470
whMessageCrypto_MlDsaSignDmaRequest* req = NULL;
44714471
whMessageCrypto_MlDsaSignDmaResponse* res = NULL;
44724472
uint8_t* dataPtr = NULL;
4473-
uintptr_t inAddr = 0;
4474-
uintptr_t outAddr = 0;
4473+
uintptr_t inAddr = 0;
4474+
uintptr_t outAddr = 0;
44754475

44764476
/* Transaction state */
44774477
whKeyId key_id;
@@ -4535,13 +4535,13 @@ int wh_Client_MlDsaSignDma(whClientContext* ctx, const byte* in, word32 in_len,
45354535

45364536
/* Set up DMA buffers */
45374537
req->msg.sz = in_len;
4538-
ret = wh_Client_DmaProcessClientAddress(
4538+
ret = wh_Client_DmaProcessClientAddress(
45394539
ctx, (uintptr_t)in, (void**)&inAddr, req->msg.sz,
45404540
WH_DMA_OPER_CLIENT_READ_PRE, (whDmaFlags){0});
45414541
req->msg.addr = inAddr;
45424542

45434543
req->sig.sz = *out_len;
4544-
ret = wh_Client_DmaProcessClientAddress(
4544+
ret = wh_Client_DmaProcessClientAddress(
45454545
ctx, (uintptr_t)out, (void**)&outAddr, req->sig.sz,
45464546
WH_DMA_OPER_CLIENT_WRITE_PRE, (whDmaFlags){0});
45474547
req->sig.addr = outAddr;
@@ -4663,12 +4663,12 @@ int wh_Client_MlDsaVerifyDma(whClientContext* ctx, const byte* sig,
46634663

46644664
/* Set up DMA buffers */
46654665
req->sig.sz = sig_len;
4666-
ret = wh_Client_DmaProcessClientAddress(
4666+
ret = wh_Client_DmaProcessClientAddress(
46674667
ctx, (uintptr_t)sig, (void**)&sigAddr, sig_len,
46684668
WH_DMA_OPER_CLIENT_READ_PRE, (whDmaFlags){0});
46694669
req->sig.addr = sigAddr;
46704670
req->msg.sz = msg_len;
4671-
ret = wh_Client_DmaProcessClientAddress(
4671+
ret = wh_Client_DmaProcessClientAddress(
46724672
ctx, (uintptr_t)msg, (void**)&msgAddr, msg_len,
46734673
WH_DMA_OPER_CLIENT_WRITE_PRE, (whDmaFlags){0});
46744674
req->msg.addr = msgAddr;

0 commit comments

Comments
 (0)