git: 77712e81bf99 - stable/13 - crypto: Fix the NULL_HMAC finalizer

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 08 Jul 2022 00:47:12 UTC
The branch stable/13 has been updated by markj:

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

commit 77712e81bf995c621753517b9f11ca2aad186953
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-07-01 15:04:15 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-07-08 00:47:03 +0000

    crypto: Fix the NULL_HMAC finalizer
    
    The current implementation leaves the digest buffer partially
    uninitialized.
    
    Reported by:    syzkaller
    Reviewed by:    jhb
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 8179db52c2c8692cdabf818bf1b7fdf3ad43b2db)
---
 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 d1b79e1385b2..729cff37a036 100644
--- a/sys/opencrypto/xform_null.c
+++ b/sys/opencrypto/xform_null.c
@@ -127,6 +127,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);
 }