git: 8179db52c2c8 - main - crypto: Fix the NULL_HMAC finalizer

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 01 Jul 2022 15:31:06 UTC
The branch main has been updated by markj:

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

commit 8179db52c2c8692cdabf818bf1b7fdf3ad43b2db
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-07-01 15:04:15 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-07-01 15:04:15 +0000

    crypto: Fix the NULL_HMAC finalizer
    
    The current implementation leaves the digest buffer partially
    uninitialized.
    
    Reported by:    syzkaller
    Reviewed by:    jhb
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D35547
---
 sys/opencrypto/xform_null.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/opencrypto/xform_null.c b/sys/opencrypto/xform_null.c
index e070a4a97142..160e1d867792 100644
--- a/sys/opencrypto/xform_null.c
+++ b/sys/opencrypto/xform_null.c
@@ -135,6 +135,5 @@ null_update(void *ctx, const void *buf, u_int len)
 static void
 null_final(uint8_t *buf, void *ctx)
 {
-	if (buf != (uint8_t *) 0)
-		bzero(buf, 12);
+	bzero(buf, NULL_HASH_LEN);
 }