Lines Matching refs:cmac_ctx

158     mbedtls_cmac_context_t *cmac_ctx;  in mbedtls_cipher_cmac_setup()  local
162 cmac_ctx = mbedtls_calloc(1, sizeof(mbedtls_cmac_context_t)); in mbedtls_cipher_cmac_setup()
163 if (cmac_ctx == NULL) in mbedtls_cipher_cmac_setup()
166 ctx->cmac_ctx = cmac_ctx; in mbedtls_cipher_cmac_setup()
168 mbedtls_platform_zeroize(cmac_ctx->state, sizeof(cmac_ctx->state)); in mbedtls_cipher_cmac_setup()
200 if( ctx->cmac_ctx != NULL ) in mbedtls_cipher_cmac_starts()
209 mbedtls_cmac_context_t *cmac_ctx; in mbedtls_cipher_cmac_update() local
215 ctx->cmac_ctx == NULL) { in mbedtls_cipher_cmac_update()
219 cmac_ctx = ctx->cmac_ctx; in mbedtls_cipher_cmac_update()
221 state = ctx->cmac_ctx->state; in mbedtls_cipher_cmac_update()
229 if (cmac_ctx->unprocessed_len > 0 && in mbedtls_cipher_cmac_update()
230 ilen > block_size - cmac_ctx->unprocessed_len) { in mbedtls_cipher_cmac_update()
231 memcpy(&cmac_ctx->unprocessed_block[cmac_ctx->unprocessed_len], in mbedtls_cipher_cmac_update()
233 block_size - cmac_ctx->unprocessed_len); in mbedtls_cipher_cmac_update()
235 mbedtls_xor_no_simd(state, cmac_ctx->unprocessed_block, state, block_size); in mbedtls_cipher_cmac_update()
242 input += block_size - cmac_ctx->unprocessed_len; in mbedtls_cipher_cmac_update()
243 ilen -= block_size - cmac_ctx->unprocessed_len; in mbedtls_cipher_cmac_update()
244 cmac_ctx->unprocessed_len = 0; in mbedtls_cipher_cmac_update()
266 memcpy(&cmac_ctx->unprocessed_block[cmac_ctx->unprocessed_len], in mbedtls_cipher_cmac_update()
269 cmac_ctx->unprocessed_len += ilen; in mbedtls_cipher_cmac_update()
279 mbedtls_cmac_context_t *cmac_ctx; in mbedtls_cipher_cmac_finish() local
287 if (ctx == NULL || ctx->cipher_info == NULL || ctx->cmac_ctx == NULL || in mbedtls_cipher_cmac_finish()
292 cmac_ctx = ctx->cmac_ctx; in mbedtls_cipher_cmac_finish()
295 state = cmac_ctx->state; in mbedtls_cipher_cmac_finish()
301 last_block = cmac_ctx->unprocessed_block; in mbedtls_cipher_cmac_finish()
304 if (cmac_ctx->unprocessed_len < block_size) { in mbedtls_cipher_cmac_finish()
305 cmac_pad(M_last, block_size, last_block, cmac_ctx->unprocessed_len); in mbedtls_cipher_cmac_finish()
327 cmac_ctx->unprocessed_len = 0; in mbedtls_cipher_cmac_finish()
328 mbedtls_platform_zeroize(cmac_ctx->unprocessed_block, in mbedtls_cipher_cmac_finish()
329 sizeof(cmac_ctx->unprocessed_block)); in mbedtls_cipher_cmac_finish()
337 mbedtls_cmac_context_t *cmac_ctx; in mbedtls_cipher_cmac_reset() local
339 if (ctx == NULL || ctx->cipher_info == NULL || ctx->cmac_ctx == NULL) { in mbedtls_cipher_cmac_reset()
343 cmac_ctx = ctx->cmac_ctx; in mbedtls_cipher_cmac_reset()
346 cmac_ctx->unprocessed_len = 0; in mbedtls_cipher_cmac_reset()
347 mbedtls_platform_zeroize(cmac_ctx->unprocessed_block, in mbedtls_cipher_cmac_reset()
348 sizeof(cmac_ctx->unprocessed_block)); in mbedtls_cipher_cmac_reset()
349 mbedtls_platform_zeroize(cmac_ctx->state, in mbedtls_cipher_cmac_reset()
350 sizeof(cmac_ctx->state)); in mbedtls_cipher_cmac_reset()