Lines Matching refs:cmac_ctx
189 mbedtls_cmac_context_t *cmac_ctx; in mbedtls_cipher_cmac_starts() local
214 cmac_ctx = mbedtls_calloc( 1, sizeof( mbedtls_cmac_context_t ) ); in mbedtls_cipher_cmac_starts()
215 if( cmac_ctx == NULL ) in mbedtls_cipher_cmac_starts()
218 ctx->cmac_ctx = cmac_ctx; in mbedtls_cipher_cmac_starts()
220 mbedtls_platform_zeroize( cmac_ctx->state, sizeof( cmac_ctx->state ) ); in mbedtls_cipher_cmac_starts()
228 mbedtls_cmac_context_t* cmac_ctx; in mbedtls_cipher_cmac_update() local
234 ctx->cmac_ctx == NULL ) in mbedtls_cipher_cmac_update()
237 cmac_ctx = ctx->cmac_ctx; in mbedtls_cipher_cmac_update()
239 state = ctx->cmac_ctx->state; in mbedtls_cipher_cmac_update()
243 if( cmac_ctx->unprocessed_len > 0 && in mbedtls_cipher_cmac_update()
244 ilen > block_size - cmac_ctx->unprocessed_len ) in mbedtls_cipher_cmac_update()
246 memcpy( &cmac_ctx->unprocessed_block[cmac_ctx->unprocessed_len], in mbedtls_cipher_cmac_update()
248 block_size - cmac_ctx->unprocessed_len ); in mbedtls_cipher_cmac_update()
250 cmac_xor_block( state, cmac_ctx->unprocessed_block, state, block_size ); in mbedtls_cipher_cmac_update()
258 input += block_size - cmac_ctx->unprocessed_len; in mbedtls_cipher_cmac_update()
259 ilen -= block_size - cmac_ctx->unprocessed_len; in mbedtls_cipher_cmac_update()
260 cmac_ctx->unprocessed_len = 0; in mbedtls_cipher_cmac_update()
283 memcpy( &cmac_ctx->unprocessed_block[cmac_ctx->unprocessed_len], in mbedtls_cipher_cmac_update()
286 cmac_ctx->unprocessed_len += ilen; in mbedtls_cipher_cmac_update()
296 mbedtls_cmac_context_t* cmac_ctx; in mbedtls_cipher_cmac_finish() local
304 if( ctx == NULL || ctx->cipher_info == NULL || ctx->cmac_ctx == NULL || in mbedtls_cipher_cmac_finish()
308 cmac_ctx = ctx->cmac_ctx; in mbedtls_cipher_cmac_finish()
310 state = cmac_ctx->state; in mbedtls_cipher_cmac_finish()
316 last_block = cmac_ctx->unprocessed_block; in mbedtls_cipher_cmac_finish()
319 if( cmac_ctx->unprocessed_len < block_size ) in mbedtls_cipher_cmac_finish()
321 cmac_pad( M_last, block_size, last_block, cmac_ctx->unprocessed_len ); in mbedtls_cipher_cmac_finish()
346 cmac_ctx->unprocessed_len = 0; in mbedtls_cipher_cmac_finish()
347 mbedtls_platform_zeroize( cmac_ctx->unprocessed_block, in mbedtls_cipher_cmac_finish()
348 sizeof( cmac_ctx->unprocessed_block ) ); in mbedtls_cipher_cmac_finish()
356 mbedtls_cmac_context_t* cmac_ctx; in mbedtls_cipher_cmac_reset() local
358 if( ctx == NULL || ctx->cipher_info == NULL || ctx->cmac_ctx == NULL ) in mbedtls_cipher_cmac_reset()
361 cmac_ctx = ctx->cmac_ctx; in mbedtls_cipher_cmac_reset()
364 cmac_ctx->unprocessed_len = 0; in mbedtls_cipher_cmac_reset()
365 mbedtls_platform_zeroize( cmac_ctx->unprocessed_block, in mbedtls_cipher_cmac_reset()
366 sizeof( cmac_ctx->unprocessed_block ) ); in mbedtls_cipher_cmac_reset()
367 mbedtls_platform_zeroize( cmac_ctx->state, in mbedtls_cipher_cmac_reset()
368 sizeof( cmac_ctx->state ) ); in mbedtls_cipher_cmac_reset()