Commit ee56a52ac4dc72002eb601ba08196572d6e8a092

Guillem Jover 2023-04-09T00:05:02

Sync MD4 changes from OpenBSD Get all changes before this MD4 implementation got removed from OpenBSD.

diff --git a/include/md4.h b/include/md4.h
index c4942b8..7db271e 100644
--- a/include/md4.h
+++ b/include/md4.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: md4.h,v 1.14 2004/05/03 17:30:14 millert Exp $	*/
+/*	$OpenBSD: md4.h,v 1.16 2012/12/05 23:19:57 deraadt Exp $	*/
 
 /*
  * This code implements the MD4 message-digest algorithm.
diff --git a/src/md4.c b/src/md4.c
index fdb646c..b245c54 100644
--- a/src/md4.c
+++ b/src/md4.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: md4.c,v 1.6 2004/05/28 15:10:27 millert Exp $	*/
+/*	$OpenBSD: md4.c,v 1.8 2014/01/08 06:14:56 tedu Exp $	*/
 
 /*
  * This code implements the MD4 message-digest algorithm.
@@ -129,11 +129,9 @@ MD4Final(unsigned char digest[MD4_DIGEST_LENGTH], MD4_CTX *ctx)
 	int i;
 
 	MD4Pad(ctx);
-	if (digest != NULL) {
-		for (i = 0; i < 4; i++)
-			PUT_32BIT_LE(digest + i * 4, ctx->state[i]);
-		memset(ctx, 0, sizeof(*ctx));
-	}
+	for (i = 0; i < 4; i++)
+		PUT_32BIT_LE(digest + i * 4, ctx->state[i]);
+	memset(ctx, 0, sizeof(*ctx));
 }