git: fd6dd33dc087 - main - opencrypto: fix null esp crypt

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 25 Oct 2022 00:36:23 UTC
The branch main has been updated by kib:

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

commit fd6dd33dc08772fd8a19ec5674bcfb783d18938a
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-10-24 23:02:58 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-10-25 00:24:43 +0000

    opencrypto: fix null esp crypt
    
    Fixes:  3e9470482a1357eef90d007b27ec5d9725ae1111
    Reviewed by:    jhb
    Sponsored by:   Nvidia networking
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D37113
---
 sys/opencrypto/xform_null.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/opencrypto/xform_null.c b/sys/opencrypto/xform_null.c
index 160e1d867792..e8741cbe6366 100644
--- a/sys/opencrypto/xform_null.c
+++ b/sys/opencrypto/xform_null.c
@@ -99,11 +99,15 @@ const struct auth_hash auth_hash_null = {
 static void
 null_crypt(void *key, const uint8_t *in, uint8_t *out)
 {
+	if (in != out)
+		memcpy(out, in, NULL_BLOCK_LEN);
 }
 
 static void
 null_crypt_multi(void *key, const uint8_t *in, uint8_t *out, size_t len)
 {
+	if (in != out)
+		memcpy(out, in, len);
 }
 
 static int
@@ -129,7 +133,7 @@ null_reinit(void *ctx, const uint8_t *buf, u_int len)
 static int
 null_update(void *ctx, const void *buf, u_int len)
 {
-	return 0;
+	return (0);
 }
 
 static void