/* Upon exit, ctx->ptr may be zero only if it was already zero on entry, and len == 0. In all other situations, ctx->ptr will be non-zero on exit (and may have value 16).  */
static void do_cbcmac_chunk(br_eax_context *ctx, const void *data, size_t len)
/* Upon exit, ctx->ptr may be zero only if it was already zero on entry, and len == 0. In all other situations, ctx->ptr will be non-zero on exit (and may have value 16).  */
static void do_cbcmac_chunk(br_eax_context *ctx, const void *data, size_t len)
{
	size_t ptr;
	if (len == 0) {
		return;
	}
	ptr = len & (size_t)15;
	if (ptr == 0) {
		len -= 16;
		ptr = 16;
	} else {
		len -= ptr;
	}
	if (ctx->ptr == 16) {
		(*ctx->bctx)->mac(ctx->bctx, ctx->cbcmac,
			ctx->buf, sizeof ctx->buf);
	}
	(*ctx->bctx)->mac(ctx->bctx, ctx->cbcmac, data, len);
	memcpy(ctx->buf, (const unsigned char *)data + len, ptr);
	ctx->ptr = ptr;
}