X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/b817bfc642225b8c3c0b6a7e42d1fb949b61a606..4910e99cff730c78c7827ae1f85d33184975c5dd:/gdsa.c diff --git a/gdsa.c b/gdsa.c index 9b23f4f..10f6b6d 100644 --- a/gdsa.c +++ b/gdsa.c @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: gdsa.c,v 1.2 2004/04/08 01:36:15 mdw Exp $ + * $Id$ * * Generalized version of DSA * * (c) 2004 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,12 +15,12 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, @@ -57,11 +57,11 @@ ghash *gdsa_beginhash(const gdsa *c) { return (GH_INIT(c->h)); } * Returns: --- * * Use: Does any final thing that DSA wants to do when hashing a - * message. (Actually, there's nothing.) The hashing context + * message. (Actually, there's nothing.) The hashing context * isn't finalized. */ -void gdsa_endhash(gdsa *c, ghash *h) { ; } +void gdsa_endhash(const gdsa *c, ghash *h) { ; } /* --- @gdsa_sign@ --- * * @@ -88,10 +88,10 @@ void gdsa_sign(const gdsa *c, gdsa_sig *s, const void *m, mp *k) new_k: k = mprand_range(k, g->r, c->r, 0); have_k: - if (MP_ISZERO(k)) goto new_k; + if (MP_ZEROP(k)) goto new_k; G_EXP(g, z, g->g, k); sr = G_TOINT(g, sr, z); assert(sr); - if (MP_ISZERO(sr)) goto new_k; + if (MP_ZEROP(sr)) goto new_k; mp_div(0, &sr, sr, g->r); mpbarrett_create(&b, g->r); @@ -167,7 +167,7 @@ static void showge(group *g, const char *p, ge *x) { } static void showmp(const char *p, mp *x, int r) { - fprintf(stderr, "*** %s = ", p); mp_writefile(x, stderr, r); + fprintf(stderr, "*** %s = ", p); mp_writefile(x, stderr, r); putc('\n', stderr); }