/* -*-c-*-
*
- * $Id: dsa-verify.c,v 1.3 1999/12/10 23:18:38 mdw Exp $
+ * $Id: dsa-verify.c,v 1.7 2004/04/08 01:36:15 mdw Exp $
*
* DSA signature verification
*
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* 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,
* MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: dsa-verify.c,v $
- * 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"
{
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 --- */
/* --- 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);
}
- /* --- Compute %$wr%$ and %$wm$% --- */
+ /* --- Compute %$wr$% and %$wm$% --- */
f[0].exp = mpmont_mul(&qm, MP_NEW, w, m);
f[1].exp = mpmont_mul(&qm, MP_NEW, w, r);
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 --- */