@@ -89,7 +89,7 @@ static int init_cc( mbedtls_cmac_context_t *cmac_ctx )
89
89
int ret = 0 ;
90
90
SaSiAesUserKeyData_t CC_KeyData ;
91
91
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 )
93
93
{
94
94
return ( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
95
95
}
@@ -114,7 +114,7 @@ static int init_cc( mbedtls_cmac_context_t *cmac_ctx )
114
114
int mbedtls_cipher_cmac_update ( mbedtls_cipher_context_t * ctx ,
115
115
const unsigned char * input , size_t ilen )
116
116
{
117
- mbedtls_cmac_context_t * cmac_ctx ;
117
+ mbedtls_cmac_context_t * cmac_ctx ;
118
118
int ret = 0 ;
119
119
size_t block_size ;
120
120
@@ -153,7 +153,7 @@ int mbedtls_cipher_cmac_update( mbedtls_cipher_context_t *ctx,
153
153
154
154
/*
155
155
* 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.
157
157
*/
158
158
if ( cmac_ctx -> unprocessed_len == SASI_AES_BLOCK_SIZE_IN_BYTES && ilen > 0 )
159
159
{
@@ -169,16 +169,16 @@ int mbedtls_cipher_cmac_update( mbedtls_cipher_context_t *ctx,
169
169
170
170
if ( ilen > 0 )
171
171
{
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 ) ?
173
173
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 );
177
177
cmac_ctx -> unprocessed_len = size_to_store ;
178
178
ilen -= size_to_store ;
179
179
if ( ilen > 0 )
180
180
{
181
- if ( SaSi_AesBlock ( & cmac_ctx -> CC_Context , ( uint8_t * )input ,
181
+ if ( SaSi_AesBlock ( & cmac_ctx -> CC_Context , (uint8_t * )input ,
182
182
ilen , NULL ) != 0 )
183
183
{
184
184
ret = MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED ;
@@ -200,7 +200,7 @@ int mbedtls_cipher_cmac_update( mbedtls_cipher_context_t *ctx,
200
200
int mbedtls_cipher_cmac_finish ( mbedtls_cipher_context_t * ctx ,
201
201
unsigned char * output )
202
202
{
203
- mbedtls_cmac_context_t * cmac_ctx ;
203
+ mbedtls_cmac_context_t * cmac_ctx ;
204
204
int ret = 0 ;
205
205
size_t olen = SASI_AES_BLOCK_SIZE_IN_BYTES ;
206
206
@@ -236,7 +236,7 @@ int mbedtls_cipher_cmac_finish( mbedtls_cipher_context_t *ctx,
236
236
237
237
int mbedtls_cipher_cmac_reset ( mbedtls_cipher_context_t * ctx )
238
238
{
239
- mbedtls_cmac_context_t * cmac_ctx ;
239
+ mbedtls_cmac_context_t * cmac_ctx ;
240
240
241
241
if ( ctx == NULL || ctx -> cipher_info == NULL || ctx -> cmac_ctx == NULL )
242
242
return ( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
@@ -251,28 +251,6 @@ int mbedtls_cipher_cmac_reset( mbedtls_cipher_context_t *ctx )
251
251
return ( 0 );
252
252
}
253
253
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
- */
276
254
int mbedtls_cipher_cmac ( const mbedtls_cipher_info_t * cipher_info ,
277
255
const unsigned char * key , size_t keylen ,
278
256
const unsigned char * input , size_t ilen ,
0 commit comments