crypto: Encrypt the XORed input block for Camellia-CBC.

This fixes a regression in the previous change to move CBC chaining
into enc_xform_camellia which passed the raw input into the encrypt
function (thus not actually doing the chaining).  This still works
when using the same buffer for input and output which is why my
initial testing with cryptocheck didn't catch it.

Fixes:		f84d708b48 crypto: Move CBC handling into enc_xform_camellia.
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
John Baldwin 2021-12-17 16:46:09 -08:00
parent 04781697f8
commit 33d56e57ec

View File

@ -88,7 +88,7 @@ cml_encrypt(void *vctx, const uint8_t *in, uint8_t *out)
for (u_int i = 0; i < CAMELLIA_BLOCK_LEN; i++)
out[i] = in[i] ^ ctx->iv[i];
camellia_encrypt(&ctx->state, in, out);
camellia_encrypt(&ctx->state, out, out);
memcpy(ctx->iv, out, CAMELLIA_BLOCK_LEN);
}