Lines Matching refs:cmac_ctx
231 mbedtls_cmac_context_t *cmac_ctx; in mbedtls_cipher_cmac_starts() local
256 cmac_ctx = mbedtls_calloc( 1, sizeof( mbedtls_cmac_context_t ) ); in mbedtls_cipher_cmac_starts()
257 if( cmac_ctx == NULL ) in mbedtls_cipher_cmac_starts()
260 ctx->cmac_ctx = cmac_ctx; in mbedtls_cipher_cmac_starts()
262 mbedtls_platform_zeroize( cmac_ctx->state, sizeof( cmac_ctx->state ) ); in mbedtls_cipher_cmac_starts()
270 mbedtls_cmac_context_t* cmac_ctx; in mbedtls_cipher_cmac_update() local
276 ctx->cmac_ctx == NULL ) in mbedtls_cipher_cmac_update()
279 cmac_ctx = ctx->cmac_ctx; in mbedtls_cipher_cmac_update()
281 state = ctx->cmac_ctx->state; in mbedtls_cipher_cmac_update()
285 if( cmac_ctx->unprocessed_len > 0 && in mbedtls_cipher_cmac_update()
286 ilen > block_size - cmac_ctx->unprocessed_len ) in mbedtls_cipher_cmac_update()
288 memcpy( &cmac_ctx->unprocessed_block[cmac_ctx->unprocessed_len], in mbedtls_cipher_cmac_update()
290 block_size - cmac_ctx->unprocessed_len ); in mbedtls_cipher_cmac_update()
292 cmac_xor_block( state, cmac_ctx->unprocessed_block, state, block_size ); in mbedtls_cipher_cmac_update()
300 input += block_size - cmac_ctx->unprocessed_len; in mbedtls_cipher_cmac_update()
301 ilen -= block_size - cmac_ctx->unprocessed_len; in mbedtls_cipher_cmac_update()
302 cmac_ctx->unprocessed_len = 0; in mbedtls_cipher_cmac_update()
325 memcpy( &cmac_ctx->unprocessed_block[cmac_ctx->unprocessed_len], in mbedtls_cipher_cmac_update()
328 cmac_ctx->unprocessed_len += ilen; in mbedtls_cipher_cmac_update()
338 mbedtls_cmac_context_t* cmac_ctx; in mbedtls_cipher_cmac_finish() local
346 if( ctx == NULL || ctx->cipher_info == NULL || ctx->cmac_ctx == NULL || in mbedtls_cipher_cmac_finish()
350 cmac_ctx = ctx->cmac_ctx; in mbedtls_cipher_cmac_finish()
352 state = cmac_ctx->state; in mbedtls_cipher_cmac_finish()
358 last_block = cmac_ctx->unprocessed_block; in mbedtls_cipher_cmac_finish()
361 if( cmac_ctx->unprocessed_len < block_size ) in mbedtls_cipher_cmac_finish()
363 cmac_pad( M_last, block_size, last_block, cmac_ctx->unprocessed_len ); in mbedtls_cipher_cmac_finish()
388 cmac_ctx->unprocessed_len = 0; in mbedtls_cipher_cmac_finish()
389 mbedtls_platform_zeroize( cmac_ctx->unprocessed_block, in mbedtls_cipher_cmac_finish()
390 sizeof( cmac_ctx->unprocessed_block ) ); in mbedtls_cipher_cmac_finish()
398 mbedtls_cmac_context_t* cmac_ctx; in mbedtls_cipher_cmac_reset() local
400 if( ctx == NULL || ctx->cipher_info == NULL || ctx->cmac_ctx == NULL ) in mbedtls_cipher_cmac_reset()
403 cmac_ctx = ctx->cmac_ctx; in mbedtls_cipher_cmac_reset()
406 cmac_ctx->unprocessed_len = 0; in mbedtls_cipher_cmac_reset()
407 mbedtls_platform_zeroize( cmac_ctx->unprocessed_block, in mbedtls_cipher_cmac_reset()
408 sizeof( cmac_ctx->unprocessed_block ) ); in mbedtls_cipher_cmac_reset()
409 mbedtls_platform_zeroize( cmac_ctx->state, in mbedtls_cipher_cmac_reset()
410 sizeof( cmac_ctx->state ) ); in mbedtls_cipher_cmac_reset()