CVS commit: othersrc/external/bsd/multigest/bin

2014-10-27 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Oct 28 05:52:13 UTC 2014

Added Files:
othersrc/external/bsd/multigest/bin: digest

Log Message:
add script to do work of digest(1) using multigest


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/multigest/bin/digest

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

Added files:

Index: othersrc/external/bsd/multigest/bin/digest
diff -u /dev/null othersrc/external/bsd/multigest/bin/digest:1.1
--- /dev/null	Tue Oct 28 05:52:13 2014
+++ othersrc/external/bsd/multigest/bin/digest	Tue Oct 28 05:52:13 2014
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+if [ -x /usr/pkg/bin/digest ]; then
+	exec /usr/pkg/bin/digest $@
+fi
+
+dig=$2
+
+env LD_LIBRARY_PATH=$(pwd)/../lib ./multigest -a ${dig}



CVS commit: othersrc/external/bsd/multigest

2014-10-27 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Oct 28 05:51:43 UTC 2014

Modified Files:
othersrc/external/bsd/multigest/bin: Makefile
othersrc/external/bsd/multigest/lib: Makefile

Log Message:
FreeBSD mods. *sigh*

adapt to the fact that digest(1) may not be available


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 othersrc/external/bsd/multigest/bin/Makefile
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/multigest/lib/Makefile

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

Modified files:

Index: othersrc/external/bsd/multigest/bin/Makefile
diff -u othersrc/external/bsd/multigest/bin/Makefile:1.7 othersrc/external/bsd/multigest/bin/Makefile:1.8
--- othersrc/external/bsd/multigest/bin/Makefile:1.7	Wed Mar 26 22:13:44 2014
+++ othersrc/external/bsd/multigest/bin/Makefile	Tue Oct 28 05:51:43 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.7 2014/03/26 22:13:44 agc Exp $
+# $NetBSD: Makefile,v 1.8 2014/10/28 05:51:43 agc Exp $
 
 .include 
 
@@ -10,8 +10,14 @@ LIB_MULTIGEST_DIR!=	cd ${.CURDIR}/../lib
 LDADD+=		-L${LIB_MULTIGEST_DIR} -lmultigest
 DPADD+=		${LIB_MULTIGEST_DIR}/libmultigest.a
 
-#CPPFLAGS+=-g -O0
-#LDFLAGS+=-g -O0
+.ifndef PRINTOBJDIR
+PRINTOBJDIR=${MAKE} -V .OBJDIR
+.endif
+
+.ifndef PRODUCTION
+CPPFLAGS+=-g -O0
+LDFLAGS+=-g -O0
+.endif
 
 WARNS=6
 MAN=multigest.1
@@ -64,7 +70,7 @@ t: ${PROG}
 	diff 13.expected 13.out
 	rm -f 13.out
 	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -a whirlpool < 1.in > 14.out
-	digest whirlpool < 1.in > 14.dig.out
+	./digest whirlpool < 1.in > 14.dig.out
 	diff 14.dig.out 14.out
 	rm -f 14.dig.out 14.out
 	echo -n "The quick brown fox jumps over the lazy dog" | env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -a keccak-512 > 15.out

Index: othersrc/external/bsd/multigest/lib/Makefile
diff -u othersrc/external/bsd/multigest/lib/Makefile:1.2 othersrc/external/bsd/multigest/lib/Makefile:1.3
--- othersrc/external/bsd/multigest/lib/Makefile:1.2	Sun Aug 18 18:40:27 2013
+++ othersrc/external/bsd/multigest/lib/Makefile	Tue Oct 28 05:51:43 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2013/08/18 18:40:27 agc Exp $
+# $NetBSD: Makefile,v 1.3 2014/10/28 05:51:43 agc Exp $
 
 LIB=multigest
 
@@ -23,4 +23,11 @@ DIST=${.CURDIR}/../dist
 INCS=multigest.h
 INCSDIR=/usr/include
 
+OSNAME!= uname -s
+
+.if ${OSNAME} == "FreeBSD"
+SHLIBDIR=	/usr/lib
+SHLIB_MAJOR=	0
+.endif
+
 .include 



CVS commit: othersrc/external/bsd/multigest/dist

2014-06-11 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Thu Jun 12 06:19:35 UTC 2014

Modified Files:
othersrc/external/bsd/multigest/dist: blake2.c crc32c.c keccak.c main.c
multigest.c rmd160.c sha1.c tiger.c whirlpool.c

