From 365c07f5d43efe54f7eba674b20f398092a1f53f Mon Sep 17 00:00:00 2001 From: mdw Date: Sat, 15 Jul 2000 20:53:23 +0000 Subject: [PATCH] More hash functions. Bug fix in getstring. --- dsig.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/dsig.c b/dsig.c index 32b5ea5..eb70191 100644 --- a/dsig.c +++ b/dsig.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: dsig.c,v 1.2 2000/07/01 11:27:22 mdw Exp $ + * $Id: dsig.c,v 1.3 2000/07/15 20:53:23 mdw Exp $ * * Verify signatures on distribuitions of files * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: dsig.c,v $ + * Revision 1.3 2000/07/15 20:53:23 mdw + * More hash functions. Bug fix in getstring. + * * Revision 1.2 2000/07/01 11:27:22 mdw * Use new PKCS#1 padding functions rather than rolling by hand. * @@ -55,18 +58,25 @@ #include #include -#include "dsa.h" #include "getdate.h" #include "grand.h" #include "ghash.h" #include "key.h" #include "key-data.h" -#include "md5.h" #include "noise.h" + +#include "dsa.h" +#include "rsa.h" #include "pkcs1.h" + +#include "md4.h" +#include "md5.h" +#include "rmd128.h" #include "rmd160.h" -#include "rsa.h" +#include "rmd256.h" +#include "rmd320.h" #include "sha.h" +#include "tiger.h" /*----- Digital signature algorithm ---------------------------------------*/ @@ -85,6 +95,8 @@ static int dsasign(key *k, const void *m, size_t msz, dstr *d) return (e); } sz = mp_octets(dp.dp.q); + if (sz < msz) + die(EXIT_FAILURE, "hash function too wide for this signing key"); DENSURE(d, sz * 2); p = d->buf + d->len; rand_get(RAND_GLOBAL, p, sz); @@ -175,7 +187,8 @@ typedef struct sig { const void */*s*/, size_t /*ssz*/); } sig; -static const gchash *hashtab[] = { &rmd160, &sha, &md5, 0 }; +static const gchash *hashtab[] = { + &rmd160, &tiger, &sha, &rmd128, &rmd256, &rmd320, &md5, &md4, 0 }; static sig sigtab[] = { { "dsa", "dsig-dsa", dsasign, dsaverify }, { "rsa", "dsig-rsa", rsasign, rsaverify }, @@ -365,7 +378,7 @@ again: if (ch == EOF) break; switch (ch) { - case 'a': ch = '\n'; break; + case 'a': ch = '\a'; break; case 'b': ch = '\b'; break; case 'f': ch = '\f'; break; case 'n': ch = '\n'; break; @@ -374,6 +387,7 @@ again: case 'v': ch = '\v'; break; } DPUTC(d, ch); + ch = getc(fp); continue; } -- 2.11.0