Skip to content

Commit f5956ce

Browse files
Ron EldorRon Eldor
authored andcommitted
Style fixes
Fix minor style fixes and typos: 1. Change file name to correct one. 2. Change copyright year. 3. Insert whitespaces before and after paranthesis. 4. Put `*` next to pointer name.
1 parent 641c518 commit f5956ce

File tree

2 files changed

+12
-34
lines changed

2 files changed

+12
-34
lines changed

features/cryptocell/FEATURE_CRYPTOCELL310/cmac_alt.c

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static int init_cc( mbedtls_cmac_context_t *cmac_ctx )
8989
int ret = 0;
9090
SaSiAesUserKeyData_t CC_KeyData;
9191
if( SaSi_AesInit( &cmac_ctx->CC_Context, SASI_AES_ENCRYPT,
92-
SASI_AES_MODE_CMAC, SASI_AES_PADDING_NONE) != 0 )
92+
SASI_AES_MODE_CMAC, SASI_AES_PADDING_NONE ) != 0 )
9393
{
9494
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
9595
}
@@ -114,7 +114,7 @@ static int init_cc( mbedtls_cmac_context_t *cmac_ctx )
114114
int mbedtls_cipher_cmac_update( mbedtls_cipher_context_t *ctx,
115115
const unsigned char *input, size_t ilen )
116116
{
117-
mbedtls_cmac_context_t* cmac_ctx;
117+
mbedtls_cmac_context_t *cmac_ctx;
118118
int ret = 0;
119119
size_t block_size;
120120

@@ -153,7 +153,7 @@ int mbedtls_cipher_cmac_update( mbedtls_cipher_context_t *ctx,
153153

154154
/*
155155
* Process the unproccessed data, in case it reached a full AES block,
156-
* and there is there is still input data.
156+
* and there is still input data.
157157
*/
158158
if( cmac_ctx->unprocessed_len == SASI_AES_BLOCK_SIZE_IN_BYTES && ilen > 0 )
159159
{
@@ -169,16 +169,16 @@ int mbedtls_cipher_cmac_update( mbedtls_cipher_context_t *ctx,
169169

170170
if( ilen > 0 )
171171
{
172-
const size_t size_to_store = ( ilen % SASI_AES_BLOCK_SIZE_IN_BYTES == 0) ?
172+
const size_t size_to_store = ( ilen % SASI_AES_BLOCK_SIZE_IN_BYTES == 0 ) ?
173173
SASI_AES_BLOCK_SIZE_IN_BYTES : ilen % SASI_AES_BLOCK_SIZE_IN_BYTES;
174-
memcpy( &cmac_ctx->unprocessed_block[0],
175-
input + ilen - size_to_store,
176-
size_to_store );
174+
memcpy( cmac_ctx->unprocessed_block,
175+
input + ilen - size_to_store,
176+
size_to_store );
177177
cmac_ctx->unprocessed_len = size_to_store;
178178
ilen -= size_to_store;
179179
if( ilen > 0 )
180180
{
181-
if( SaSi_AesBlock( &cmac_ctx->CC_Context, ( uint8_t * )input,
181+
if( SaSi_AesBlock( &cmac_ctx->CC_Context, (uint8_t *)input,
182182
ilen, NULL ) != 0 )
183183
{
184184
ret = MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED;
@@ -200,7 +200,7 @@ int mbedtls_cipher_cmac_update( mbedtls_cipher_context_t *ctx,
200200
int mbedtls_cipher_cmac_finish( mbedtls_cipher_context_t *ctx,
201201
unsigned char *output )
202202
{
203-
mbedtls_cmac_context_t* cmac_ctx;
203+
mbedtls_cmac_context_t *cmac_ctx;
204204
int ret = 0;
205205
size_t olen = SASI_AES_BLOCK_SIZE_IN_BYTES;
206206

@@ -236,7 +236,7 @@ int mbedtls_cipher_cmac_finish( mbedtls_cipher_context_t *ctx,
236236

237237
int mbedtls_cipher_cmac_reset( mbedtls_cipher_context_t *ctx )
238238
{
239-
mbedtls_cmac_context_t* cmac_ctx;
239+
mbedtls_cmac_context_t *cmac_ctx;
240240

241241
if( ctx == NULL || ctx->cipher_info == NULL || ctx->cmac_ctx == NULL )
242242
return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
@@ -251,28 +251,6 @@ int mbedtls_cipher_cmac_reset( mbedtls_cipher_context_t *ctx )
251251
return( 0 );
252252
}
253253

254-
/**
255-
* \brief This function calculates the full generic CMAC
256-
* on the input buffer with the provided key.
257-
*
258-
* The function allocates the context, performs the
259-
* calculation, and frees the context.
260-
*
261-
* The CMAC result is calculated as
262-
* output = generic CMAC(cmac key, input buffer).
263-
*
264-
*
265-
* \param cipher_info The cipher information.
266-
* \param key The CMAC key.
267-
* \param keylen The length of the CMAC key in bits.
268-
* \param input The buffer holding the input data.
269-
* \param ilen The length of the input data.
270-
* \param output The buffer for the generic CMAC result.
271-
*
272-
* \return \c 0 on success.
273-
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA
274-
* if parameter verification fails.
275-
*/
276254
int mbedtls_cipher_cmac( const mbedtls_cipher_info_t *cipher_info,
277255
const unsigned char *key, size_t keylen,
278256
const unsigned char *input, size_t ilen,

features/cryptocell/FEATURE_CRYPTOCELL310/cmac_alt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
* aes_alt.h
2+
* cmac_alt.h
33
*
4-
* Copyright (C) 2018, ARM Limited, All Rights Reserved
4+
* Copyright (C) 2019, ARM Limited, All Rights Reserved
55
* SPDX-License-Identifier: Apache-2.0
66
*
77
* Licensed under the Apache License, Version 2.0 (the "License"); you may

0 commit comments

Comments
 (0)