Lines Matching refs:cmac_ctx

160     mbedtls_cmac_context_t *cmac_ctx;  in mbedtls_cipher_cmac_starts()  local
186 cmac_ctx = mbedtls_calloc(1, sizeof(mbedtls_cmac_context_t)); in mbedtls_cipher_cmac_starts()
187 if (cmac_ctx == NULL) { in mbedtls_cipher_cmac_starts()
191 ctx->cmac_ctx = cmac_ctx; in mbedtls_cipher_cmac_starts()
193 mbedtls_platform_zeroize(cmac_ctx->state, sizeof(cmac_ctx->state)); in mbedtls_cipher_cmac_starts()
201 mbedtls_cmac_context_t *cmac_ctx; in mbedtls_cipher_cmac_update() local
207 ctx->cmac_ctx == NULL) { in mbedtls_cipher_cmac_update()
211 cmac_ctx = ctx->cmac_ctx; in mbedtls_cipher_cmac_update()
213 state = ctx->cmac_ctx->state; in mbedtls_cipher_cmac_update()
221 if (cmac_ctx->unprocessed_len > 0 && in mbedtls_cipher_cmac_update()
222 ilen > block_size - cmac_ctx->unprocessed_len) { in mbedtls_cipher_cmac_update()
223 memcpy(&cmac_ctx->unprocessed_block[cmac_ctx->unprocessed_len], in mbedtls_cipher_cmac_update()
225 block_size - cmac_ctx->unprocessed_len); in mbedtls_cipher_cmac_update()
227 mbedtls_xor_no_simd(state, cmac_ctx->unprocessed_block, state, block_size); in mbedtls_cipher_cmac_update()
234 input += block_size - cmac_ctx->unprocessed_len; in mbedtls_cipher_cmac_update()
235 ilen -= block_size - cmac_ctx->unprocessed_len; in mbedtls_cipher_cmac_update()
236 cmac_ctx->unprocessed_len = 0; in mbedtls_cipher_cmac_update()
258 memcpy(&cmac_ctx->unprocessed_block[cmac_ctx->unprocessed_len], in mbedtls_cipher_cmac_update()
261 cmac_ctx->unprocessed_len += ilen; in mbedtls_cipher_cmac_update()
271 mbedtls_cmac_context_t *cmac_ctx; in mbedtls_cipher_cmac_finish() local
279 if (ctx == NULL || ctx->cipher_info == NULL || ctx->cmac_ctx == NULL || in mbedtls_cipher_cmac_finish()
284 cmac_ctx = ctx->cmac_ctx; in mbedtls_cipher_cmac_finish()
287 state = cmac_ctx->state; in mbedtls_cipher_cmac_finish()
293 last_block = cmac_ctx->unprocessed_block; in mbedtls_cipher_cmac_finish()
296 if (cmac_ctx->unprocessed_len < block_size) { in mbedtls_cipher_cmac_finish()
297 cmac_pad(M_last, block_size, last_block, cmac_ctx->unprocessed_len); in mbedtls_cipher_cmac_finish()
319 cmac_ctx->unprocessed_len = 0; in mbedtls_cipher_cmac_finish()
320 mbedtls_platform_zeroize(cmac_ctx->unprocessed_block, in mbedtls_cipher_cmac_finish()
321 sizeof(cmac_ctx->unprocessed_block)); in mbedtls_cipher_cmac_finish()
329 mbedtls_cmac_context_t *cmac_ctx; in mbedtls_cipher_cmac_reset() local
331 if (ctx == NULL || ctx->cipher_info == NULL || ctx->cmac_ctx == NULL) { in mbedtls_cipher_cmac_reset()
335 cmac_ctx = ctx->cmac_ctx; in mbedtls_cipher_cmac_reset()
338 cmac_ctx->unprocessed_len = 0; in mbedtls_cipher_cmac_reset()
339 mbedtls_platform_zeroize(cmac_ctx->unprocessed_block, in mbedtls_cipher_cmac_reset()
340 sizeof(cmac_ctx->unprocessed_block)); in mbedtls_cipher_cmac_reset()
341 mbedtls_platform_zeroize(cmac_ctx->state, in mbedtls_cipher_cmac_reset()
342 sizeof(cmac_ctx->state)); in mbedtls_cipher_cmac_reset()