Skip to content

Commit 70b671e

Browse files
committed
Apply clang-format-15 fixes
1 parent 33b552d commit 70b671e

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

src/wh_client_crypto.c

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ static int _getCryptoResponse(uint8_t* respBuf, uint16_t type,
134134
/* Helper function to prepare a crypto request buffer with generic header */
135135
static uint8_t* _createCryptoRequest(uint8_t* reqBuf, uint16_t type)
136136
{
137-
return _createCryptoRequestWithSubtype(reqBuf, type, WH_MESSAGE_CRYPTO_ALGO_SUBTYPE_NONE);
137+
return _createCryptoRequestWithSubtype(reqBuf, type,
138+
WH_MESSAGE_CRYPTO_ALGO_SUBTYPE_NONE);
138139
}
139140

140141
/* Helper function to prepare a crypto request buffer with generic header and
@@ -2968,13 +2969,13 @@ static int _xferSha256BlockAndUpdateDigest(whClientContext* ctx,
29682969
wc_Sha256* sha256,
29692970
uint32_t isLastBlock)
29702971
{
2971-
uint16_t group = WH_MESSAGE_GROUP_CRYPTO;
2972-
uint16_t action = WH_MESSAGE_ACTION_NONE;
2973-
int ret = 0;
2974-
uint16_t dataSz = 0;
2975-
whMessageCrypto_Sha256Request* req = NULL;
2976-
whMessageCrypto_Sha2Response* res = NULL;
2977-
uint8_t* dataPtr = NULL;
2972+
uint16_t group = WH_MESSAGE_GROUP_CRYPTO;
2973+
uint16_t action = WH_MESSAGE_ACTION_NONE;
2974+
int ret = 0;
2975+
uint16_t dataSz = 0;
2976+
whMessageCrypto_Sha256Request* req = NULL;
2977+
whMessageCrypto_Sha2Response* res = NULL;
2978+
uint8_t* dataPtr = NULL;
29782979

29792980
/* Get data buffer */
29802981
dataPtr = wh_CommClient_GetDataPtr(ctx->comm);
@@ -2983,21 +2984,23 @@ static int _xferSha256BlockAndUpdateDigest(whClientContext* ctx,
29832984
}
29842985

29852986
/* Setup generic header and get pointer to request data */
2986-
req = (whMessageCrypto_Sha256Request*)_createCryptoRequest(dataPtr,WC_HASH_TYPE_SHA256);
2987+
req = (whMessageCrypto_Sha256Request*)_createCryptoRequest(
2988+
dataPtr, WC_HASH_TYPE_SHA256);
29872989

29882990

29892991
/* Send the full block to the server, along with the
29902992
* current hash state if needed. Finalization/padding of last block is up to
29912993
* the server, we just need to let it know we are done and sending an
29922994
* incomplete last block */
2993-
if(isLastBlock){
2994-
req->isLastBlock=1;
2995-
req->lastBlockLen=sha256->buffLen;
2996-
}else{
2997-
req->isLastBlock=0;
2995+
if (isLastBlock) {
2996+
req->isLastBlock = 1;
2997+
req->lastBlockLen = sha256->buffLen;
2998+
}
2999+
else {
3000+
req->isLastBlock = 0;
29983001
}
29993002
memcpy(req->inBlock, sha256->buffer,
3000-
(isLastBlock) ? sha256->buffLen : WC_SHA256_BLOCK_SIZE);
3003+
(isLastBlock) ? sha256->buffLen : WC_SHA256_BLOCK_SIZE);
30013004

30023005
/* Send the hash state - this will be 0 on the first block on a properly
30033006
* initialized sha256 struct */
@@ -3115,13 +3118,13 @@ int wh_Client_Sha256(whClientContext* ctx, wc_Sha256* sha256, const uint8_t* in,
31153118
int wh_Client_Sha256Dma(whClientContext* ctx, wc_Sha256* sha, const uint8_t* in,
31163119
uint32_t inLen, uint8_t* out)
31173120
{
3118-
int ret = WH_ERROR_OK;
3119-
wc_Sha256* sha256 = sha;
3120-
uint16_t respSz = 0;
3121-
uint16_t group = WH_MESSAGE_GROUP_CRYPTO_DMA;
3122-
uint8_t* dataPtr = NULL;
3123-
whMessageCrypto_Sha2DmaRequest* req = NULL;
3124-
whMessageCrypto_Sha2DmaResponse* resp = NULL;
3121+
int ret = WH_ERROR_OK;
3122+
wc_Sha256* sha256 = sha;
3123+
uint16_t respSz = 0;
3124+
uint16_t group = WH_MESSAGE_GROUP_CRYPTO_DMA;
3125+
uint8_t* dataPtr = NULL;
3126+
whMessageCrypto_Sha2DmaRequest* req = NULL;
3127+
whMessageCrypto_Sha2DmaResponse* resp = NULL;
31253128
uintptr_t inAddr = 0; /* The req->input.addr is reused elsewhere, this
31263129
local variable is to keep track of the resulting
31273130
DMA translation to pass back to the callback on
@@ -3141,10 +3144,10 @@ int wh_Client_Sha256Dma(whClientContext* ctx, wc_Sha256* sha, const uint8_t* in,
31413144

31423145
/* map addresses and setup default request structure */
31433146
if (in != NULL || out != NULL) {
3144-
req->finalize = 0;
3145-
req->state.sz = sizeof(*sha256);
3146-
req->input.sz = inLen;
3147-
req->output.sz = WC_SHA256_DIGEST_SIZE; /* not needed, but YOLO */
3147+
req->finalize = 0;
3148+
req->state.sz = sizeof(*sha256);
3149+
req->input.sz = inLen;
3150+
req->output.sz = WC_SHA256_DIGEST_SIZE; /* not needed, but YOLO */
31483151

31493152
/* Perform address translations */
31503153
ret = wh_Client_DmaProcessClientAddress(

0 commit comments

Comments
 (0)