@@ -242,11 +242,10 @@ int wh_Client_RngGenerate(whClientContext* ctx, uint8_t* out, uint32_t size)
242242#ifndef NO_AES
243243
244244#ifdef WOLFSSL_AES_COUNTER
245- int wh_Client_AesCtr (whClientContext * ctx , Aes * aes , int enc ,
246- const uint8_t * in , uint32_t len , uint8_t * out )
245+ int wh_Client_AesCtr (whClientContext * ctx , Aes * aes , int enc , const uint8_t * in ,
246+ uint32_t len , uint8_t * out )
247247{
248- int ret = WH_ERROR_OK ;
249- /*uint16_t blocks = len / AES_BLOCK_SIZE;*/
248+ int ret = WH_ERROR_OK ;
250249 whMessageCrypto_AesCtrRequest * req ;
251250 whMessageCrypto_AesCtrResponse * res ;
252251 uint8_t * dataPtr ;
@@ -260,8 +259,8 @@ int wh_Client_AesCtr(whClientContext* ctx, Aes* aes, int enc,
260259 whKeyId key_id = WH_DEVCTX_TO_KEYID (aes -> devCtx );
261260 uint8_t * iv = (uint8_t * )aes -> reg ;
262261 uint32_t iv_len = AES_IV_SIZE ;
263- uint32_t left = aes -> left ;
264- uint8_t * tmp = (uint8_t * )aes -> tmp ;
262+ uint32_t left = aes -> left ;
263+ uint8_t * tmp = (uint8_t * )aes -> tmp ;
265264
266265 uint16_t group = WH_MESSAGE_GROUP_CRYPTO ;
267266 uint16_t action = WC_ALGO_TYPE_CIPHER ;
@@ -280,8 +279,8 @@ int wh_Client_AesCtr(whClientContext* ctx, Aes* aes, int enc,
280279 uint8_t * req_iv = req_key + key_len ;
281280 uint8_t * req_tmp = req_iv + AES_BLOCK_SIZE ;
282281 uint32_t req_len = sizeof (whMessageCrypto_GenericRequestHeader ) +
283- sizeof (* req ) + len + key_len +
284- iv_len + (AES_BLOCK_SIZE * 2 );
282+ sizeof (* req ) + len + key_len + iv_len +
283+ (AES_BLOCK_SIZE * 2 );
285284#ifdef DEBUG_CRYPTOCB_VERBOSE
286285 printf ("[client] %s: enc:%d keylen:%d ivsz:%d insz:%d reqsz:%u "
287286 "left:%d\n" ,
@@ -333,8 +332,8 @@ int wh_Client_AesCtr(whClientContext* ctx, Aes* aes, int enc,
333332 /* Response packet */
334333 uint16_t res_len = 0 ;
335334 do {
336- ret = wh_Client_RecvResponse ( ctx , & group , & action , & res_len ,
337- dataPtr );
335+ ret =
336+ wh_Client_RecvResponse ( ctx , & group , & action , & res_len , dataPtr );
338337 } while (ret == WH_ERROR_NOTREADY );
339338 if (ret == WH_ERROR_OK ) {
340339 ret = _getCryptoResponse (dataPtr , type , (uint8_t * * )& res );
@@ -349,7 +348,7 @@ int wh_Client_AesCtr(whClientContext* ctx, Aes* aes, int enc,
349348 printf ("[client] out size:%d res_len:%d\n" , res -> sz , res_len );
350349 wh_Utils_Hexdump ("[client] res_out: \n" , res_out , res -> sz );
351350 wh_Utils_Hexdump ("[client] res_tmp: \n" , res_tmp ,
352- AES_BLOCK_SIZE );
351+ AES_BLOCK_SIZE );
353352#endif
354353 /* copy the response res_out */
355354 memcpy (out , res_out , res -> sz );
@@ -388,11 +387,11 @@ int wh_Client_AesEcb(whClientContext* ctx, Aes* aes, int enc, const uint8_t* in,
388387 return WH_ERROR_BADARGS ;
389388 }
390389
391- uint32_t key_len = aes -> keylen ;
392- const uint8_t * key = (const uint8_t * )(aes -> devKey );
393- whKeyId key_id = WH_DEVCTX_TO_KEYID (aes -> devCtx );
394- uint8_t * iv = (uint8_t * )aes -> reg ;
395- uint32_t iv_len = AES_IV_SIZE ;
390+ uint32_t key_len = aes -> keylen ;
391+ const uint8_t * key = (const uint8_t * )(aes -> devKey );
392+ whKeyId key_id = WH_DEVCTX_TO_KEYID (aes -> devCtx );
393+ uint8_t * iv = (uint8_t * )aes -> reg ;
394+ uint32_t iv_len = AES_IV_SIZE ;
396395
397396 uint16_t group = WH_MESSAGE_GROUP_CRYPTO ;
398397 uint16_t action = WC_ALGO_TYPE_CIPHER ;
0 commit comments