CVS commit: src/lib/libc/hash/md2

2024-01-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 26 21:34:02 UTC 2024

Modified Files:
src/lib/libc/hash/md2: md2.c

Log Message:
move MD2Transform first.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/hash/md2/md2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/hash/md2/md2.c
diff -u src/lib/libc/hash/md2/md2.c:1.8 src/lib/libc/hash/md2/md2.c:1.9
--- src/lib/libc/hash/md2/md2.c:1.8	Sat Jan 20 09:52:47 2024
+++ src/lib/libc/hash/md2/md2.c	Fri Jan 26 16:34:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: md2.c,v 1.8 2024/01/20 14:52:47 christos Exp $	*/
+/*	$NetBSD: md2.c,v 1.9 2024/01/26 21:34:01 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: md2.c,v 1.8 2024/01/20 14:52:47 christos Exp $");
+__RCSID("$NetBSD: md2.c,v 1.9 2024/01/26 21:34:01 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -103,6 +103,30 @@ __weak_alias(MD2Final,_MD2Final)
 __weak_alias(MD2Transform,_MD2Transform)
 #endif
 
+/*
+ * XXX This should not be visible, but due to an accident, it is
+ * XXX so it must remain so.
+ */
+/*static*/ void
+MD2Transform(MD2_CTX *context)
+{
+	uint32_t l, j, k, t;
+
+	/* set block "3" and update "checksum" */
+	for (l = context->C[15], j = 0; j < 16; j++) {
+		context->X[32 + j] = context->X[j] ^ context->X[16 + j];
+		l = context->C[j] ^= S[context->X[16 + j] ^ l];
+	}
+
+	/* mangle input block */
+	for (t = j = 0; j < 18; t = (t + j) % 256, j++)
+		for (k = 0; k < 48; k++)
+			t = context->X[k] = (context->X[k] ^ S[t]);
+
+	/* reset input pointer */
+	context->i = 16;
+}
+
 void
 MD2Init(MD2_CTX *context)
 {
@@ -155,28 +179,5 @@ MD2Final(unsigned char digest[16], MD2_C
 	MD2Init(context);
 }
 
-/*
- * XXX This should not be visible, but due to an accident, it is
- * XXX so it must remain so.
- */
-/*static*/ void
-MD2Transform(MD2_CTX *context)
-{
-	uint32_t l, j, k, t;
-
-	/* set block "3" and update "checksum" */
-	for (l = context->C[15], j = 0; j < 16; j++) {
-		context->X[32 + j] = context->X[j] ^ context->X[16 + j];
-		l = context->C[j] ^= S[context->X[16 + j] ^ l];
-	}
-
-	/* mangle input block */
-	for (t = j = 0; j < 18; t = (t + j) % 256, j++)
-		for (k = 0; k < 48; k++)
-			t = context->X[k] = (context->X[k] ^ S[t]);
-
-	/* reset input pointer */
-	context->i = 16;
-}
 
 #endif /* !HAVE_MD2_H */



CVS commit: src/lib/libc/hash/md2

2024-01-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 26 21:34:02 UTC 2024

Modified Files:
src/lib/libc/hash/md2: md2.c

Log Message:
move MD2Transform first.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/hash/md2/md2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/hash

2023-09-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Sep  4 20:51:40 UTC 2023

Modified Files:
src/lib/libc/hash: hashhl.c

Log Message:
fix pointer vs array function definition issues.

for the backend End and Data functions, use "char buf[HASH_STRLEN]"
instead of "char *buf", to match the public functions.

fixes GCC 12 warning.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/hash/hashhl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/hash

2023-09-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Sep  4 20:51:40 UTC 2023

Modified Files:
src/lib/libc/hash: hashhl.c

Log Message:
fix pointer vs array function definition issues.

for the backend End and Data functions, use "char buf[HASH_STRLEN]"
instead of "char *buf", to match the public functions.

fixes GCC 12 warning.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/hash/hashhl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/hash/hashhl.c
diff -u src/lib/libc/hash/hashhl.c:1.7 src/lib/libc/hash/hashhl.c:1.8
--- src/lib/libc/hash/hashhl.c:1.7	Wed Sep 24 13:18:52 2014
+++ src/lib/libc/hash/hashhl.c	Mon Sep  4 20:51:39 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: hashhl.c,v 1.7 2014/09/24 13:18:52 christos Exp $ */
+/* $NetBSD: hashhl.c,v 1.8 2023/09/04 20:51:39 mrg Exp $ */
 
 /*
  * 
@@ -61,7 +61,7 @@ WA(FNPREFIX(Data),CONCAT(_,FNPREFIX(Data
 #endif /* !MIN */
 
 char *
-FNPREFIX(End)(HASH_CTX *ctx, char *buf)
+FNPREFIX(End)(HASH_CTX *ctx, char buf[HASH_STRLEN])
 {
 	int i;
 	unsigned char digest[HASH_LEN];
@@ -130,7 +130,7 @@ FNPREFIX(File)(const char *filename, cha
 }
 
 char *
-FNPREFIX(Data)(const unsigned char *data, size_t len, char *buf)
+FNPREFIX(Data)(const unsigned char *data, size_t len, char buf[HASH_STRLEN])
 {
 	HASH_CTX ctx;
 



CVS commit: src/lib/libc/hash

2010-01-17 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jan 17 23:10:20 UTC 2010

Modified Files:
src/lib/libc/hash: hashhl.c

Log Message:
Close file handle in error case. Found by cppcheck.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/hash/hashhl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.