Log Message:
Make this compile WARNS=6 with gcc-4.8


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/multigest/dist/blake2.c
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/multigest/dist/crc32c.c \
othersrc/external/bsd/multigest/dist/rmd160.c \
othersrc/external/bsd/multigest/dist/sha1.c \
othersrc/external/bsd/multigest/dist/tiger.c \
othersrc/external/bsd/multigest/dist/whirlpool.c
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/multigest/dist/keccak.c
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/multigest/dist/main.c
cvs rdiff -u -r1.14 -r1.15 othersrc/external/bsd/multigest/dist/multigest.c

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/blake2.c
diff -u othersrc/external/bsd/multigest/dist/blake2.c:1.3 othersrc/external/bsd/multigest/dist/blake2.c:1.4
--- othersrc/external/bsd/multigest/dist/blake2.c:1.3	Tue Mar  4 02:12:58 2014
+++ othersrc/external/bsd/multigest/dist/blake2.c	Thu Jun 12 06:19:35 2014
@@ -311,7 +311,7 @@ blake2b_compress(BLAKE2_CTX *S, const ui
 	int i;
 
 	for (i = 0; i < 16; ++i) {
-		m[i] = load64(block + i * sizeof(m[i]));
+		m[i] = load64(block + (sizeof(m[i]) * (uint64_t)i));
 	}
 	for (i = 0; i < 8; ++i) {
 		v[i] = S->h[i];
@@ -412,7 +412,7 @@ blake2b_final(BLAKE2_CTX *S, uint8_t *ou
 	blake2b_compress(S, S->buf);
 	for (i = 0; i < 8; ++i) {
 		/* Output full hash to temp buffer */ 
-		store64(buffer + sizeof(S->h[i]) * i, S->h[i]);
+		store64(buffer + (sizeof(S->h[i]) * (uint64_t)i), S->h[i]);
 	}
 	memcpy(out, buffer, outlen);
 	return 0;

Index: othersrc/external/bsd/multigest/dist/crc32c.c
diff -u othersrc/external/bsd/multigest/dist/crc32c.c:1.1.1.1 othersrc/external/bsd/multigest/dist/crc32c.c:1.2
--- othersrc/external/bsd/multigest/dist/crc32c.c:1.1.1.1	Fri Aug 16 06:47:53 2013
+++ othersrc/external/bsd/multigest/dist/crc32c.c	Thu Jun 12 06:19:35 2014
@@ -540,9 +540,9 @@ crc32c_sb8_64_bit(uint32_t crc,
 			p_buf += 4;
 		} else {
 			crc ^= *p_buf++;
-			crc ^= (*p_buf++) << 8;
-			crc ^= (*p_buf++) << 16;
-			crc ^= (*p_buf++) << 24;
+			crc ^= (uint32_t)(*p_buf++) << 8;
+			crc ^= (uint32_t)(*p_buf++) << 16;
+			crc ^= (uint32_t)(*p_buf++) << 24;
 		}
 		term1 = crc_tableil8_o88[crc & 0x00FF] ^
 		crc_tableil8_o80[(crc >> 8) & 0x00FF];
Index: othersrc/external/bsd/multigest/dist/rmd160.c
diff -u othersrc/external/bsd/multigest/dist/rmd160.c:1.1.1.1 othersrc/external/bsd/multigest/dist/rmd160.c:1.2
--- othersrc/external/bsd/multigest/dist/rmd160.c:1.1.1.1	Fri Aug 16 06:47:53 2013
+++ othersrc/external/bsd/multigest/dist/rmd160.c	Thu Jun 12 06:19:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmd160.c,v 1.1.1.1 2013/08/16 06:47:53 agc Exp $	*/
+/*	$NetBSD: rmd160.c,v 1.2 2014/06/12 06:19:35 agc Exp $	*/
 
 /\
  *
@@ -430,10 +430,10 @@ RMD160Final(uint8_t digest[20], RMD160_C
 	if (digest != NULL) {
 		for (i = 0; i < 20; i += 4) {
 			/* extracts the 8 least significant bits. */
-			digest[i] =  context->state[i>>2];
-			digest[i + 1] = (context->state[i>>2] >>  8);
-			digest[i + 2] = (context->state[i>>2] >> 16);
-			digest[i + 3] = (context->state[i>>2] >> 24);
+			digest[i] =  (uint8_t)context->state[i>>2];
+			digest[i + 1] = (uint8_t)(context->state[i>>2] >>  8);
+			digest[i + 2] = (uint8_t)(context->state[i>>2] >> 16);
+			digest[i + 3] = (uint8_t)(context->state[i>>2] >> 24);
 		}
 	}
 }
Index: othersrc/external/bsd/multigest/dist/sha1.c
diff -u othersrc/external/bsd/multigest/dist/sha1.c:1.1.1.1 othersrc/external/bsd/multigest/dist/sha1.c:1.2
--- othersrc/external/bsd/multigest/dist/sha1.c:1.1.1.1	Fri Aug 16 06:47:53 2013
+++ othersrc/external/bsd/multigest/dist/sha1.c	Thu Jun 12 06:19:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sha1.c,v 1.1.1.1 2013/08/16 06:47:53 agc Exp $	*/
+/*	$NetBSD: sha1.c,v 1.2 2014/06/12 06:19:35 agc Exp $	*/
 /*	$OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $	*/
 
 /*
@@ -225,8 +225,8 @@ SHA1Update(SHA1_CTX *context, const uint
 _DIAGASSERT(data != 0);
 
 j = context->count[0];
-if ((context->count[0] += len << 3) < j)
-	context->count[1] += (len>>29)+1;
+if ((context->count[0] += (uint32_t)(len << 3)) < j)
+	context->count[1] += (uint32_t)((len>>29)+1);
 j = (j >> 3) & 63;
 if ((j + len) > 63) {
 	i = 64 - j;
Index: othersrc/external/bsd/multigest/dist/tiger.c
diff -u othersrc/external/bsd/multigest/dist/tiger.c:1.1.1.1 othersrc/external/bsd/multigest/dist/tiger.c:1.2
--- othersrc/external/bsd/multigest/dist/tiger.c:1.1.1.1	Fri Aug 16 06:47:53 2013
+++ othersrc/external/bsd/multigest/dist/tiger.c	Thu Jun 

CVS commit: othersrc/external/bsd/multigest/dist

2014-03-26 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed Mar 26 22:42:22 UTC 2014

Added Files:
othersrc/external/bsd/multigest/dist: Makefile.lib.in
Makefile.libtool.in

Log Message:
add files needed for the portable distribution


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/multigest/dist/Makefile.lib.in \
othersrc/external/bsd/multigest/dist/Makefile.libtool.in

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

Added files:

Index: othersrc/external/bsd/multigest/dist/Makefile.lib.in
diff -u /dev/null othersrc/external/bsd/multigest/dist/Makefile.lib.in:1.1
--- /dev/null	Wed Mar 26 22:42:22 2014
+++ othersrc/external/bsd/multigest/dist/Makefile.lib.in	Wed Mar 26 22:42:22 2014
@@ -0,0 +1,32 @@
+# $NetBSD: Makefile.lib.in,v 1.1 2014/03/26 22:42:22 agc Exp $
+
+LIB=	libmultigest.a
+
+OBJS+= blake2.o
+OBJS+= crc32c.o
+OBJS+= keccak.o
+OBJS+= md5c.o
+OBJS+= multigest.o
+OBJS+= rmd160.o
+OBJS+= sha1.o
+OBJS+= sha2.o
+OBJS+= tiger.o
+OBJS+= whirlpool.o
+
+PREFIX=@PREFIX@
+MANDIR=@MANDIR@
+
+all: ${LIB}
+
+${LIB}: ${OBJS}
+	ar crv ${LIB} ${OBJS}
+
+install:
+	${BSD_INSTALL_LIB} ${LIB} ${DESTDIR}${PREFIX}/lib
+	${BSD_INSTALL_DATA} multigest.h ${DESTDIR}${PREFIX}/include
+	${BSD_INSTALL_DATA} libmultigest.3 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man3
+
+clean:
+	rm -rf *.core ${OBJS} ${LIB}
+cleandist:
+	rm -rf *.core ${OBJS} ${LIB} Makefile
Index: othersrc/external/bsd/multigest/dist/Makefile.libtool.in
diff -u /dev/null othersrc/external/bsd/multigest/dist/Makefile.libtool.in:1.1
--- /dev/null	Wed Mar 26 22:42:22 2014
+++ othersrc/external/bsd/multigest/dist/Makefile.libtool.in	Wed Mar 26 22:42:22 2014
@@ -0,0 +1,35 @@
+# $NetBSD: Makefile.libtool.in,v 1.1 2014/03/26 22:42:22 agc Exp $
+
+LIB=	libmultigest.a
+
+OBJS+= blake2.o
+OBJS+= crc32c.o
+OBJS+= keccak.o
+OBJS+= md5c.o
+OBJS+= multigest.o
+OBJS+= rmd160.o
+OBJS+= sha1.o
+OBJS+= sha2.o
+OBJS+= tiger.o
+OBJS+= whirlpool.o
+
+PREFIX=@PREFIX@
+MANDIR=@MANDIR@
+
+all: ${LIB}
+
+${LIB}: ${OBJS}
+	${LIBTOOL} --mode=link --tag=CC cc -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info 0:0
+
+.c.o:
+	${LIBTOOL} --mode=compile --tag=CC ${CC} ${CFLAGS} -c $<
+
+install:
+	libtool --mode=install ${BSD_INSTALL_LIB} libmultigest.la ${DESTDIR}${PREFIX}/lib
+	${BSD_INSTALL_DATA} multigest.h ${DESTDIR}${PREFIX}/include
+	${BSD_INSTALL_DATA} libmultigest.3 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man3
+
+clean:
+	rm -rf *.core ${OBJS} ${LIB}
+cleandist:
+	rm -rf *.core ${OBJS} ${LIB} Makefile



CVS commit: othersrc/external/bsd/multigest

2014-03-26 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed Mar 26 22:13:44 UTC 2014

Modified Files:
othersrc/external/bsd/multigest/bin: Makefile
othersrc/external/bsd/multigest/dist: multigest.c multigest.h
Added Files:
othersrc/external/bsd/multigest/bin: 28.expected

Log Message:
update multigest to version 20140326

+ allow the digest combiners to be specified anywhere in the list
  of digest algorithms
+ add tests for comb4p


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/multigest/bin/28.expected
cvs rdiff -u -r1.6 -r1.7 othersrc/external/bsd/multigest/bin/Makefile
cvs rdiff -u -r1.13 -r1.14 othersrc/external/bsd/multigest/dist/multigest.c
cvs rdiff -u -r1.10 -r1.11 othersrc/external/bsd/multigest/dist/multigest.h

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

Modified files:

Index: othersrc/external/bsd/multigest/bin/Makefile
diff -u othersrc/external/bsd/multigest/bin/Makefile:1.6 othersrc/external/bsd/multigest/bin/Makefile:1.7
--- othersrc/external/bsd/multigest/bin/Makefile:1.6	Wed Mar 26 06:43:01 2014
+++ othersrc/external/bsd/multigest/bin/Makefile	Wed Mar 26 22:13:44 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2014/03/26 06:43:01 agc Exp $
+# $NetBSD: Makefile,v 1.7 2014/03/26 22:13:44 agc Exp $
 
 .include 
 
@@ -106,3 +106,12 @@ t: ${PROG}
 	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -o 27.out -a rmd160,hash,sha1 2.in
 	diff 27.expected 27.out
 	rm -f 27.out
+	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -o 28.out -a comb4p,sha1,rmd160 < 2.in
+	diff 28.expected 28.out
+	rm -f 28.out
+	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -o 29.out -a sha1,comb4p,rmd160 < 2.in
+	diff 28.expected 29.out
+	rm -f 29.out
+	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -o 30.out -a sha1,rmd160,comb4p < 2.in
+	diff 28.expected 30.out
+	rm -f 30.out

Index: othersrc/external/bsd/multigest/dist/multigest.c
diff -u othersrc/external/bsd/multigest/dist/multigest.c:1.13 othersrc/external/bsd/multigest/dist/multigest.c:1.14
--- othersrc/external/bsd/multigest/dist/multigest.c:1.13	Wed Mar 26 06:43:01 2014
+++ othersrc/external/bsd/multigest/dist/multigest.c	Wed Mar 26 22:13:44 2014
@@ -450,11 +450,13 @@ normalise(multigest_t *multigest, const 
 			break;
 		}
 		for (d = multigest->digs, i = 0 ; i < multigest->digc ; i++, d++) {
-			(*d->update)(&multigest->ctx[d->ctxoff], &data[*from],
-(unsigned)(match[0].rm_so - *from));
-			if (multigest->repllen) {
-(*d->update)(&multigest->ctx[d->ctxoff], multigest->repl,
-	multigest->repllen);
+			if (d->rawsize) {
+(*d->update)(&multigest->ctx[d->ctxoff], &data[*from],
+	(unsigned)(match[0].rm_so - *from));
+if (multigest->repllen) {
+	(*d->update)(&multigest->ctx[d->ctxoff], multigest->repl,
+		multigest->repllen);
+}
 			}
 		}
 		*from = match[0].rm_eo;
@@ -478,13 +480,11 @@ xorbuf(uint8_t *out, uint8_t *in1, uint8
 
 /* a round of comb4p combination */
 static int
-comb4p_round(multigest_t *m, uint8_t *out, uint8_t *in, size_t insize, uint32_t r)
+comb4p_round(multigest_t *m, uint8_t *out, uint8_t *in, multigest_dig_t *d1, multigest_dig_t *d2, uint32_t r)
 {
-	multigest_dig_t	*d;
 	const int	 indian = 1;
 	uint32_t	 b2;
 	uint32_t	 b4;
-	uint32_t	 i;
 	uint8_t		 h1[4096];
 	uint8_t		 h2[4096];
 
@@ -494,16 +494,14 @@ comb4p_round(multigest_t *m, uint8_t *ou
 		b4 = (r & 0x00ff);
 		r = (r & 0xff00ff00) | (b2 >> 16) | (b4 << 16);
 	}
-	for (d = &m->digs[1], i = 1 ; i < m->digc ; i++, d++) {
-		(*d->update)(&m->ctx[d->ctxoff], (const char *)&r, sizeof(r));
-		(*d->update)(&m->ctx[d->ctxoff], (const char *)in, insize);
-	}
-	d = &m->digs[1];
-	(*d->final)(h1, &m->ctx[d->ctxoff]);
-	xorbuf(out, out, h1, d->rawsize);
-	d = &m->digs[2];
-	(*d->final)(h2, &m->ctx[d->ctxoff]);
-	xorbuf(out, out, h2, d->rawsize);
+	(*d1->update)(&m->ctx[d1->ctxoff], (const char *)&r, sizeof(r));
+	(*d2->update)(&m->ctx[d2->ctxoff], (const char *)&r, sizeof(r));
+	(*d1->update)(&m->ctx[d1->ctxoff], (const char *)in, d1->rawsize);
+	(*d2->update)(&m->ctx[d2->ctxoff], (const char *)in, d2->rawsize);
+	(*d1->final)(h1, &m->ctx[d1->ctxoff]);
+	xorbuf(out, out, h1, d1->rawsize);
+	(*d2->final)(h2, &m->ctx[d2->ctxoff]);
+	xorbuf(out, out, h2, d2->rawsize);
 	return 1;
 }
 
@@ -647,7 +645,9 @@ multigest_update(multigest_t *multigest,
 	if (multigest && data) {
 		normalise(multigest, data, len, &from);
 		for (d = multigest->digs, i = 0 ; i < multigest->digc ; i++, d++) {
-			(*d->update)(&multigest->ctx[d->ctxoff], &data[from], (unsigned)(len - from));
+			if (d->rawsize) {
+(*d->update)(&multigest->ctx[d->ctxoff], &data[from], (unsigned)(len - from));
+			}
 		}
 	}
 }
@@ -669,12 +669,14 @@ multigest_final(multigest_t *m, uint8_t 
 			if (!find_digests(m, &d1, &d2)) {
 return;
 			}
+			memset(h1, 0x0, sizeof(h1));
+			memset(h2, 0x0, sizeof(h2));
 			(*d1->final)(h1, &m->ctx[d1->ctxoff]);
 		

CVS commit: othersrc/external/bsd/multigest/dist

2014-03-25 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed Mar 26 06:58:57 UTC 2014

Modified Files:
othersrc/external/bsd/multigest/dist: libmultigest.3

Log Message:
Document the digest combiner functions for libmultigest(3).


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 othersrc/external/bsd/multigest/dist/libmultigest.3

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/libmultigest.3
diff -u othersrc/external/bsd/multigest/dist/libmultigest.3:1.6 othersrc/external/bsd/multigest/dist/libmultigest.3:1.7
--- othersrc/external/bsd/multigest/dist/libmultigest.3:1.6	Tue Mar  4 02:12:58 2014
+++ othersrc/external/bsd/multigest/dist/libmultigest.3	Wed Mar 26 06:58:57 2014
@@ -1,4 +1,4 @@
-.\" $NetBSD: libmultigest.3,v 1.6 2014/03/04 02:12:58 agc Exp $
+.\" $NetBSD: libmultigest.3,v 1.7 2014/03/26 06:58:57 agc Exp $
 .\"
 .\" Copyright (c) 2013,2014 Alistair Crooks 
 .\" All rights reserved.
@@ -23,7 +23,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 3, 2014
+.Dd March 25, 2014
 .Dt LIBMULTIGEST 3
 .Os
 .Sh NAME
@@ -123,6 +123,14 @@ TIGER
 WHIRLPOOL
 .Ed
 .Pp
+In addition, a number of hash combiner functions are defined:
+.Bd -literal -offset indent
+CONCAT
+HASH
+XOR
+COMB4P
+.Ed
+.Pp
 The
 .Dv crc32c
 checksum is a simple, lightweight checksum, as found in SCTP and iSCSI.
@@ -154,6 +162,49 @@ The output from each digest is concatena
 Digest names are provided to the initialisation function in a comma-separated
 list of names.
 .Pp
+The combiner functions define how the individual digests will be combined
+in the finalisation stage.
+They have different qualities, and different uses.
+.Pp
+The
+.Dq CONCAT
+algorithm, the default, simply concatenates the digests in the output.
+It is useful when collision resistance is needed, but not pre-image resistance,
+second pre-image resistance or PRF functionality.
+.Pp
+The
+.Dq Comb4P
+combiner should be used when collision resistance is needed,
+or as a PRF, where target-collision resistance is needed, or
+as a MAC.
+However, this combiner is not as efficient as the other combiner algorithms,
+requiring more CPU cycles.
+.Pp
+The
+.Dq XOR
+combiner xors the first two digests together.
+This is useful as a PRF, but not where
+collision resistance is needed.
+.Pp
+Finally, the
+.Dq HASH
+combiner takes the output of the second digest's
+finalisation routine, and passes that as an update to the current state of
+the first digest, and then finalises the multigest.
+This is useful where pre-image resistance is needed,
+but should not be used if collision resistance is needed.
+.Pp
+If less than two digest algorithms are provided in conjunction
+with a combiner function, a zero multigest will result.
+In addition, if the
+.Dq XOR
+combiner is given the same digest function as input, a zero
+multigest will result.
+The
+.Dq Comb4P
+combiner should be given two digests of the same size,
+or a zero multigest will result.
+.Pp
 There are two interfaces to the
 .Nm
 library, one using the lower-level functions



CVS commit: othersrc/external/bsd/multigest

2014-03-25 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed Mar 26 06:43:01 UTC 2014

Modified Files:
othersrc/external/bsd/multigest/bin: Makefile
othersrc/external/bsd/multigest/dist: multigest.c
Added Files:
othersrc/external/bsd/multigest/bin: 27.expected

Log Message:
allow the hash combiners to be specified anywhere in the list of
algorithms, not just at the start


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/multigest/bin/27.expected
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/multigest/bin/Makefile
cvs rdiff -u -r1.12 -r1.13 othersrc/external/bsd/multigest/dist/multigest.c

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

Modified files:

Index: othersrc/external/bsd/multigest/bin/Makefile
diff -u othersrc/external/bsd/multigest/bin/Makefile:1.5 othersrc/external/bsd/multigest/bin/Makefile:1.6
--- othersrc/external/bsd/multigest/bin/Makefile:1.5	Wed Mar 26 01:20:34 2014
+++ othersrc/external/bsd/multigest/bin/Makefile	Wed Mar 26 06:43:01 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2014/03/26 01:20:34 agc Exp $
+# $NetBSD: Makefile,v 1.6 2014/03/26 06:43:01 agc Exp $
 
 .include 
 
@@ -103,3 +103,6 @@ t: ${PROG}
 	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -o 26.out -a hash,rmd160,sha1 2.in
 	diff 26.expected 26.out
 	rm -f 26.out
+	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -o 27.out -a rmd160,hash,sha1 2.in
+	diff 27.expected 27.out
+	rm -f 27.out

Index: othersrc/external/bsd/multigest/dist/multigest.c
diff -u othersrc/external/bsd/multigest/dist/multigest.c:1.12 othersrc/external/bsd/multigest/dist/multigest.c:1.13
--- othersrc/external/bsd/multigest/dist/multigest.c:1.12	Wed Mar 26 06:22:16 2014
+++ othersrc/external/bsd/multigest/dist/multigest.c	Wed Mar 26 06:43:01 2014
@@ -541,6 +541,8 @@ int
 multigest_init(multigest_t *multigest, const char *algname)
 {
 	multigest_dig_t	*d;
+	multigest_dig_t	*d1;
+	multigest_dig_t	*d2;
 	const Alg	*alg;
 	uint32_t	 ctxoff;
 	uint32_t	 i;
@@ -588,13 +590,25 @@ multigest_init(multigest_t *multigest, c
 			multigest->outsize = multigest->rawsize;
 			break;
 		case COMBINE_COMB4P:
-			multigest->outsize = multigest->digs[1].rawsize * 2;
+			if (!find_digests(multigest, &d1, &d2)) {
+fprintf(stderr, "multigest: comb4p < 2 digests\n");
+return 0;
+			}
+			multigest->outsize = d1->rawsize * 2;
 			break;
 		case COMBINE_XOR:
-			multigest->outsize = multigest->digs[1].rawsize;
+			if (!find_digests(multigest, &d1, &d2)) {
+fprintf(stderr, "multigest: xor < 2 digests\n");
+return 0;
+			}
+			multigest->outsize = d1->rawsize;
 			break;
 		case COMBINE_HASH:
-			multigest->outsize = multigest->digs[1].rawsize;
+			if (!find_digests(multigest, &d1, &d2)) {
+fprintf(stderr, "multigest: hash < 2 digests\n");
+return 0;
+			}
+			multigest->outsize = d1->rawsize;
 			break;
 		}
 		return 1;
@@ -841,11 +855,13 @@ multigest_print_hex(uint8_t *raw, const 
 		if ((alg = findalg(algname)) == NULL) {
 			break;
 		}
-		for (i = 0 ; i < alg->rawsize ; i++) {
-			fprintf(fp, "%02hhx", raw[rawsize + i]);
-		}
-		if (sep) {
-			fprintf(fp, "%s", sep);
+		if (!alg->combiner) {
+			for (i = 0 ; i < alg->rawsize ; i++) {
+fprintf(fp, "%02hhx", raw[rawsize + i]);
+			}
+			if (sep) {
+fprintf(fp, "%s", sep);
+			}
 		}
 		algname += alg->namelen;
 		if (*algname == ',') {

Added files:

Index: othersrc/external/bsd/multigest/bin/27.expected
diff -u /dev/null othersrc/external/bsd/multigest/bin/27.expected:1.1
--- /dev/null	Wed Mar 26 06:43:01 2014
+++ othersrc/external/bsd/multigest/bin/27.expected	Wed Mar 26 06:43:01 2014
@@ -0,0 +1 @@
+RMD160,HASH,SHA1 (2.in) () = ce7d9bbded7d5a51baa114889e81fd8c1e5d89a3



CVS commit: othersrc/external/bsd/multigest/dist

2014-03-25 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed Mar 26 06:22:16 UTC 2014

Modified Files:
othersrc/external/bsd/multigest/dist: multigest.c multigest.h

Log Message:
group all the functions for each digest together - makes it easier to
see what is going on in the wrapper section, and to add new digest
algorithms

just use the first two algorithms when calculating comb4p, xor and
hash combiners.

ride the previous version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 othersrc/external/bsd/multigest/dist/multigest.c
cvs rdiff -u -r1.9 -r1.10 othersrc/external/bsd/multigest/dist/multigest.h

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/multigest.c
diff -u othersrc/external/bsd/multigest/dist/multigest.c:1.11 othersrc/external/bsd/multigest/dist/multigest.c:1.12
--- othersrc/external/bsd/multigest/dist/multigest.c:1.11	Wed Mar 26 01:20:34 2014
+++ othersrc/external/bsd/multigest/dist/multigest.c	Wed Mar 26 06:22:16 2014
@@ -86,137 +86,135 @@
 /*/
 
 static void
-wrap_sha1_init(void *v)
-{
-	SHA1Init(v);
-}
-
-static void
 wrap_md5_init(void *v)
 {
 	MD5Init(v);
 }
 
 static void
-wrap_sha256_init(void *v)
+wrap_md5_update(void *v, const char *data, unsigned len)
 {
-	SHA256_Init(v);
+	MD5Update(v, (const uint8_t *)data, len);
 }
 
 static void
-wrap_sha512_init(void *v)
+wrap_md5_final(uint8_t *raw, void *v)
 {
-	SHA512_Init(v);
+	MD5Final(raw, v);
 }
 
+/*/
+
 static void
-wrap_rmd160_init(void *v)
+wrap_sha1_init(void *v)
 {
-	RMD160Init(v);
+	SHA1Init(v);
 }
 
 static void
-wrap_crc32c_init(void *v)
+wrap_sha1_update(void *v, const char *data, unsigned len)
 {
-	crc32c_init(v);
+	SHA1Update(v, (const uint8_t *)data, len);
 }
 
 static void
-wrap_tiger_init(void *v)
+wrap_sha1_final(uint8_t *raw, void *v)
 {
-	TIGER_Init(v);
+	SHA1Final(raw, v);
 }
 
+/*/
+
 static void
-wrap_tiger2_init(void *v)
+wrap_sha256_init(void *v)
 {
-	TIGER2_Init(v);
+	SHA256_Init(v);
 }
 
 static void
-wrap_blake2_init(void *v)
+wrap_sha256_update(void *v, const char *data, unsigned len)
 {
-	blake2b_init(v, 64);
+	SHA256_Update(v, (const uint8_t *)data, len);
 }
 
 static void
-wrap_whirlpool_init(void *v)
+wrap_sha256_final(uint8_t *raw, void *v)
 {
-	whirlpool_init(v);
+	SHA256_Final(raw, v);
 }
 
+/*/
+
 static void
-wrap_keccak224_init(void *v)
+wrap_sha512_init(void *v)
 {
-	KECCAK_Init(v, 224);
+	SHA512_Init(v);
 }
 
 static void
-wrap_keccak256_init(void *v)
+wrap_sha512_update(void *v, const char *data, unsigned len)
 {
-	KECCAK_Init(v, 256);
+	SHA512_Update(v, (const uint8_t *)data, len);
 }
 
 static void
-wrap_keccak384_init(void *v)
+wrap_sha512_final(uint8_t *raw, void *v)
 {
-	KECCAK_Init(v, 384);
+	SHA512_Final(raw, v);
 }
 
+/*/
+
 static void
-wrap_keccak512_init(void *v)
+wrap_rmd160_init(void *v)
 {
-	KECCAK_Init(v, 512);
+	RMD160Init(v);
 }
 
 static void
-wrap_size_init(void *v)
+wrap_rmd160_update(void *v, const char *data, unsigned len)
 {
-	memset(v, 0x0, sizeof(uint64_t));
+	RMD160Update(v, (const uint8_t *)data, len);
 }
 
 static void
-wrap_null_init(void *v)
+wrap_rmd160_final(uint8_t *raw, void *v)
 {
-	USE_ARG(v);
+	RMD160Final(raw, v);
 }
 
 /*/
 
 static void
-wrap_md5_update(void *v, const char *data, unsigned len)
+wrap_crc32c_init(void *v)
 {
-	MD5Update(v, (const uint8_t *)data, len);
+	crc32c_init(v);
 }
 
 static void
-wrap_sha1_update(void *v, const char *data, unsigned len)
+wrap_crc32c_update(void *v, const char *data, unsigned len)
 {
-	SHA1Update(v, (const uint8_t *)data, len);
+	crc32c_update(v, (const uint8_t *)data, len);
 }
 
 static void
-wrap_sha256_update(void *v, const char *data, unsigned len)
+wrap_crc32c_final(uint8_t *raw, void *v)
 {
-	SHA256_Update(v, (const uint8_t *)data, len);
+	crc32c_final((ctx32_t *)(void *)raw, v);
 }
 
-static void
-wrap_sha512_update(void *v, const char *data, unsigned len)
-{
-	SHA512_Update(v, (const uint8_t *)data, len);
-}
+/*/
 
 static void
-wrap_rmd160_update(void *v, const char *data, unsigned len)
+wrap_tiger_init(void *v)
 {
-	RMD160Update(v, (const uint8_t *)data, len);
+	TIGER_Init(v);
 }
 
 static void
-wrap_crc32c_update(void *v, const char *data, unsigned len)
+wrap_tiger2_init(void *v)
 {
-	crc32c_update(v, (const uint8_t *)data, len);
+	TIGER2_Init(v);
 }
 
 static void
@@ -226,103 +224,107 @@ wrap_tiger_update(void *v, const char *d
 }
 
 static void
-wrap_blake2_update(void *v, const char *data, unsigned len)
+wrap_tiger_final(uint8_t *raw, void *v)
 {
-	blake2b_update(v, (const uint8_t *)data, (uint64_t)len);
+	TIGER_Final(raw, v);
 }
 
+/*/
+
 static void
-wrap_whirlpool_update(void *v, const char *data, unsigned len)
+wrap_blake2_init(void *v)
 {
-	whirlpool_update(v, (const uint8_t *)data, len);
+	blake2b_init(v, 64);
 }
 
 static void
-wrap_keccak_update(void *v, const char *data, unsigned len)
+wrap_blake2_update(void 

CVS commit: othersrc/external/bsd/multigest

2014-03-25 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed Mar 26 01:20:34 UTC 2014

Modified Files:
othersrc/external/bsd/multigest/bin: Makefile
othersrc/external/bsd/multigest/dist: multigest.c multigest.h
Added Files:
othersrc/external/bsd/multigest/bin: 24.expected 25.expected
26.expected

Log Message:
Update multigest to version 20140325

+ add digest combiners to the finalisation part of multigest.
  4 combiners are provided:

  + concat (the default, where output is appended)
collision resistance is needed, but NOT pre-image-resistance,
second pre-image resistance, PRF

  + comb4p
(see "On the Security of Hash function Combiners", Ph.D. thesis
 by Anja Lehmann)


http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.4611&rep=rep1&type=pdf

collision-resistant, PRF, target-collision-resistant, and MAC
not as efficient as other combiners

  + xor (result is final-digest1 ^ final-digest2)
where PRF needed, but NOT collision resistance

  + hash (finalisation part does is update-digest1(final-digest2()))
where pre-image-resistance needed, but NOT collision resistance

  these are specified as pseudo-digests in the algorithm specification
  For a discussion of digest combiners, please see:
  https://tahoe-lafs.org/pipermail/tahoe-dev/2010-June/004575.html

+ modify rawsize calculation to only require as many bytes as will appear
  in the resulting hash


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/multigest/bin/24.expected \
othersrc/external/bsd/multigest/bin/25.expected \
othersrc/external/bsd/multigest/bin/26.expected
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/multigest/bin/Makefile
cvs rdiff -u -r1.10 -r1.11 othersrc/external/bsd/multigest/dist/multigest.c
cvs rdiff -u -r1.8 -r1.9 othersrc/external/bsd/multigest/dist/multigest.h

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

Modified files:

Index: othersrc/external/bsd/multigest/bin/Makefile
diff -u othersrc/external/bsd/multigest/bin/Makefile:1.4 othersrc/external/bsd/multigest/bin/Makefile:1.5
--- othersrc/external/bsd/multigest/bin/Makefile:1.4	Sun Aug 18 06:03:14 2013
+++ othersrc/external/bsd/multigest/bin/Makefile	Wed Mar 26 01:20:34 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2013/08/18 06:03:14 agc Exp $
+# $NetBSD: Makefile,v 1.5 2014/03/26 01:20:34 agc Exp $
 
 .include 
 
@@ -94,3 +94,12 @@ t: ${PROG}
 	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -o 23.out -Fdigest -a blake2,crc32c,md5,rmd160,sha1,sha256,sha3-224,sha3-256,sha3-384,sha3-512,sha512,size,tiger2,tiger,whirlpool -r 2.in
 	diff 23.expected 23.out
 	rm -f 23.out
+	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -o 24.out -a comb4p,rmd160,sha1 2.in
+	diff 24.expected 24.out
+	rm -f 24.out
+	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -o 25.out -a xor,rmd160,sha1 2.in
+	diff 25.expected 25.out
+	rm -f 25.out
+	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -o 26.out -a hash,rmd160,sha1 2.in
+	diff 26.expected 26.out
+	rm -f 26.out

Index: othersrc/external/bsd/multigest/dist/multigest.c
diff -u othersrc/external/bsd/multigest/dist/multigest.c:1.10 othersrc/external/bsd/multigest/dist/multigest.c:1.11
--- othersrc/external/bsd/multigest/dist/multigest.c:1.10	Tue Mar 25 17:44:34 2014
+++ othersrc/external/bsd/multigest/dist/multigest.c	Wed Mar 26 01:20:34 2014
@@ -175,6 +175,12 @@ wrap_size_init(void *v)
 	memset(v, 0x0, sizeof(uint64_t));
 }
 
+static void
+wrap_null_init(void *v)
+{
+	USE_ARG(v);
+}
+
 /*/
 
 static void
@@ -249,6 +255,14 @@ wrap_size_update(void *v, const char *da
 	memcpy(v, &n, sizeof(n));
 }
 
+static void
+wrap_null_update(void *v, const char *data, unsigned len)
+{
+	USE_ARG(v);
+	USE_ARG(data);
+	USE_ARG(len);
+}
+
 /*/
 
 static void
@@ -330,8 +344,20 @@ wrap_size_final(uint8_t *raw, void *v)
 	memcpy(raw, &w, sizeof(w));
 }
 
+static void
+wrap_null_final(uint8_t *raw, void *v)
+{
+	USE_ARG(raw);
+	USE_ARG(v);
+}
+
 /*/
 
+#define COMBINE_CONCAT		0x0
+#define COMBINE_COMB4P		0x1
+#define COMBINE_HASH		0x2
+#define COMBINE_XOR		0x3
+
 /* digest algorithm struct */
 typedef struct Alg {
 	const char	*name;		/* digest name */
@@ -341,30 +367,38 @@ typedef struct Alg {
 	mg_initfunc_t	 init;		/* digest init function */
 	mg_updatefunc_t	 update;	/* digest update function */
 	mg_finalfunc_t	 final;		/* digest final function */
+	uint32_t	 combiner;	/* combination type */
 } Alg;
 
 static const Alg	algs[] = {
-	{ "MD5",	3, sizeof(MD5_CTX), 	16, wrap_md5_init, wrap_md5_update, wrap_md5_final },
-	{ "SHA1",	4, sizeof(SHA1_CTX), 	20, wrap_sha1_init, wrap_sha1_update, wrap_sha1_final },
-	{ "SHA256",	6, sizeof(SHA256_CTX), 	32, wrap_sha256_init, wrap_sha256_update, wrap_sha256_final },
-	{ "SHA512",	6, sizeof(SHA512_CTX), 	64, wrap_sha512_init, wrap_sha512_update, wrap_sha512_final },
-	{ "BLAKE2",	6, sizeof(BLAKE2_CTX),	64, w

CVS commit: othersrc/external/bsd/multigest/dist

2014-03-25 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Mar 25 17:44:34 UTC 2014

Modified Files:
othersrc/external/bsd/multigest/dist: multigest.c

Log Message:
Minor change to multigest

+ avoid advancing the pointer in multigest_format_hex to include a NUL
  byte - unintended side effects in callers


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 othersrc/external/bsd/multigest/dist/multigest.c

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/multigest.c
diff -u othersrc/external/bsd/multigest/dist/multigest.c:1.9 othersrc/external/bsd/multigest/dist/multigest.c:1.10
--- othersrc/external/bsd/multigest/dist/multigest.c:1.9	Wed Mar  5 04:56:00 2014
+++ othersrc/external/bsd/multigest/dist/multigest.c	Tue Mar 25 17:44:34 2014
@@ -586,7 +586,7 @@ multigest_format_hex(uint8_t *raw, const
 			algname += 1;
 		}
 	}
-	return (int)(rawsize + rawsize + 1);
+	return (int)(rawsize + rawsize);
 }
 
 /* return the size of output array we'll need */



CVS commit: othersrc/external/bsd/multigest/dist

2014-03-04 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed Mar  5 04:56:00 UTC 2014

Modified Files:
othersrc/external/bsd/multigest/dist: multigest.c multigest.h

Log Message:
multigest - minor cosmetic changes

bump version number to 20140304


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 othersrc/external/bsd/multigest/dist/multigest.c
cvs rdiff -u -r1.7 -r1.8 othersrc/external/bsd/multigest/dist/multigest.h

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/multigest.c
diff -u othersrc/external/bsd/multigest/dist/multigest.c:1.8 othersrc/external/bsd/multigest/dist/multigest.c:1.9
--- othersrc/external/bsd/multigest/dist/multigest.c:1.8	Tue Mar  4 02:12:58 2014
+++ othersrc/external/bsd/multigest/dist/multigest.c	Wed Mar  5 04:56:00 2014
@@ -436,12 +436,17 @@ multigest_init(multigest_t *multigest, c
 		memset(multigest, 0x0, sizeof(*multigest));
 		multigest->type = strdup(algname);
 		for (i = 0, d = multigest->digs, ctxoff = 0 ;  *algname ; d++, i++) {
-			if (i >= __arraycount(multigest->digs) ||
-			(alg = findalg(algname)) == NULL) {
+			if (i >= __arraycount(multigest->digs)) {
+fprintf(stderr, "too many digest types %u\n", i);
+break;
+			}
+			if ((alg = findalg(algname)) == NULL) {
+fprintf(stderr, "no such algorithm '%.10s'\n", algname);
 break;
 			}
 			if (ctxoff + alg->ctxsize >= multigest->ctxsize) {
 if ((newv = realloc(multigest->ctx, multigest->ctxsize + 4096)) == NULL) {
+	fprintf(stderr, "multigest_init: allocation issues\n");
 	return 0;
 }
 multigest->ctx = newv;
@@ -463,6 +468,7 @@ multigest_init(multigest_t *multigest, c
 		}
 		return 1;
 	}
+	fprintf(stderr, "!multigest || !algname\n");
 	return 0;
 }
 
@@ -599,6 +605,7 @@ multigest_algs_rawsize(const char *alg)
 
 	memset(&m, 0x0, sizeof(m));
 	if (!multigest_init(&m, alg)) {
+		fprintf(stderr, "multigest_init: failed\n");
 		return 0;
 	}
 	size = multigest_get_rawsize(&m);

Index: othersrc/external/bsd/multigest/dist/multigest.h
diff -u othersrc/external/bsd/multigest/dist/multigest.h:1.7 othersrc/external/bsd/multigest/dist/multigest.h:1.8
--- othersrc/external/bsd/multigest/dist/multigest.h:1.7	Tue Mar  4 02:12:58 2014
+++ othersrc/external/bsd/multigest/dist/multigest.h	Wed Mar  5 04:56:00 2014
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013 Alistair Crooks 
+ * Copyright (c) 2014 Alistair Crooks 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #ifndef MULTIGEST_H_
-#define MULTIGEST_H_	20130813
+#define MULTIGEST_H_	20140304
 
 #include 
 



CVS commit: othersrc/external/bsd/multigest/dist

2014-03-03 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Mar  4 02:12:58 UTC 2014

Modified Files:
othersrc/external/bsd/multigest/dist: blake2.c libmultigest.3
multigest.c multigest.h
Added Files:
othersrc/external/bsd/multigest/dist: Makefile.in configure

Log Message:
Minor changes to multigest

Introduce a new multigest_format_raw() function to the multigest
library, which can be used to format a raw multigest value into a
formatted hexadecimal number.

Add a new multigest_algs_rawsize() function, which will return the
space needed (in bytes) to hold a raw multigest for the algorithms
specified. The multigest_get_rawsize() function continues to work
on a multigest_t structure which has already been initialised.

Make blake2 compile without a c99 compiler.

Add faux-autoconf infrastructure for packaging purposes.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/multigest/dist/Makefile.in \
othersrc/external/bsd/multigest/dist/configure
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/multigest/dist/blake2.c
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/multigest/dist/libmultigest.3
cvs rdiff -u -r1.7 -r1.8 othersrc/external/bsd/multigest/dist/multigest.c
cvs rdiff -u -r1.6 -r1.7 othersrc/external/bsd/multigest/dist/multigest.h

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/blake2.c
diff -u othersrc/external/bsd/multigest/dist/blake2.c:1.2 othersrc/external/bsd/multigest/dist/blake2.c:1.3
--- othersrc/external/bsd/multigest/dist/blake2.c:1.2	Sat Aug 17 18:29:35 2013
+++ othersrc/external/bsd/multigest/dist/blake2.c	Tue Mar  4 02:12:58 2014
@@ -254,8 +254,10 @@ blake2b_param_set_personal(blake2b_param
 static inline int
 blake2b_init0(BLAKE2_CTX *S)
 {
+	int	i;
+
 	memset(S, 0, sizeof(*S));
-	for (int i = 0; i < 8; ++i) {
+	for (i = 0; i < 8; ++i) {
 		S->h[i] = blake2b_IV[i];
 	}
 	return 0;
@@ -266,11 +268,12 @@ static int
 blake2b_init_param(BLAKE2_CTX *S, const blake2b_param *P)
 {
 	const uint8_t *p;
+	size_t		i;
 
 	blake2b_init0(S);
 	p = (const uint8_t *)(const void *)(P);
 	/* IV XOR ParamBlock */
-	for (size_t i = 0; i < 8; ++i) {
+	for (i = 0; i < 8; ++i) {
 		S->h[i] ^= load64(p + sizeof(S->h[i]) * i);
 	}
 	return 0;
@@ -395,6 +398,7 @@ int
 blake2b_final(BLAKE2_CTX *S, uint8_t *out, uint8_t outlen)
 {
 	uint8_t buffer[BLAKE2B_OUTBYTES];
+	int	i;
 
 	if (S->buflen > BLAKE2B_BLOCKBYTES) {
 		blake2b_increment_counter(S, BLAKE2B_BLOCKBYTES);
@@ -406,7 +410,7 @@ blake2b_final(BLAKE2_CTX *S, uint8_t *ou
 	blake2b_set_lastblock(S);
 	memset(S->buf + S->buflen, 0, 2 * BLAKE2B_BLOCKBYTES - S->buflen); /* Padding */
 	blake2b_compress(S, S->buf);
-	for (int i = 0; i < 8; ++i) {
+	for (i = 0; i < 8; ++i) {
 		/* Output full hash to temp buffer */ 
 		store64(buffer + sizeof(S->h[i]) * i, S->h[i]);
 	}

Index: othersrc/external/bsd/multigest/dist/libmultigest.3
diff -u othersrc/external/bsd/multigest/dist/libmultigest.3:1.5 othersrc/external/bsd/multigest/dist/libmultigest.3:1.6
--- othersrc/external/bsd/multigest/dist/libmultigest.3:1.5	Sun Aug 18 06:03:14 2013
+++ othersrc/external/bsd/multigest/dist/libmultigest.3	Tue Mar  4 02:12:58 2014
@@ -1,6 +1,6 @@
-.\" $NetBSD: libmultigest.3,v 1.5 2013/08/18 06:03:14 agc Exp $
+.\" $NetBSD: libmultigest.3,v 1.6 2014/03/04 02:12:58 agc Exp $
 .\"
-.\" Copyright (c) 2013 Alistair Crooks 
+.\" Copyright (c) 2013,2014 Alistair Crooks 
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 17, 2013
+.Dd March 3, 2014
 .Dt LIBMULTIGEST 3
 .Os
 .Sh NAME
@@ -69,6 +69,10 @@
 .Fo multigest_get_rawsize
 .Fa "multigest_t *mg"
 .Fc
+.Ft uint32_t
+.Fo multigest_algs_rawsize
+.Fa "const char *algnames"
+.Fc
 .Ft int
 .Fo multigest_format_hex
 .Fa "unsigned char *rawinput" "const char *algorithms"
@@ -80,6 +84,11 @@
 .Fa "const char *outname" "const char *filename" "const char *substregex"
 .Fa "const char *output_separator" "const char *output_format"
 .Fc
+.Ft char *
+.Fo multigest_format_raw
+.Fa "const uint8_t *rawinput" "size_t insize"
+.Fa "char *fmtoutput" "size_t outsize"
+.Fc
 .Sh DESCRIPTION
 .Nm
 is a library interface to calculate multiple digests
@@ -167,6 +176,18 @@ using
 .Fn multigest_format_hex
 or printed, possible to an output file, by
 .Fn multigest_print_hex .
+To format output without printing to a stream,
+the
+.Fn multigest_format_raw
+function can be used.
+To find out the rawsize needed (in bytes) for a multigest,
+the
+.Fn multigest_algs_rawsize
+function can be used, passing the digest algorithm names as
+arguments to the function, or the
+.Fn multigest_get_rawsize
+function can be used if the multigest structure has alread

CVS commit: othersrc/external/bsd/multigest/dist

2014-02-05 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed Feb  5 17:43:17 UTC 2014

Modified Files:
othersrc/external/bsd/multigest/dist: multigest.c

Log Message:
give correct results when running the digest when an mmap(2) fails but
read(2) succeeds


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 othersrc/external/bsd/multigest/dist/multigest.c

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/multigest.c
diff -u othersrc/external/bsd/multigest/dist/multigest.c:1.6 othersrc/external/bsd/multigest/dist/multigest.c:1.7
--- othersrc/external/bsd/multigest/dist/multigest.c:1.6	Thu Aug 22 01:08:10 2013
+++ othersrc/external/bsd/multigest/dist/multigest.c	Wed Feb  5 17:43:17 2014
@@ -669,6 +669,7 @@ uint8_t *
 multigest_file(const char *alg, const char *f, uint8_t *raw, const char *pat, const char *repl)
 {
 	struct stat	 st;
+	multigest_t	 m;
 	ssize_t		 rc;
 	size_t		 size;
 	size_t		 cc;
@@ -676,6 +677,9 @@ multigest_file(const char *alg, const ch
 	FILE		*fp;
 
 	if (f && alg && raw) {
+memset(&m, 0x0, sizeof(m));
+multigest_init(&m, alg);
+multigest_add_subst(&m, pat, repl);
 		if ((fp = fopen(f, "r")) == NULL) {
 			fprintf(stderr, "can't open '%s'\n", f);
 			return 0;
@@ -689,14 +693,16 @@ multigest_file(const char *alg, const ch
 if ((rc = read(fileno(fp), mapped, MB(1))) <= 0) {
 	break;
 }
-multigest_data(alg, mapped, (size_t)rc, raw, pat, repl);
+multigest_update(&m, mapped, (size_t)rc);
 			}
 			free(mapped);
 		} else {
-			multigest_data(alg, mapped, size, raw, pat, repl);
+			multigest_update(&m, mapped, (size_t)size);
 			munmap(mapped, size);
 		}
 		fclose(fp);
+multigest_final(&m, raw);
+multigest_free(&m);
 		return raw;
 	}
 	return NULL;



CVS commit: othersrc/external/bsd/multigest/dist

2013-08-21 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Thu Aug 22 06:37:29 UTC 2013

Modified Files:
othersrc/external/bsd/multigest/dist: keccak.c

Log Message:
minor whitespace differences - no functional change


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/multigest/dist/keccak.c

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/keccak.c
diff -u othersrc/external/bsd/multigest/dist/keccak.c:1.3 othersrc/external/bsd/multigest/dist/keccak.c:1.4
--- othersrc/external/bsd/multigest/dist/keccak.c:1.3	Thu Aug 22 06:32:29 2013
+++ othersrc/external/bsd/multigest/dist/keccak.c	Thu Aug 22 06:37:29 2013
@@ -47,9 +47,9 @@ fromBytesToWords(uint64_t *stateAsWords,
 {
 	unsigned int i, j;
 
-	for(i = 0; i < (KECCAK_PERMUTATION_SIZE_BITS / 64); i++) {
+	for (i = 0; i < (KECCAK_PERMUTATION_SIZE_BITS / 64); i++) {
 		stateAsWords[i] = 0;
-		for(j = 0; j < (64/8); j++) {
+		for (j = 0; j < (64/8); j++) {
 			stateAsWords[i] |= (uint64_t)(state[i*(64/8)+j]) << (8*j);
 		}
 	}
@@ -60,8 +60,8 @@ fromWordsToBytes(uint8_t *state, const u
 {
 	unsigned int i, j;
 
-	for(i = 0; i < (KECCAK_PERMUTATION_SIZE_BITS / 64); i++) {
-		for(j = 0; j < (64/8); j++) {
+	for (i = 0; i < (KECCAK_PERMUTATION_SIZE_BITS / 64); i++) {
+		for (j = 0; j < (64/8); j++) {
 			state[i*(64/8)+j] = (uint8_t)(stateAsWords[i] >> (8*j)) & 0xFF;
 		}
 	}
@@ -70,86 +70,86 @@ fromWordsToBytes(uint8_t *state, const u
 #define INDEX(x, y) (((x)%5)+5*((y)%5))
 #define ROL64(a, offset) (/*CONSTCOND*/(offset != 0) ? uint64_t)a) << offset) ^ (((uint64_t)a) >> (64-offset))) : a)
 
-static void
+static inline void
 theta(uint64_t *A)
 {
 	unsigned int x, y;
 	uint64_t C[5], D[5];
 
-	for(x = 0; x < 5; x++) {
+	for (x = 0; x < 5; x++) {
 		C[x] = 0; 
-		for(y = 0; y < 5; y++) {
+		for (y = 0; y < 5; y++) {
 			C[x] ^= A[INDEX(x, y)];
 		}
 	}
-	for(x = 0; x < 5; x++) {
+	for (x = 0; x < 5; x++) {
 		D[x] = ROL64(C[(x+1)%5], 1) ^ C[(x+4)%5];
 	}
-	for(x = 0; x < 5; x++) {
-		for(y = 0; y < 5; y++) {
+	for (x = 0; x < 5; x++) {
+		for (y = 0; y < 5; y++) {
 			A[INDEX(x, y)] ^= D[x];
 		}
 	}
 }
 
-static void
+static inline void
 rho(KECCAK_CTX *ctx, uint64_t *A)
 {
 	unsigned int x, y;
 
-	for(x = 0; x < 5; x++) {
-		for(y = 0; y < 5; y++) {
+	for (x = 0; x < 5; x++) {
+		for (y = 0; y < 5; y++) {
 			A[INDEX(x, y)] = ROL64(A[INDEX(x, y)], ctx->RhoOffsets[INDEX(x, y)]);
 		}
 	}
 }
 
-static void
+static inline void
 pi(uint64_t *A)
 {
 	unsigned int x, y;
 	uint64_t tempA[25];
 
-	for(x = 0; x < 5; x++) {
-		for(y = 0; y < 5; y++) {
+	for (x = 0; x < 5; x++) {
+		for (y = 0; y < 5; y++) {
 			tempA[INDEX(x, y)] = A[INDEX(x, y)];
 		}
 	}
-	for(x = 0; x < 5; x++) {
-		for(y = 0; y < 5; y++) {
+	for (x = 0; x < 5; x++) {
+		for (y = 0; y < 5; y++) {
 			A[INDEX(0*x+1*y, 2*x+3*y)] = tempA[INDEX(x, y)];
 		}
 	}
 }
 
-static void
+static inline void
 chi(uint64_t *A)
 {
-	unsigned int x, y;
-	uint64_t C[5];
+	unsigned int	x, y;
+	uint64_t	C[5];
 
-	for(y = 0; y < 5; y++) { 
-		for(x = 0; x < 5; x++) {
+	for (y = 0; y < 5; y++) { 
+		for (x = 0; x < 5; x++) {
 			C[x] = A[INDEX(x, y)] ^ ((~A[INDEX(x+1, y)]) & A[INDEX(x+2, y)]);
 		}
-		for(x = 0; x < 5; x++) {
+		for (x = 0; x < 5; x++) {
 			A[INDEX(x, y)] = C[x];
 		}
 	}
 }
 
-static void
+static inline void
 iota(KECCAK_CTX *ctx, uint64_t *A, unsigned int indexRound)
 {
 	A[INDEX(0, 0)] ^= ctx->RoundConstants[indexRound];
 }
 
-static void
+static inline void
 KeccakPermutationOnWords(KECCAK_CTX *ctx, uint64_t *st)
 {
-	unsigned int i;
+	unsigned int	i;
 
-	for(i = 0; i < KECCAK_NUM_ROUNDS; i++) {
+	for (i = 0; i < KECCAK_NUM_ROUNDS; i++) {
 		theta(st);
 		rho(ctx, st);
 		pi(st);
@@ -162,7 +162,7 @@ static void
 keccak_permutation(KECCAK_CTX *ctx)
 {
 	const int	indian = 1;
-	uint64_t stateAsWords[KECCAK_PERMUTATION_SIZE_BITS/64];
+	uint64_t	stateAsWords[KECCAK_PERMUTATION_SIZE_BITS/64];
 
 	if (*(const char *)(const void *)&indian) {
 		/* little endian */
@@ -177,9 +177,9 @@ keccak_permutation(KECCAK_CTX *ctx)
 static void
 KeccakPermutationAfterXor(KECCAK_CTX *ctx, uint8_t *state, const uint8_t *data, unsigned int dataLengthInBytes)
 {
-	unsigned int i;
+	unsigned int	i;
 
-	for(i = 0; i < dataLengthInBytes; i++) {
+	for (i = 0; i < dataLengthInBytes; i++) {
 		state[i] ^= data[i];
 	}
 	keccak_permutation(ctx);
@@ -188,7 +188,7 @@ KeccakPermutationAfterXor(KECCAK_CTX *ct
 static int
 LFSR86540(uint8_t *LFSR)
 {
-	int result = ((*LFSR) & 0x01) != 0;
+	int	result = ((*LFSR) & 0x01) != 0;
 
 	if (((*LFSR) & 0x80) != 0) {
 		/* Primitive polynomial over GF(2): x^8+x^6+x^5+x^4+1 */
@@ -202,12 +202,12 @@ LFSR86540(uint8_t *LFSR)
 static void
 keccak_initialise_RoundConstants(KECCAK_CTX *ctx)
 {
-	uint8_t LFSRstate = 0x01;
-	unsigned int i, j, bitPosition;
+	uint8_t		LFSRstate = 0x01;
+	unsigned int	i, j, bitPosition;
 
-	for(i = 0; i < KE

CVS commit: othersrc/external/bsd/multigest/dist

2013-08-21 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Thu Aug 22 06:32:29 UTC 2013

Modified Files:
othersrc/external/bsd/multigest/dist: keccak.c keccak.h

Log Message:
minor changes to inline one-line functions, better names for definitions,
use sizeof() to bound memset operations, rather than hardcoding lengths.

no functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/multigest/dist/keccak.c \
othersrc/external/bsd/multigest/dist/keccak.h

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/keccak.c
diff -u othersrc/external/bsd/multigest/dist/keccak.c:1.2 othersrc/external/bsd/multigest/dist/keccak.c:1.3
--- othersrc/external/bsd/multigest/dist/keccak.c:1.2	Sat Aug 17 18:29:35 2013
+++ othersrc/external/bsd/multigest/dist/keccak.c	Thu Aug 22 06:32:29 2013
@@ -47,9 +47,9 @@ fromBytesToWords(uint64_t *stateAsWords,
 {
 	unsigned int i, j;
 
-	for(i=0; i<(KeccakPermutationSize/64); i++) {
+	for(i = 0; i < (KECCAK_PERMUTATION_SIZE_BITS / 64); i++) {
 		stateAsWords[i] = 0;
-		for(j=0; j<(64/8); j++) {
+		for(j = 0; j < (64/8); j++) {
 			stateAsWords[i] |= (uint64_t)(state[i*(64/8)+j]) << (8*j);
 		}
 	}
@@ -60,8 +60,8 @@ fromWordsToBytes(uint8_t *state, const u
 {
 	unsigned int i, j;
 
-	for(i=0; i<(KeccakPermutationSize/64); i++) {
-		for(j=0; j<(64/8); j++) {
+	for(i = 0; i < (KECCAK_PERMUTATION_SIZE_BITS / 64); i++) {
+		for(j = 0; j < (64/8); j++) {
 			state[i*(64/8)+j] = (uint8_t)(stateAsWords[i] >> (8*j)) & 0xFF;
 		}
 	}
@@ -76,17 +76,17 @@ theta(uint64_t *A)
 	unsigned int x, y;
 	uint64_t C[5], D[5];
 
-	for(x=0; x<5; x++) {
+	for(x = 0; x < 5; x++) {
 		C[x] = 0; 
-		for(y=0; y<5; y++) {
+		for(y = 0; y < 5; y++) {
 			C[x] ^= A[INDEX(x, y)];
 		}
 	}
-	for(x=0; x<5; x++) {
+	for(x = 0; x < 5; x++) {
 		D[x] = ROL64(C[(x+1)%5], 1) ^ C[(x+4)%5];
 	}
-	for(x=0; x<5; x++) {
-		for(y=0; y<5; y++) {
+	for(x = 0; x < 5; x++) {
+		for(y = 0; y < 5; y++) {
 			A[INDEX(x, y)] ^= D[x];
 		}
 	}
@@ -97,9 +97,9 @@ rho(KECCAK_CTX *ctx, uint64_t *A)
 {
 	unsigned int x, y;
 
-	for(x=0; x<5; x++) {
-		for(y=0; y<5; y++) {
-			A[INDEX(x, y)] = ROL64(A[INDEX(x, y)], ctx->KeccakRhoOffsets[INDEX(x, y)]);
+	for(x = 0; x < 5; x++) {
+		for(y = 0; y < 5; y++) {
+			A[INDEX(x, y)] = ROL64(A[INDEX(x, y)], ctx->RhoOffsets[INDEX(x, y)]);
 		}
 	}
 }
@@ -110,13 +110,13 @@ pi(uint64_t *A)
 	unsigned int x, y;
 	uint64_t tempA[25];
 
-	for(x=0; x<5; x++) {
-		for(y=0; y<5; y++) {
+	for(x = 0; x < 5; x++) {
+		for(y = 0; y < 5; y++) {
 			tempA[INDEX(x, y)] = A[INDEX(x, y)];
 		}
 	}
-	for(x=0; x<5; x++) {
-		for(y=0; y<5; y++) {
+	for(x = 0; x < 5; x++) {
+		for(y = 0; y < 5; y++) {
 			A[INDEX(0*x+1*y, 2*x+3*y)] = tempA[INDEX(x, y)];
 		}
 	}
@@ -128,11 +128,11 @@ chi(uint64_t *A)
 	unsigned int x, y;
 	uint64_t C[5];
 
-	for(y=0; y<5; y++) { 
-		for(x=0; x<5; x++) {
+	for(y = 0; y < 5; y++) { 
+		for(x = 0; x < 5; x++) {
 			C[x] = A[INDEX(x, y)] ^ ((~A[INDEX(x+1, y)]) & A[INDEX(x+2, y)]);
 		}
-		for(x=0; x<5; x++) {
+		for(x = 0; x < 5; x++) {
 			A[INDEX(x, y)] = C[x];
 		}
 	}
@@ -141,7 +141,7 @@ chi(uint64_t *A)
 static void
 iota(KECCAK_CTX *ctx, uint64_t *A, unsigned int indexRound)
 {
-	A[INDEX(0, 0)] ^= ctx->KeccakRoundConstants[indexRound];
+	A[INDEX(0, 0)] ^= ctx->RoundConstants[indexRound];
 }
 
 static void
@@ -149,7 +149,7 @@ KeccakPermutationOnWords(KECCAK_CTX *ctx
 {
 	unsigned int i;
 
-	for(i=0; iKeccakRoundConstants[i] = 0;
-		for(j=0; j<7; j++) {
-			bitPosition = (1RhoOffsets[INDEX(0, 0)] = 0;
 	x = 1;
 	y = 0;
-	for(t=0; t<24; t++) {
-		ctx->KeccakRhoOffsets[INDEX(x, y)] = ((t+1)*(t+2)/2) % 64;
+	for(t = 0; t < 24; t++) {
+		ctx->RhoOffsets[INDEX(x, y)] = ((t+1)*(t+2)/2) % 64;
 		newX = (0*x+1*y) % 5;
 		newY = (2*x+3*y) % 5;
 		x = newX;
@@ -233,31 +233,6 @@ keccak_initialise_RhoOffsets(KECCAK_CTX 
 	}
 }
 
-static void
-keccak_initialize(KECCAK_CTX *ctx)
-{
-	keccak_initialise_RoundConstants(ctx);
-	keccak_initialise_RhoOffsets(ctx);
-}
-
-static void
-keccak_initialise_state(uint8_t *state)
-{
-	memset(state, 0, KeccakPermutationSizeInBytes);
-}
-
-static void
-KeccakAbsorb(KECCAK_CTX *ctx, uint8_t *state, const uint8_t *data, unsigned int laneCount)
-{
-	KeccakPermutationAfterXor(ctx, state, data, laneCount*8);
-}
-
-static void
-keccak_extract(const uint8_t *state, uint8_t *data, unsigned int laneCount)
-{
-	memcpy(data, state, laneCount*8);
-}
-
 static int
 init_sponge(KECCAK_CTX *ctx, unsigned int rate, unsigned int capacity)
 {
@@ -267,12 +242,13 @@ init_sponge(KECCAK_CTX *ctx, unsigned in
 	if ((rate == 0) || (rate >= 1600) || ((rate % 64) != 0)) {
 		return 1;
 	}
-	keccak_initialize(ctx);
+	keccak_initialise_RoundCo

CVS commit: othersrc/external/bsd/multigest/dist

2013-08-21 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Thu Aug 22 01:08:10 UTC 2013

Modified Files:
othersrc/external/bsd/multigest/dist: multigest.c multigest.h

Log Message:
First pass at isolating userland-only code.

Also, only expose a regular expression if we're not in kernel code


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/multigest/dist/multigest.c \
othersrc/external/bsd/multigest/dist/multigest.h

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/multigest.c
diff -u othersrc/external/bsd/multigest/dist/multigest.c:1.5 othersrc/external/bsd/multigest/dist/multigest.c:1.6
--- othersrc/external/bsd/multigest/dist/multigest.c:1.5	Sun Aug 18 06:03:14 2013
+++ othersrc/external/bsd/multigest/dist/multigest.c	Thu Aug 22 01:08:10 2013
@@ -26,6 +26,10 @@
 #include 
 #include 
 
+#ifdef _KERNEL
+#include 
+#include 
+#else
 #include 
 #include 
 #include 
@@ -33,6 +37,7 @@
 #include 
 #include 
 #include 
+#endif
 
 /* digests */
 #include "md5.h"
@@ -376,19 +381,36 @@ findalg(const char *algname)
 	return NULL;
 }
 
-/* percent encode (pseudo-RFC1738) a string */
-static void
-pcstring(FILE *fp, const char *s)
+/* normalise through regexp substitution */
+static int
+normalise(multigest_t *multigest, const char *data, size_t len, int64_t *from)
 {
-	static const char	*pcencodes = "%$\r\n\t ";
+#ifndef _KERNEL
+	multigest_dig_t	*d;
+	regmatch_t	 match[2];
+	uint32_t	 i;
 
-	for ( ; *s ; s++) {
-		if (strchr(pcencodes, *s) == NULL) {
-			fprintf(fp, "%c", *s);
-		} else {
-			fprintf(fp, "%%%02hhx", *s);
+	*from = 0;
+	while (multigest->r && len > 0) {
+		match[0].rm_so = *from;
+		match[0].rm_eo = len;
+		if (regexec(multigest->r, data, 2, match, REG_STARTEND) != 0) {
+			break;
 		}
+		for (d = multigest->digs, i = 0 ; i < multigest->digc ; i++, d++) {
+			(*d->update)(&multigest->ctx[d->ctxoff], &data[*from],
+(unsigned)(match[0].rm_so - *from));
+			if (multigest->repllen) {
+(*d->update)(&multigest->ctx[d->ctxoff], multigest->repl,
+	multigest->repllen);
+			}
+		}
+		*from = match[0].rm_eo;
 	}
+#else
+	*from = 0;
+#endif
+	return 1;
 }
 
 /***/
@@ -449,7 +471,8 @@ int
 multigest_add_subst(multigest_t *multigest, const char *from, const char *to)
 {
 	if (multigest && from && from[0]) {
-		if (regcomp(&multigest->r, from, REG_EXTENDED) != 0) {
+		if ((multigest->r = calloc(1, sizeof(regex_t))) == NULL ||
+		regcomp(multigest->r, from, REG_EXTENDED) != 0) {
 			return 0;
 		}
 		multigest->pat = strdup(from);
@@ -467,27 +490,11 @@ void
 multigest_update(multigest_t *multigest, const char *data, size_t len)
 {
 	multigest_dig_t	*d;
-	regmatch_t	 match[2];
-	regoff_t	 from;
 	uint32_t	 i;
+	int64_t	 	 from;
 
 	if (multigest && data) {
-		for (from = 0; len > 0 ; ) {
-			match[0].rm_so = from;
-			match[0].rm_eo = len;
-			if (regexec(&multigest->r, data, 2, match, REG_STARTEND) != 0) {
-break;
-			}
-			for (d = multigest->digs, i = 0 ; i < multigest->digc ; i++, d++) {
-(*d->update)(&multigest->ctx[d->ctxoff], &data[from],
-	(unsigned)(match[0].rm_so - from));
-if (multigest->repllen) {
-	(*d->update)(&multigest->ctx[d->ctxoff], multigest->repl,
-		multigest->repllen);
-}
-			}
-			from = match[0].rm_eo;
-		}
+		normalise(multigest, data, len, &from);
 		for (d = multigest->digs, i = 0 ; i < multigest->digc ; i++, d++) {
 			(*d->update)(&multigest->ctx[d->ctxoff], &data[from], (unsigned)(len - from));
 		}
@@ -529,67 +536,6 @@ multigest_data(const char *alg, const ch
 	return NULL;
 }
 
-/* run sed, then digest on a file */
-uint8_t *
-multigest_file(const char *alg, const char *f, uint8_t *raw, const char *pat, const char *repl)
-{
-	struct stat	 st;
-	ssize_t		 rc;
-	size_t		 size;
-	size_t		 cc;
-	char		*mapped;
-	FILE		*fp;
-
-	if (f && alg && raw) {
-		if ((fp = fopen(f, "r")) == NULL) {
-			fprintf(stderr, "can't open '%s'\n", f);
-			return 0;
-		}
-		fstat(fileno(fp), &st);
-		size = st.st_size;
-		mapped = mmap(NULL, size, PROT_READ, MAP_SHARED, fileno(fp), 0);
-		if (mapped == MAP_FAILED) {
-			mapped = calloc(1, MB(1));
-			for (cc = 0 ; cc < size ; cc += rc) {
-if ((rc = read(fileno(fp), mapped, MB(1))) <= 0) {
-	break;
-}
-multigest_data(alg, mapped, (size_t)rc, raw, pat, repl);
-			}
-			free(mapped);
-		} else {
-			multigest_data(alg, mapped, size, raw, pat, repl);
-			munmap(mapped, size);
-		}
-		fclose(fp);
-		return raw;
-	}
-	return NULL;
-}
-
-/* free resources used in a sedded digest */
-void
-multigest_free(multigest_t *s)
-{
-	uint32_t	i;
-
-	if (s) {
-		if (s->ctx) {
-			free(s->ctx);
-		}
-		if (s->pat) {
-			free(s->pat);
-			regfree(&s->r);
-		}
-		if (s->repl) {
-			free(s->repl);
-		}
-		for (i = 0 ; i < s->digc ; i++) {
-			free(s->digs[i].alg);
-		}
-	}
-}
-
 /

CVS commit: othersrc/external/bsd/multigest

2013-08-18 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Sun Aug 18 18:40:27 UTC 2013

Modified Files:
othersrc/external/bsd/multigest/dist: md5c.c
othersrc/external/bsd/multigest/lib: Makefile

Log Message:
make sure the correct header files are picked up


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/multigest/dist/md5c.c
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/multigest/lib/Makefile

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/md5c.c
diff -u othersrc/external/bsd/multigest/dist/md5c.c:1.1.1.1 othersrc/external/bsd/multigest/dist/md5c.c:1.2
--- othersrc/external/bsd/multigest/dist/md5c.c:1.1.1.1	Fri Aug 16 06:47:53 2013
+++ othersrc/external/bsd/multigest/dist/md5c.c	Sun Aug 18 18:40:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: md5c.c,v 1.1.1.1 2013/08/16 06:47:53 agc Exp $	*/
+/*	$NetBSD: md5c.c,v 1.2 2013/08/18 18:40:27 agc Exp $	*/
 
 /*
  * This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
@@ -32,7 +32,7 @@
 #include 
 #include 
 #include 
-#include 
+#include "md5.h"
 
 typedef unsigned char *POINTER;
 typedef uint16_t UINT2;

Index: othersrc/external/bsd/multigest/lib/Makefile
diff -u othersrc/external/bsd/multigest/lib/Makefile:1.1.1.1 othersrc/external/bsd/multigest/lib/Makefile:1.2
--- othersrc/external/bsd/multigest/lib/Makefile:1.1.1.1	Fri Aug 16 06:47:53 2013
+++ othersrc/external/bsd/multigest/lib/Makefile	Sun Aug 18 18:40:27 2013
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1.1.1 2013/08/16 06:47:53 agc Exp $
+# $NetBSD: Makefile,v 1.2 2013/08/18 18:40:27 agc Exp $
 
 LIB=multigest
 
@@ -13,8 +13,6 @@ SRCS+= tiger.c
 SRCS+= whirlpool.c
 SRCS+= multigest.c
 
-CPPFLAGS+=-I${DIST}
-
 MAN=libmultigest.3
 
 WARNS=6



CVS commit: othersrc/external/bsd/multigest/dist

2013-08-18 Thread Thomas Klausner
Module Name:othersrc
Committed By:   wiz
Date:   Sun Aug 18 07:09:06 UTC 2013

Modified Files:
othersrc/external/bsd/multigest/dist: multigest.1

Log Message:
Sort options. Consistency. Serial comma. Describe -F instead of -S twice :)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 othersrc/external/bsd/multigest/dist/multigest.1

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/multigest.1
diff -u othersrc/external/bsd/multigest/dist/multigest.1:1.6 othersrc/external/bsd/multigest/dist/multigest.1:1.7
--- othersrc/external/bsd/multigest/dist/multigest.1:1.6	Sun Aug 18 06:03:14 2013
+++ othersrc/external/bsd/multigest/dist/multigest.1	Sun Aug 18 07:09:06 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: multigest.1,v 1.6 2013/08/18 06:03:14 agc Exp $
+.\" $NetBSD: multigest.1,v 1.7 2013/08/18 07:09:06 wiz Exp $
 .\"
 .\" Copyright (c) 2013 Alistair Crooks 
 .\" All rights reserved.
@@ -32,11 +32,11 @@
 .Sh SYNOPSIS
 .Nm
 .Fl r
-.Op Fl F Ar output-format
-.Op Fl S Ar output-separator
 .Op Fl a Ar algorithms
 .Op Fl c Ar digestfile
+.Op Fl F Ar output-format
 .Op Fl o Ar output
+.Op Fl S Ar output-separator
 .Op Fl s Ar /regex/replacement/
 .Op file ...
 .Sh DESCRIPTION
@@ -63,23 +63,20 @@ library.
 .Pp
 The following options are available:
 .Bl -tag -width XregexXreplacementXYYY
-.It Fl S Ar output-separator
+.It Fl a Ar algorithms
+specify a comma-separated list of algorithms to be calculated
+.It Fl c Ar stored-digest-file
+check, or verify, a file containing previously-generated digests
+.It Fl F Ar output-format
 print the output in the format requested.
 Possible values are
 .Dq openssl ,
-.Dq digest
+.Dq digest ,
 and
 .Dq multigest .
 The default is
 .Dq multigest
 which means that any replacement text is printed in a separate field.
-.It Fl S Ar output-separator
-separate each individual digest on output with the provided string.
-The output separator defaults to the null string, i.e. no separator.
-.It Fl a Ar algorithms
-specifies a comma-separated list of algorithms to be calculated
-.It Fl c Ar stored-digest-file
-check, or verify, a file containing previously-generated digests
 .It Fl o Ar output-file
 write the calculated digests to the output file
 .It Fl r
@@ -87,6 +84,9 @@ shorthand for input substitution for the
 .Dq Id
 and
 .Dq NetBSD
+.It Fl S Ar output-separator
+separate each individual digest on output with the provided string.
+The output separator defaults to the null string, i.e. no separator.
 .It Fl s Ar /regex/replacement/
 before calculating digests, run the following transformation on the input
 to normalise any input.



CVS commit: othersrc/external/bsd/multigest

2013-08-17 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Sun Aug 18 06:03:14 UTC 2013

Modified Files:
othersrc/external/bsd/multigest/bin: Makefile
othersrc/external/bsd/multigest/dist: libmultigest.3 main.c multigest.1
multigest.c multigest.h
Added Files:
othersrc/external/bsd/multigest/bin: 22.expected 23.expected

Log Message:
Also add an output format argument to multigest(1).

This can take one of three values:

+ digest (meaning print output in digest(1) format)
i.e. "ALG (file) = digest"

+ openssl (meaning print output in openssl(1) format), or
i.e. "ALG(file)= digest"

+ multigest (meaning output is in multigest format)
i.e. "ALG (file) (substition) = digest"

The default is multigest format.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/multigest/bin/22.expected \
othersrc/external/bsd/multigest/bin/23.expected
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/multigest/bin/Makefile
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/multigest/dist/libmultigest.3 \
othersrc/external/bsd/multigest/dist/main.c \
othersrc/external/bsd/multigest/dist/multigest.c \
othersrc/external/bsd/multigest/dist/multigest.h
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/multigest/dist/multigest.1

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

Modified files:

Index: othersrc/external/bsd/multigest/bin/Makefile
diff -u othersrc/external/bsd/multigest/bin/Makefile:1.3 othersrc/external/bsd/multigest/bin/Makefile:1.4
--- othersrc/external/bsd/multigest/bin/Makefile:1.3	Sun Aug 18 04:45:26 2013
+++ othersrc/external/bsd/multigest/bin/Makefile	Sun Aug 18 06:03:14 2013
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2013/08/18 04:45:26 agc Exp $
+# $NetBSD: Makefile,v 1.4 2013/08/18 06:03:14 agc Exp $
 
 .include 
 
@@ -88,3 +88,9 @@ t: ${PROG}
 	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -o 21.out -S, -a blake2,crc32c,md5,rmd160,sha1,sha256,sha3-224,sha3-256,sha3-384,sha3-512,sha512,size,tiger2,tiger,whirlpool -r 2.in
 	diff 21.expected 21.out
 	rm -f 21.out
+	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -o 22.out -Fopenssl -a blake2,crc32c,md5,rmd160,sha1,sha256,sha3-224,sha3-256,sha3-384,sha3-512,sha512,size,tiger2,tiger,whirlpool -r 2.in
+	diff 22.expected 22.out
+	rm -f 22.out
+	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -o 23.out -Fdigest -a blake2,crc32c,md5,rmd160,sha1,sha256,sha3-224,sha3-256,sha3-384,sha3-512,sha512,size,tiger2,tiger,whirlpool -r 2.in
+	diff 23.expected 23.out
+	rm -f 23.out

Index: othersrc/external/bsd/multigest/dist/libmultigest.3
diff -u othersrc/external/bsd/multigest/dist/libmultigest.3:1.4 othersrc/external/bsd/multigest/dist/libmultigest.3:1.5
--- othersrc/external/bsd/multigest/dist/libmultigest.3:1.4	Sun Aug 18 04:45:26 2013
+++ othersrc/external/bsd/multigest/dist/libmultigest.3	Sun Aug 18 06:03:14 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: libmultigest.3,v 1.4 2013/08/18 04:45:26 agc Exp $
+.\" $NetBSD: libmultigest.3,v 1.5 2013/08/18 06:03:14 agc Exp $
 .\"
 .\" Copyright (c) 2013 Alistair Crooks 
 .\" All rights reserved.
@@ -78,7 +78,7 @@
 .Fo multigest_print_hex
 .Fa "unsigned char *rawinput" "const char *algorithms"
 .Fa "const char *outname" "const char *filename" "const char *substregex"
-.Fa "const char *output_separator"
+.Fa "const char *output_separator" "const char *output_format"
 .Fc
 .Sh DESCRIPTION
 .Nm
Index: othersrc/external/bsd/multigest/dist/main.c
diff -u othersrc/external/bsd/multigest/dist/main.c:1.4 othersrc/external/bsd/multigest/dist/main.c:1.5
--- othersrc/external/bsd/multigest/dist/main.c:1.4	Sun Aug 18 04:45:26 2013
+++ othersrc/external/bsd/multigest/dist/main.c	Sun Aug 18 06:03:14 2013
@@ -141,6 +141,7 @@ int
 main(int argc, char **argv)
 {
 	const char	*outname;
+	const char	*format;
 	const char	*check;
 	const char	*alg;
 	const char	*sub;
@@ -152,10 +153,14 @@ main(int argc, char **argv)
 	int		 i;
 
 	alg = "sha1";
+	format = "multigest";
 	sep = sub = outname = check = NULL;
 	from[0] = to[0] = 0x0;
-	while ((i = getopt(argc, argv, "S:a:c:o:rs:")) != -1) {
+	while ((i = getopt(argc, argv, "F:S:a:c:o:rs:")) != -1) {
 		switch(i) {
+		case 'F':
+			format = optarg;
+			break;
 		case 'S':
 			sep = optarg;
 			break;
@@ -185,7 +190,7 @@ main(int argc, char **argv)
 		}
 	} else if (optind == argc) {
 		if (do_input(alg, raw, from, to)) {
-			multigest_print_hex(raw, alg, outname, NULL, sub, sep);
+			multigest_print_hex(raw, alg, outname, NULL, sub, sep, format);
 		} else {
 			ok = 0;
 		}
@@ -194,7 +199,7 @@ main(int argc, char **argv)
 			if (multigest_file(alg, argv[i], raw, from, to) == NULL) {
 ok = 0;
 			} else {
-multigest_print_hex(raw, alg, outname, argv[i], sub, sep);
+multigest_print_hex(raw, alg, outname, argv[i], sub, sep, format);
 			}
 		}
 	}
Index: othersrc/external/bsd/multigest/dist/multigest.c
diff -u ot

CVS commit: othersrc/external/bsd/multigest

2013-08-17 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Sun Aug 18 04:45:26 UTC 2013

Modified Files:
othersrc/external/bsd/multigest/bin: Makefile
othersrc/external/bsd/multigest/dist: libmultigest.3 main.c multigest.1
multigest.c multigest.h
Added Files:
othersrc/external/bsd/multigest/bin: 21.expected

Log Message:
introduce an output separator to multigest(1), suggested by Thomas Klausner.

Use the output separator to separate the individual digests in the output.
The output separator defaults to the null string, i.e. no output separator.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/multigest/bin/21.expected
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/multigest/bin/Makefile
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/multigest/dist/libmultigest.3 \
othersrc/external/bsd/multigest/dist/main.c \
othersrc/external/bsd/multigest/dist/multigest.c \
othersrc/external/bsd/multigest/dist/multigest.h
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/multigest/dist/multigest.1

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

Modified files:

Index: othersrc/external/bsd/multigest/bin/Makefile
diff -u othersrc/external/bsd/multigest/bin/Makefile:1.2 othersrc/external/bsd/multigest/bin/Makefile:1.3
--- othersrc/external/bsd/multigest/bin/Makefile:1.2	Sat Aug 17 18:29:35 2013
+++ othersrc/external/bsd/multigest/bin/Makefile	Sun Aug 18 04:45:26 2013
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2013/08/17 18:29:35 agc Exp $
+# $NetBSD: Makefile,v 1.3 2013/08/18 04:45:26 agc Exp $
 
 .include 
 
@@ -85,3 +85,6 @@ t: ${PROG}
 	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -o 20.out -a blake2,crc32c,md5,rmd160,sha1,sha256,sha3-224,sha3-256,sha3-384,sha3-512,sha512,size,tiger2,tiger,whirlpool -r 2.in
 	diff 20.expected 20.out
 	rm -f 20.out
+	env LD_LIBRARY_PATH=${LIB_MULTIGEST_DIR} ./${PROG} -o 21.out -S, -a blake2,crc32c,md5,rmd160,sha1,sha256,sha3-224,sha3-256,sha3-384,sha3-512,sha512,size,tiger2,tiger,whirlpool -r 2.in
+	diff 21.expected 21.out
+	rm -f 21.out

Index: othersrc/external/bsd/multigest/dist/libmultigest.3
diff -u othersrc/external/bsd/multigest/dist/libmultigest.3:1.3 othersrc/external/bsd/multigest/dist/libmultigest.3:1.4
--- othersrc/external/bsd/multigest/dist/libmultigest.3:1.3	Sat Aug 17 20:15:35 2013
+++ othersrc/external/bsd/multigest/dist/libmultigest.3	Sun Aug 18 04:45:26 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: libmultigest.3,v 1.3 2013/08/17 20:15:35 agc Exp $
+.\" $NetBSD: libmultigest.3,v 1.4 2013/08/18 04:45:26 agc Exp $
 .\"
 .\" Copyright (c) 2013 Alistair Crooks 
 .\" All rights reserved.
@@ -23,7 +23,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 13, 2013
+.Dd August 17, 2013
 .Dt LIBMULTIGEST 3
 .Os
 .Sh NAME
@@ -78,6 +78,7 @@
 .Fo multigest_print_hex
 .Fa "unsigned char *rawinput" "const char *algorithms"
 .Fa "const char *outname" "const char *filename" "const char *substregex"
+.Fa "const char *output_separator"
 .Fc
 .Sh DESCRIPTION
 .Nm
Index: othersrc/external/bsd/multigest/dist/main.c
diff -u othersrc/external/bsd/multigest/dist/main.c:1.3 othersrc/external/bsd/multigest/dist/main.c:1.4
--- othersrc/external/bsd/multigest/dist/main.c:1.3	Sat Aug 17 20:13:48 2013
+++ othersrc/external/bsd/multigest/dist/main.c	Sun Aug 18 04:45:26 2013
@@ -144,6 +144,7 @@ main(int argc, char **argv)
 	const char	*check;
 	const char	*alg;
 	const char	*sub;
+	const char	*sep;
 	uint8_t		 raw[8192];
 	char	 	 from[128];
 	char	 	 to[128];
@@ -151,10 +152,13 @@ main(int argc, char **argv)
 	int		 i;
 
 	alg = "sha1";
-	sub = outname = check = NULL;
+	sep = sub = outname = check = NULL;
 	from[0] = to[0] = 0x0;
-	while ((i = getopt(argc, argv, "a:c:o:rs:")) != -1) {
+	while ((i = getopt(argc, argv, "S:a:c:o:rs:")) != -1) {
 		switch(i) {
+		case 'S':
+			sep = optarg;
+			break;
 		case 'a':
 			alg = optarg;
 			break;
@@ -181,7 +185,7 @@ main(int argc, char **argv)
 		}
 	} else if (optind == argc) {
 		if (do_input(alg, raw, from, to)) {
-			multigest_print_hex(raw, alg, outname, NULL, sub);
+			multigest_print_hex(raw, alg, outname, NULL, sub, sep);
 		} else {
 			ok = 0;
 		}
@@ -190,7 +194,7 @@ main(int argc, char **argv)
 			if (multigest_file(alg, argv[i], raw, from, to) == NULL) {
 ok = 0;
 			} else {
-multigest_print_hex(raw, alg, outname, argv[i], sub);
+multigest_print_hex(raw, alg, outname, argv[i], sub, sep);
 			}
 		}
 	}
Index: othersrc/external/bsd/multigest/dist/multigest.c
diff -u othersrc/external/bsd/multigest/dist/multigest.c:1.3 othersrc/external/bsd/multigest/dist/multigest.c:1.4
--- othersrc/external/bsd/multigest/dist/multigest.c:1.3	Sat Aug 17 20:13:48 2013
+++ othersrc/external/bsd/multigest/dist/multigest.c	Sun Aug 18 04:45:26 2013
@@ -639,7 +639,7 @@ multigest_format_hex(uint8_t *raw

CVS commit: othersrc/external/bsd/multigest/dist

2013-08-17 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Sat Aug 17 20:15:35 UTC 2013

Modified Files:
othersrc/external/bsd/multigest/dist: libmultigest.3

Log Message:
document the changes to multigest_data() and multigest_file() signatures


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/multigest/dist/libmultigest.3

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/libmultigest.3
diff -u othersrc/external/bsd/multigest/dist/libmultigest.3:1.2 othersrc/external/bsd/multigest/dist/libmultigest.3:1.3
--- othersrc/external/bsd/multigest/dist/libmultigest.3:1.2	Fri Aug 16 07:38:14 2013
+++ othersrc/external/bsd/multigest/dist/libmultigest.3	Sat Aug 17 20:15:35 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: libmultigest.3,v 1.2 2013/08/16 07:38:14 wiz Exp $
+.\" $NetBSD: libmultigest.3,v 1.3 2013/08/17 20:15:35 agc Exp $
 .\"
 .\" Copyright (c) 2013 Alistair Crooks 
 .\" All rights reserved.
@@ -53,15 +53,15 @@
 .Fo multigest_final
 .Fa "unsigned char *rawdigest" "multigest_t *mg"
 .Fc
-.Ft int
+.Ft "uint8_t *"
 .Fo multigest_data
-.Fa "const char *data" "size_t length" "const char *algorithms"
+.Fa "const char *algorithms" "const char *data" "size_t length"
 .Fa "const unsigned char *rawoutput" "const char *substregex"
 .Fa "const char *replacement"
 .Fc
-.Ft int
+.Ft "uint8_t *"
 .Fo multigest_file
-.Fa "const char *filename" "const char *algorithms"
+.Fa "const char *algorithms" "const char *filename"
 .Fa "const unsigned char *rawoutput" "const char *substregex"
 .Fa "const char *replacement"
 .Fc



CVS commit: othersrc/external/bsd/multigest/dist

2013-08-17 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Sat Aug 17 20:13:48 UTC 2013

Modified Files:
othersrc/external/bsd/multigest/dist: main.c multigest.c multigest.h

Log Message:
adapt the signature of the multigest_file() and multigests_data()
functions to return the output digest (albeit in raw format), and to
take the algorithm list as the first argument.  this makes it mirror
the normal digest *Data() and *File() functions signatures.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/multigest/dist/main.c \
othersrc/external/bsd/multigest/dist/multigest.c \
othersrc/external/bsd/multigest/dist/multigest.h

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/main.c
diff -u othersrc/external/bsd/multigest/dist/main.c:1.2 othersrc/external/bsd/multigest/dist/main.c:1.3
--- othersrc/external/bsd/multigest/dist/main.c:1.2	Sat Aug 17 18:29:35 2013
+++ othersrc/external/bsd/multigest/dist/main.c	Sat Aug 17 20:13:48 2013
@@ -51,7 +51,7 @@ do_input(const char *alg, uint8_t *raw, 
 break;
 			}
 		}
-		multigest_data(data, cc, alg, raw, pat, repl);
+		multigest_data(alg, data, cc, raw, pat, repl);
 		free(data);
 		return 1;
 	}
@@ -127,7 +127,7 @@ read_check(const char *check)
 	provided = &in[match[4].rm_so];
 	in[match[1].rm_eo] = in[match[2].rm_eo] = in[match[3].rm_eo] = in[match[4].rm_eo] = 0x0;
 	getsubst(subs, from, sizeof(from), to, sizeof(to));
-	multigest_file(file, alg, raw, from, to);
+	multigest_file(alg, file, raw, from, to);
 	multigest_format_hex(raw, alg, calc, sizeof(calc));
 	if ((ret = memcmp(calc, provided, match[4].rm_eo - match[4].rm_so)) != 0) {
 		fprintf(stderr, "multigest: provided digest:   '%s', calculated digest: '%s'\n", provided, calc);
@@ -187,10 +187,10 @@ main(int argc, char **argv)
 		}
 	} else {
 		for (i = optind ; i < argc ; i++) {
-			if (multigest_file(argv[i], alg, raw, from, to)) {
-multigest_print_hex(raw, alg, outname, argv[i], sub);
-			} else {
+			if (multigest_file(alg, argv[i], raw, from, to) == NULL) {
 ok = 0;
+			} else {
+multigest_print_hex(raw, alg, outname, argv[i], sub);
 			}
 		}
 	}
Index: othersrc/external/bsd/multigest/dist/multigest.c
diff -u othersrc/external/bsd/multigest/dist/multigest.c:1.2 othersrc/external/bsd/multigest/dist/multigest.c:1.3
--- othersrc/external/bsd/multigest/dist/multigest.c:1.2	Sat Aug 17 18:29:35 2013
+++ othersrc/external/bsd/multigest/dist/multigest.c	Sat Aug 17 20:13:48 2013
@@ -512,8 +512,8 @@ multigest_final(multigest_t *multigest, 
 }
 
 /* run sed on data and then digest it */
-int
-multigest_data(const char *data, size_t size, const char *alg, uint8_t *raw, const char *pat, const char *repl)
+uint8_t *
+multigest_data(const char *alg, const char *data, size_t size, uint8_t *raw, const char *pat, const char *repl)
 {
 	multigest_t	s;
 
@@ -524,14 +524,14 @@ multigest_data(const char *data, size_t 
 		multigest_update(&s, data, size);
 		multigest_final(&s, raw);
 		multigest_free(&s);
-		return 1;
+		return raw;
 	}
-	return 0;
+	return NULL;
 }
 
 /* run sed, then digest on a file */
-int
-multigest_file(const char *f, const char *alg, uint8_t *raw, const char *pat, const char *repl)
+uint8_t *
+multigest_file(const char *alg, const char *f, uint8_t *raw, const char *pat, const char *repl)
 {
 	struct stat	 st;
 	ssize_t		 rc;
@@ -554,17 +554,17 @@ multigest_file(const char *f, const char
 if ((rc = read(fileno(fp), mapped, MB(1))) <= 0) {
 	break;
 }
-multigest_data(mapped, (size_t)rc, alg, raw, pat, repl);
+multigest_data(alg, mapped, (size_t)rc, raw, pat, repl);
 			}
 			free(mapped);
 		} else {
-			multigest_data(mapped, size, alg, raw, pat, repl);
+			multigest_data(alg, mapped, size, raw, pat, repl);
 			munmap(mapped, size);
 		}
 		fclose(fp);
-		return 1;
+		return raw;
 	}
-	return 0;
+	return NULL;
 }
 
 /* free resources used in a sedded digest */
Index: othersrc/external/bsd/multigest/dist/multigest.h
diff -u othersrc/external/bsd/multigest/dist/multigest.h:1.2 othersrc/external/bsd/multigest/dist/multigest.h:1.3
--- othersrc/external/bsd/multigest/dist/multigest.h:1.2	Sat Aug 17 18:29:35 2013
+++ othersrc/external/bsd/multigest/dist/multigest.h	Sat Aug 17 20:13:48 2013
@@ -82,8 +82,8 @@ void multigest_update(multigest_t */*mul
 void multigest_final(multigest_t */*multigest*/, uint8_t */*raw*/);
 
 /* high-level interface */
-int multigest_data(const char */*data*/, size_t /*size*/, const char */*alg*/, uint8_t */*raw*/, const char */*pat*/, const char */*repl*/);
-int multigest_file(const char */*f*/, const char */*alg*/, uint8_t */*raw*/, const char */*pat*/, const char */*repl*/);
+uint8_t *multigest_data(const char */*alg*/, const char */*data*/, size_t /*size*/, uint8_t */*raw*/, const char */*pat*/, const char */*repl*/);
+uint8_t *multigest_file(const char */*alg*/, const char */

CVS commit: othersrc/external/bsd/multigest/dist

2013-08-17 Thread Thomas Klausner
Module Name:othersrc
Committed By:   wiz
Date:   Sat Aug 17 18:56:59 UTC 2013

Modified Files:
othersrc/external/bsd/multigest/dist: multigest.1

Log Message:
Drop trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/multigest/dist/multigest.1

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/multigest.1
diff -u othersrc/external/bsd/multigest/dist/multigest.1:1.3 othersrc/external/bsd/multigest/dist/multigest.1:1.4
--- othersrc/external/bsd/multigest/dist/multigest.1:1.3	Sat Aug 17 18:49:46 2013
+++ othersrc/external/bsd/multigest/dist/multigest.1	Sat Aug 17 18:56:59 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: multigest.1,v 1.3 2013/08/17 18:49:46 agc Exp $
+.\" $NetBSD: multigest.1,v 1.4 2013/08/17 18:56:59 wiz Exp $
 .\"
 .\" Copyright (c) 2013 Alistair Crooks 
 .\" All rights reserved.
@@ -70,7 +70,7 @@ write the calculated digests to the outp
 .It Fl r
 shorthand for input substitution for the RCS Identifiers
 .Dq Id
-and 
+and
 .Dq NetBSD
 .It Fl s Ar /regex/replacement/
 before calculating digests, run the following transformation on the input



CVS commit: othersrc/external/bsd/multigest/dist

2013-08-17 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Sat Aug 17 18:49:46 UTC 2013

Modified Files:
othersrc/external/bsd/multigest/dist: multigest.1

Log Message:
Explain command line options. Thanks to wiz for the nudge!


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/multigest/dist/multigest.1

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/multigest.1
diff -u othersrc/external/bsd/multigest/dist/multigest.1:1.2 othersrc/external/bsd/multigest/dist/multigest.1:1.3
--- othersrc/external/bsd/multigest/dist/multigest.1:1.2	Fri Aug 16 07:38:38 2013
+++ othersrc/external/bsd/multigest/dist/multigest.1	Sat Aug 17 18:49:46 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: multigest.1,v 1.2 2013/08/16 07:38:38 wiz Exp $
+.\" $NetBSD: multigest.1,v 1.3 2013/08/17 18:49:46 agc Exp $
 .\"
 .\" Copyright (c) 2013 Alistair Crooks 
 .\" All rights reserved.
@@ -52,6 +52,34 @@ utility is a simple wrapper for the vari
 algorithm implementations, which are located in the standard
 C library, and was designed to be scalable as new message digest
 algorithms are developed.
+.Pp
+The
+.Nm
+utility uses the
+.Xr libmultigest 3
+library.
+.Pp
+The following options are available:
+.Bl -tag -width XregexXreplacementXYYY
+.It Fl a Ar algorithms
+specifies a comma-separated list of algorithms to be calculated
+.It Fl c Ar stored-digest-file
+check, or verify, a file containing previously-generated digests
+.It Fl o Ar output-file
+write the calculated digests to the output file
+.It Fl r
+shorthand for input substitution for the RCS Identifiers
+.Dq Id
+and 
+.Dq NetBSD
+.It Fl s Ar /regex/replacement/
+before calculating digests, run the following transformation on the input
+to normalise any input.
+Using this, the effects of expanding version control system
+identifiers is nullified.
+.El
+.Pp
+If no input files are provided, input is taken from standard input.
 .Sh EXIT STATUS
 .Ex -std multigest
 .Sh SEE ALSO



CVS commit: othersrc/external/bsd/multigest/bin

2013-08-17 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Sat Aug 17 18:30:22 UTC 2013

Added Files:
othersrc/external/bsd/multigest/bin: 3.expected

Log Message:
+ fix a bug whereby large multiple digests overflowed the context space
  because they weren't taking into account the current algorithms context
  space needs
+ add my own copyright where substantial work has been done
+ move to a portable, lightweight RFC1738-inspired encoding for VCS identifiers
  (we can't be assured that any of the vis(3) routines are going to be 
available)
+ re-do all the regression test results to avoid the RCS Ids being expanded
  in checked-in regression tests
+ make keccak sources thread-safe by moving the initialisation space into the
  keccak context space
+ print details of expected and calculated digests during check if the
  digests do NOT match (from Thomas Klausner, the original behaviour was
  from debugging tests - thanks!)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/multigest/bin/3.expected

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

Added files:

Index: othersrc/external/bsd/multigest/bin/3.expected
diff -u /dev/null othersrc/external/bsd/multigest/bin/3.expected:1.1
--- /dev/null	Sat Aug 17 18:30:22 2013
+++ othersrc/external/bsd/multigest/bin/3.expected	Sat Aug 17 18:30:22 2013
@@ -0,0 +1 @@
+114f266e7a71dc51811df9dc994bce4de69170c9



CVS commit: othersrc/external/bsd/multigest

2013-08-17 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Sat Aug 17 18:29:35 UTC 2013

Modified Files:
othersrc/external/bsd/multigest/bin: 10.expected 11.expected
12.expected 19.expected 2.expected 20.expected 4.expected
5.expected 6.expected 7.expected 9.expected Makefile
othersrc/external/bsd/multigest/dist: blake2.c blake2.h keccak.c
keccak.h main.c multigest.c multigest.h
Added Files:
othersrc/external/bsd/multigest/dist: Makefile

Log Message:
multigest changes:

+ fix a bug whereby large multiple digests overflowed the context space
  because they weren't taking into account the current algorithm's context
  space needs
+ add my own copyright where substantial work has been done
+ move to a portable, lightweight RFC1738-inspired encoding for VCS identifiers
  (we can't be assured that any of the vis(3) routines are going to be 
available)
+ re-do all the regression test results to avoid the RCS Ids being expanded
  in checked-in regression tests
+ make keccak sources thread-safe by moving the initialisation space into the
  keccak context space
+ print details of expected and calculated digests during check if the
  digests do NOT match (from Thomas Klausner, the original behaviour was
  from debugging tests - thanks!)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/multigest/bin/10.expected \
othersrc/external/bsd/multigest/bin/11.expected \
othersrc/external/bsd/multigest/bin/12.expected \
othersrc/external/bsd/multigest/bin/19.expected \
othersrc/external/bsd/multigest/bin/2.expected \
othersrc/external/bsd/multigest/bin/20.expected \
othersrc/external/bsd/multigest/bin/4.expected \
othersrc/external/bsd/multigest/bin/5.expected \
othersrc/external/bsd/multigest/bin/6.expected \
othersrc/external/bsd/multigest/bin/7.expected \
othersrc/external/bsd/multigest/bin/9.expected \
othersrc/external/bsd/multigest/bin/Makefile
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/multigest/dist/Makefile
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/multigest/dist/blake2.c \
othersrc/external/bsd/multigest/dist/blake2.h \
othersrc/external/bsd/multigest/dist/keccak.c \
othersrc/external/bsd/multigest/dist/keccak.h \
othersrc/external/bsd/multigest/dist/main.c \
othersrc/external/bsd/multigest/dist/multigest.c \
othersrc/external/bsd/multigest/dist/multigest.h

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

Modified files:

Index: othersrc/external/bsd/multigest/bin/10.expected
diff -u othersrc/external/bsd/multigest/bin/10.expected:1.1.1.1 othersrc/external/bsd/multigest/bin/10.expected:1.2
--- othersrc/external/bsd/multigest/bin/10.expected:1.1.1.1	Fri Aug 16 06:47:53 2013
+++ othersrc/external/bsd/multigest/bin/10.expected	Sat Aug 17 18:29:35 2013
@@ -1,2 +0,0 @@
-provided digest:   '93af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164ffdf08e1ecbb1bb9d0982fb5f3a57c82294befe985e279a0f27e1f193af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164ffdf08e1ecbb1bb9d0982fb5f3a57c82294befe985e279a0f27e1f193af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164ffdf08e1ecbb1bb9d0982fb5f3a57c82294befe985e279a0f27e1f193af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164ffdf08e1ecbb1bb9d0982fb5f3a57c82294befe985e279a0f27e1f193af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164ffdf08e1ecbb1bb9d0982fb5f3a57c82294befe985e279a0f27e1f193af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164ffdf08e1ecbb1bb9d0982fb5f3a57c82294befe985e279a0f27e1f193af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164ffdf08e1ecbb1bb9d0982fb5f3a57c82294befe985e279a0f27e1f193af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164
ffdf08e1ecbb1bb9d0982fb5f3a57c82294befe985e279a0f27e1f193af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164ffdf08e1ecbb1bb9d0982fb5f3a57c82294befe985e279a0f27e1f193af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164ffdf08e1ecbb1bb9d0982fb5f3a57c82294befe985e279a0f27e1f193af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164ffdf08e1ecbb1bb9d0982fb5f3a57c82294befe985e279a0f27e1f1'
-calculated digest: '93af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164ffdf08e1ecbb1bb9d0982fb5f3a57c82294befe985e279a0f27e1f193af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164ffdf08e1ecbb1bb9d0982fb5f3a57c82294befe985e279a0f27e1f193af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164ffdf08e1ecbb1bb9d0982fb5f3a57c82294befe985e279a0f27e1f193af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164ffdf08e1ecbb1bb9d0982fb5f3a57c82294befe985e279a0f27e1f193af9cbe145da570b71c7a57b84dcdb19419a8bc6c8dfad8fc17a935d626fd38b8d7ff164ffdf08e1ecbb1

CVS commit: othersrc/external/bsd/multigest/dist

2013-08-16 Thread Thomas Klausner
Module Name:othersrc
Committed By:   wiz
Date:   Fri Aug 16 07:38:14 UTC 2013

Modified Files:
othersrc/external/bsd/multigest/dist: libmultigest.3

Log Message:
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
othersrc/external/bsd/multigest/dist/libmultigest.3

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/libmultigest.3
diff -u othersrc/external/bsd/multigest/dist/libmultigest.3:1.1.1.1 othersrc/external/bsd/multigest/dist/libmultigest.3:1.2
--- othersrc/external/bsd/multigest/dist/libmultigest.3:1.1.1.1	Fri Aug 16 06:47:53 2013
+++ othersrc/external/bsd/multigest/dist/libmultigest.3	Fri Aug 16 07:38:14 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: libmultigest.3,v 1.1.1.1 2013/08/16 06:47:53 agc Exp $
+.\" $NetBSD: libmultigest.3,v 1.2 2013/08/16 07:38:14 wiz Exp $
 .\"
 .\" Copyright (c) 2013 Alistair Crooks 
 .\" All rights reserved.
@@ -90,7 +90,8 @@ Up to 32 digests can be specified on the
 The data being used as input to the digest can be modified
 by using a regular expression-based substitution operation,
 so that any Version Control System identifiers can be normalised
-before being digested. If no substitution regular expression is provided,
+before being digested.
+If no substitution regular expression is provided,
 the input data will be used as-is.
 .Pp
 The list of digests provided is:



CVS commit: othersrc/external/bsd/multigest/dist

2013-08-16 Thread Thomas Klausner
Module Name:othersrc
Committed By:   wiz
Date:   Fri Aug 16 07:38:38 UTC 2013

Modified Files:
othersrc/external/bsd/multigest/dist: multigest.1

Log Message:
Replace standard sentence by standard macro in standard section.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/multigest/dist/multigest.1

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/multigest.1
diff -u othersrc/external/bsd/multigest/dist/multigest.1:1.1.1.1 othersrc/external/bsd/multigest/dist/multigest.1:1.2
--- othersrc/external/bsd/multigest/dist/multigest.1:1.1.1.1	Fri Aug 16 06:47:53 2013
+++ othersrc/external/bsd/multigest/dist/multigest.1	Fri Aug 16 07:38:38 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: multigest.1,v 1.1.1.1 2013/08/16 06:47:53 agc Exp $
+.\" $NetBSD: multigest.1,v 1.2 2013/08/16 07:38:38 wiz Exp $
 .\"
 .\" Copyright (c) 2013 Alistair Crooks 
 .\" All rights reserved.
@@ -52,10 +52,8 @@ utility is a simple wrapper for the vari
 algorithm implementations, which are located in the standard
 C library, and was designed to be scalable as new message digest
 algorithms are developed.
-.Pp
-The
-.Nm
-utility exits 0 on success, and \*[Gt]0 if an error occurs.
+.Sh EXIT STATUS
+.Ex -std multigest
 .Sh SEE ALSO
 .Xr libmultigest 3
 .Sh HISTORY