X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/e8c3c91f8fb415f754fe861ef69a3da1c8403e71..02dfbd5b7af7816959dbd39c1fe628451204e35f:/dsa-verify.c diff --git a/dsa-verify.c b/dsa-verify.c index 7a1dc11..dbab2df 100644 --- a/dsa-verify.c +++ b/dsa-verify.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: dsa-verify.c,v 1.4 2000/06/17 10:53:35 mdw Exp $ + * $Id: dsa-verify.c,v 1.7 2004/04/08 01:36:15 mdw Exp $ * * DSA signature verification * @@ -27,23 +27,6 @@ * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: dsa-verify.c,v $ - * Revision 1.4 2000/06/17 10:53:35 mdw - * Typesetting fixes. - * - * Revision 1.3 1999/12/10 23:18:38 mdw - * Change interface for suggested destinations. - * - * Revision 1.2 1999/11/23 00:20:04 mdw - * Remove stray debugging code. - * - * Revision 1.1 1999/11/19 19:28:00 mdw - * Implementation of the Digital Signature Algorithm. - * - */ - /*----- Header files ------------------------------------------------------*/ #include "dsa.h" @@ -68,7 +51,7 @@ int dsa_vrfy(const dsa_param *dp, mp *y, mp *m, mp *r, mp *s) { mpmont pm, qm; mp *w; - mpmont_factor f[2]; + mp_expfactor f[2]; int ok; /* --- Ensure that all of the signature bits are in range --- */ @@ -86,8 +69,7 @@ int dsa_vrfy(const dsa_param *dp, mp *y, mp *m, mp *r, mp *s) /* --- Compute %$w = s^{-1} \bmod q$% --- */ { - mp *z = MP_NEW; - mp_gcd(0, 0, &z, dp->q, s); + mp *z = mp_modinv(MP_NEW, s, dp->q); w = mpmont_mul(&qm, MP_NEW, z, qm.r2); mp_drop(z); } @@ -105,7 +87,7 @@ int dsa_vrfy(const dsa_param *dp, mp *y, mp *m, mp *r, mp *s) f[1].base = y; w = mpmont_mexp(&pm, MP_NEW, f, 2); mp_div(0, &w, w, dp->q); - ok = MP_CMP(w, ==, r); + ok = MP_EQ(w, r); /* --- Tidy up --- */