git: 33d56e57ece8 - main - crypto: Encrypt the XORed input block for Camellia-CBC.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Sat, 18 Dec 2021 00:48:41 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=33d56e57ece8fd270ed98e5979b4e19b23891329

commit 33d56e57ece8fd270ed98e5979b4e19b23891329
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-12-18 00:46:09 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-12-18 00:46:09 +0000

    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:          f84d708b484b crypto: Move CBC handling into enc_xform_camellia.
    Sponsored by:   The FreeBSD Foundation
---
 sys/opencrypto/xform_cml.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/opencrypto/xform_cml.c b/sys/opencrypto/xform_cml.c
index 8ab18142489c..af8ad22f9b18 100644
--- a/sys/opencrypto/xform_cml.c
+++ b/sys/opencrypto/xform_cml.c
@@ -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);
 }