/* -*-c-*-
*
- * $Id: dh-check.c,v 1.1 2001/02/03 16:08:24 mdw Exp $
+ * $Id: dh-check.c,v 1.3 2004/04/08 01:36:15 mdw Exp $
*
* Checks Diffie-Hellman group parameters
*
* (c) 2001 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: dh-check.c,v $
- * Revision 1.1 2001/02/03 16:08:24 mdw
- * Add consistency checking for public keys.
- *
- */
-
/*----- Header files ------------------------------------------------------*/
#include <mLib/dstr.h>
mpmont mm;
mp *pm1 = MP_NEW;
mp *q = MP_NEW;
+ mp *x;
mpmul mu;
size_t i;
goto fail;
q = mp_odd(q, dp->q, &i);
mpmont_create(&mm, dp->p);
- q = mpmont_expr(&mm, q, dp->g, q);
+ x = mpmont_mul(&mm, MP_NEW, dp->g, mm.r2);
+ q = mpmont_expr(&mm, q, x, q);
+ mp_drop(x);
do {
if (mp_eq(q, mm.r) != !i) {
if (keycheck_report(kc, KCSEV_ERR, "order of g != q")) {