[svn] GnuPG - r4184 - trunk/cipher

svn author dshaw cvs at cvs.gnupg.org
Thu Jun 29 00:29:27 CEST 2006


Author: dshaw
Date: 2006-06-29 00:29:25 +0200 (Thu, 29 Jun 2006)
New Revision: 4184

Modified:
   trunk/cipher/ChangeLog
   trunk/cipher/rsa.c
Log:
* rsa.c (generate): Use e=65537 for new RSA keys.


Modified: trunk/cipher/ChangeLog
===================================================================
--- trunk/cipher/ChangeLog	2006-06-28 19:33:14 UTC (rev 4183)
+++ trunk/cipher/ChangeLog	2006-06-28 22:29:25 UTC (rev 4184)
@@ -1,3 +1,7 @@
+2006-06-28  David Shaw  <dshaw at jabberwocky.com>
+
+	* rsa.c (generate): Use e=65537 for new RSA keys.
+
 2006-04-20  David Shaw  <dshaw at jabberwocky.com>
 
 	* dsa.c (dsa2_generate): New function to generate a DSA key with a

Modified: trunk/cipher/rsa.c
===================================================================
--- trunk/cipher/rsa.c	2006-06-28 19:33:14 UTC (rev 4183)
+++ trunk/cipher/rsa.c	2006-06-28 22:29:25 UTC (rev 4184)
@@ -136,25 +136,21 @@
     mpi_gcd(g, t1, t2);
     mpi_fdiv_q(f, phi, g);
 
-    /* find an public exponent.
-       We use 41 as this is quite fast and more secure than the
-       commonly used 17.  Benchmarking the RSA verify function
-       with a 1024 bit key yields (2001-11-08): 
+    /* Find an public exponent.
+       Benchmarking the RSA verify function with a 1024 bit key yields
+       (2001-11-08):
          e=17    0.54 ms
          e=41    0.75 ms
          e=257   0.95 ms
          e=65537 1.80 ms
+
+       This code used 41 until 2006-06-28 when it was changed to use
+       65537 as the new best practice.  See FIPS-186-3.
      */
     e = mpi_alloc( (32+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB );
-    mpi_set_ui( e, 41); 
-    if( !mpi_gcd(t1, e, phi) ) {
-      mpi_set_ui( e, 257); 
-      if( !mpi_gcd(t1, e, phi) ) {
-        mpi_set_ui( e, 65537); 
-        while( !mpi_gcd(t1, e, phi) ) /* (while gcd is not 1) */
-          mpi_add_ui( e, e, 2);
-      }
-    }
+    mpi_set_ui( e, 65537); 
+    while( !mpi_gcd(t1, e, phi) ) /* (while gcd is not 1) */
+      mpi_add_ui( e, e, 2);
 
     /* calculate the secret key d = e^1 mod phi */
     d = mpi_alloc( (nbits+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB );




More information about the Gnupg-commits mailing list