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 <bsd.own.mk>
@@ -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