diff src/pk/dsa/dsa_make_key.c @ 209:39d5d58461d6 libtomcrypt-orig LTC_1.05

Import of libtomcrypt 1.05
author Matt Johnston <matt@ucc.asn.au>
date Wed, 06 Jul 2005 03:53:40 +0000
parents 1c15b283127b
children
line wrap: on
line diff
--- a/src/pk/dsa/dsa_make_key.c	Fri May 06 13:23:02 2005 +0000
+++ b/src/pk/dsa/dsa_make_key.c	Wed Jul 06 03:53:40 2005 +0000
@@ -70,15 +70,15 @@
    }
 
    /* force magnitude */
-   buf[0] = 1;
+   buf[0] |= 0xC0;
 
    /* force even */
-   buf[modulus_size - group_size] &= ~1;
+   buf[modulus_size - group_size - 1] &= ~1;
 
-   if ((err = mp_read_unsigned_bin(&tmp2, buf, modulus_size - group_size+1)) != MP_OKAY) { goto error; }
+   if ((err = mp_read_unsigned_bin(&tmp2, buf, modulus_size - group_size)) != MP_OKAY) { goto error; }
    if ((err = mp_mul(&key->q, &tmp2, &key->p)) != MP_OKAY)                             { goto error; }
    if ((err = mp_add_d(&key->p, 1, &key->p)) != MP_OKAY)                               { goto error; }
-   
+
    /* now loop until p is prime */
    for (;;) {
        if ((err = is_prime(&key->p, &res)) != CRYPT_OK)                                { goto LBL_ERR; }
@@ -140,3 +140,7 @@
 }
 
 #endif
+
+/* $Source: /cvs/libtom/libtomcrypt/src/pk/dsa/dsa_make_key.c,v $ */
+/* $Revision: 1.4 $ */
+/* $Date: 2005/06/11 05:45:35 $ */