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 <bsd.own.mk>
@@ -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 <[email protected]>
.\" 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 othersrc/external/bsd/multigest/dist/multigest.c:1.4 othersrc/external/bsd/multigest/dist/multigest.c:1.5
--- othersrc/external/bsd/multigest/dist/multigest.c:1.4 Sun Aug 18 04:45:26 2013
+++ othersrc/external/bsd/multigest/dist/multigest.c Sun Aug 18 06:03:14 2013
@@ -639,7 +639,8 @@ multigest_format_hex(uint8_t *raw, const
/* print as hex string */
int
-multigest_print_hex(uint8_t *raw, const char *algname, const char *outname, const char *f, const char *sub, const char *sep)
+multigest_print_hex(uint8_t *raw, const char *algname, const char *outname,
+ const char *f, const char *sub, const char *sep, const char *format)
{
const Alg *alg;
size_t rawsize;
@@ -658,11 +659,17 @@ multigest_print_hex(uint8_t *raw, const
for (i = 0 ; algname[i] ; i++) {
fprintf(fp, "%c", toupper((uint8_t)algname[i]));
}
- fprintf(fp, " (%s) (", f);
- if (sub) {
- pcstring(fp, sub);
+ if (format && strcasecmp(format, "openssl") == 0) {
+ fprintf(fp, "(%s)= ", f);
+ } else if (format && strcasecmp(format, "digest") == 0) {
+ fprintf(fp, " (%s) = ", f);
+ } else {
+ fprintf(fp, " (%s) (", f);
+ if (sub) {
+ pcstring(fp, sub);
+ }
+ fprintf(fp, ") = ");
}
- fprintf(fp, ") = ");
}
for (rawsize = 0 ; *algname ; rawsize += alg->rawsize) {
if ((alg = findalg(algname)) == NULL) {
Index: othersrc/external/bsd/multigest/dist/multigest.h
diff -u othersrc/external/bsd/multigest/dist/multigest.h:1.4 othersrc/external/bsd/multigest/dist/multigest.h:1.5
--- othersrc/external/bsd/multigest/dist/multigest.h:1.4 Sun Aug 18 04:45:26 2013
+++ othersrc/external/bsd/multigest/dist/multigest.h Sun Aug 18 06:03:14 2013
@@ -89,7 +89,7 @@ uint8_t *multigest_file(const char */*al
void multigest_unpcstring(const char */*in*/, size_t /*isize*/, char */*out*/, size_t /*osize*/);
uint32_t multigest_get_rawsize(multigest_t */*multigest*/);
int multigest_format_hex(uint8_t */*raw*/, const char */*algname*/, char */*out*/, size_t /*size*/);
-int multigest_print_hex(uint8_t */*raw*/, const char */*algname*/, const char */*outname*/, const char */*f*/, const char */*sub*/, const char */*sep*/);
+int multigest_print_hex(uint8_t */*raw*/, const char */*algname*/, const char */*outname*/, const char */*f*/, const char */*sub*/, const char */*sep*/, const char */*format*/);
__END_DECLS
Index: othersrc/external/bsd/multigest/dist/multigest.1
diff -u othersrc/external/bsd/multigest/dist/multigest.1:1.5 othersrc/external/bsd/multigest/dist/multigest.1:1.6
--- othersrc/external/bsd/multigest/dist/multigest.1:1.5 Sun Aug 18 04:45:26 2013
+++ othersrc/external/bsd/multigest/dist/multigest.1 Sun Aug 18 06:03:14 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: multigest.1,v 1.5 2013/08/18 04:45:26 agc Exp $
+.\" $NetBSD: multigest.1,v 1.6 2013/08/18 06:03:14 agc Exp $
.\"
.\" Copyright (c) 2013 Alistair Crooks <[email protected]>
.\" All rights reserved.
@@ -32,6 +32,7 @@
.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
@@ -63,6 +64,16 @@ library.
The following options are available:
.Bl -tag -width XregexXreplacementXYYY
.It Fl S Ar output-separator
+print the output in the format requested.
+Possible values are
+.Dq openssl ,
+.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
Added files:
Index: othersrc/external/bsd/multigest/bin/22.expected
diff -u /dev/null othersrc/external/bsd/multigest/bin/22.expected:1.1
--- /dev/null Sun Aug 18 06:03:14 2013
+++ othersrc/external/bsd/multigest/bin/22.expected Sun Aug 18 06:03:14 2013
@@ -0,0 +1 @@
+BLAKE2,CRC32C,MD5,RMD160,SHA1,SHA256,SHA3-224,SHA3-256,SHA3-384,SHA3-512,SHA512,SIZE,TIGER2,TIGER,WHIRLPOOL(2.in)= 5388c3a6ac094bd49d82ca1404d111cbf1cbb64cd6a7cd47b7b366b1b89447988a96f2064d9e7d48746fee39128f33bfd3e537085d48088f7ddc6da8d4b2e7df279934d7b43c46ba05e28788df71eaea4777912ffaad8f20db6708582703a0ef4bc79a61c34a91bc114f266e7a71dc51811df9dc994bce4de69170c9835bc89fbf57f3a6aa9168b776bd3ef2ba6bcf6e6934a12380b10272ae73679c1cd5c98e369f050cdef21f260e4930e2d4fb50dbd89ebe73b45867f8c8db407d733900b40499f5103018696d773bb246a23d465d8fa2ef5a8b7ecf29fd303cf644be9d1c638bb8aaf5f7ba48eadd3e7fd86f6fa3f4fd378e7d39626077a56b343e5beffe6dc1de78b33a4dfa349259f3a560d4eaef508b4ce9cf1d84199b0a3db8dd0d4f5fe5d9e52beb40d660890296b1275cf75b49544ff76e0db804eca97aa9fc2e7c4de96a3fb8af2069a92644bdf34583700776b58728501c15ee8300feb6ddba910c462618bce2221a0445036a2d46e676ef32988283372710701eb39fa7a59821b740bf07a3d364a500000000000016955be276d25e1bb131e9f3089052492cfa3da484855759a53238eb28030a6a3e9511e2d1dbee
6e37c0dd3f93c55b149acf4d77b962c86eb1303d186bf2fdc8f011511b0f720f3171850aec1a462e2067218ee672d0b66950cf7ee6078df0593a9fd22109984cc31b2fd327b223f1a7c634
Index: othersrc/external/bsd/multigest/bin/23.expected
diff -u /dev/null othersrc/external/bsd/multigest/bin/23.expected:1.1
--- /dev/null Sun Aug 18 06:03:14 2013
+++ othersrc/external/bsd/multigest/bin/23.expected Sun Aug 18 06:03:14 2013
@@ -0,0 +1 @@
+BLAKE2,CRC32C,MD5,RMD160,SHA1,SHA256,SHA3-224,SHA3-256,SHA3-384,SHA3-512,SHA512,SIZE,TIGER2,TIGER,WHIRLPOOL (2.in) = 5388c3a6ac094bd49d82ca1404d111cbf1cbb64cd6a7cd47b7b366b1b89447988a96f2064d9e7d48746fee39128f33bfd3e537085d48088f7ddc6da8d4b2e7df279934d7b43c46ba05e28788df71eaea4777912ffaad8f20db6708582703a0ef4bc79a61c34a91bc114f266e7a71dc51811df9dc994bce4de69170c9835bc89fbf57f3a6aa9168b776bd3ef2ba6bcf6e6934a12380b10272ae73679c1cd5c98e369f050cdef21f260e4930e2d4fb50dbd89ebe73b45867f8c8db407d733900b40499f5103018696d773bb246a23d465d8fa2ef5a8b7ecf29fd303cf644be9d1c638bb8aaf5f7ba48eadd3e7fd86f6fa3f4fd378e7d39626077a56b343e5beffe6dc1de78b33a4dfa349259f3a560d4eaef508b4ce9cf1d84199b0a3db8dd0d4f5fe5d9e52beb40d660890296b1275cf75b49544ff76e0db804eca97aa9fc2e7c4de96a3fb8af2069a92644bdf34583700776b58728501c15ee8300feb6ddba910c462618bce2221a0445036a2d46e676ef32988283372710701eb39fa7a59821b740bf07a3d364a500000000000016955be276d25e1bb131e9f3089052492cfa3da484855759a53238eb28030a6a3e9511e2d1db
ee6e37c0dd3f93c55b149acf4d77b962c86eb1303d186bf2fdc8f011511b0f720f3171850aec1a462e2067218ee672d0b66950cf7ee6078df0593a9fd22109984cc31b2fd327b223f1a7c634