[svn] gcry - r1173 - in trunk: . mpi src

svn author wk cvs at cvs.gnupg.org
Mon Aug 28 11:40:40 CEST 2006


Author: wk
Date: 2006-08-28 11:40:39 +0200 (Mon, 28 Aug 2006)
New Revision: 1173

Modified:
   trunk/NEWS
   trunk/TODO
   trunk/mpi/ChangeLog
   trunk/mpi/mpi-bit.c
   trunk/src/ChangeLog
   trunk/src/gcrypt.h
   trunk/src/global.c
Log:
Fixed a problem with shifting MPIs by 0.
Add a way to check whether the RNG is in fake mode.


Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2006-08-04 10:18:14 UTC (rev 1172)
+++ trunk/NEWS	2006-08-28 09:40:39 UTC (rev 1173)
@@ -17,6 +17,7 @@
  * Interface changes relative to the 1.2.0 release:
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  gcry_fast_random_poll	 NEW
+ GCRYCTL_FAKED_RANDOM_P  NEW 
  gcry_pk_algo_name       CHANGED (minor change in respect to return value)
  gcry_cipher_algo_name   CHANGED (minor change in respect to return value)
  GCRY_MD_SHA224          NEW

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2006-08-04 10:18:14 UTC (rev 1172)
+++ trunk/TODO	2006-08-28 09:40:39 UTC (rev 1173)
@@ -51,7 +51,7 @@
   to run that bunch of Unix utilities we don't waste their precious
   results.
 
-* Out of memory handler for secure memory shopuld do proper logging
+* Out of memory handler for secure memory should do proper logging
 
   There is no shortage of standard memory, so logging is most likely
   possible.
@@ -59,5 +59,10 @@
 * signed vs. unsigned.
   Sync the code with 1.2 where we have fixed all these issues.
 
+* mpi_print does not use secure memory
+  for internal variables.
 
+* gry_mpi_lshift is missing
 
+
+

Modified: trunk/mpi/ChangeLog
===================================================================
--- trunk/mpi/ChangeLog	2006-08-04 10:18:14 UTC (rev 1172)
+++ trunk/mpi/ChangeLog	2006-08-28 09:40:39 UTC (rev 1173)
@@ -1,3 +1,8 @@
+2006-08-25  Werner Koch  <wk at g10code.com>
+
+	* mpi-bit.c (gcry_mpi_rshift): Don't shift if N == 0 but do a
+	plain copy.
+
 2006-08-04  Werner Koch  <wk at g10code.com>
 
 	* mpi-bit.c (gcry_mpi_rshift): Rewritten to remove the limitation

Modified: trunk/mpi/mpi-bit.c
===================================================================
--- trunk/mpi/mpi-bit.c	2006-08-04 10:18:14 UTC (rev 1172)
+++ trunk/mpi/mpi-bit.c	2006-08-28 09:40:39 UTC (rev 1173)
@@ -256,7 +256,17 @@
       x->nlimbs = xsize;
       
       if ( xsize )
-        _gcry_mpih_rshift (x->d, a->d, x->nlimbs, nbits );
+        {
+          if (nbits )
+            _gcry_mpih_rshift (x->d, a->d, x->nlimbs, nbits );
+          else
+            {
+              /* The rshift helper function is not specified for
+                 NBITS==0, thus we do a plain copy here. */
+              for (i=0; i < x->nlimbs; i++ )
+                x->d[i] = a->d[i];
+            }
+        }
     }
   MPN_NORMALIZE (x->d, x->nlimbs);
 }

Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2006-08-04 10:18:14 UTC (rev 1172)
+++ trunk/src/ChangeLog	2006-08-28 09:40:39 UTC (rev 1173)
@@ -1,3 +1,7 @@
+2006-08-21  Werner Koch  <wk at g10code.com>
+
+	* gcrypt.h (GCRYCTL_FAKED_RANDOM_P): New.
+
 2006-07-29  Marcus Brinkmann  <marcus at g10code.de>
 
 	* secmem.c (init_pool): Close FD after establishing the mapping.

Modified: trunk/src/gcrypt.h
===================================================================
--- trunk/src/gcrypt.h	2006-08-04 10:18:14 UTC (rev 1172)
+++ trunk/src/gcrypt.h	2006-08-28 09:40:39 UTC (rev 1173)
@@ -348,7 +348,8 @@
     GCRYCTL_SET_THREAD_CBS = 47,
     GCRYCTL_FAST_POLL = 48,
     GCRYCTL_SET_RANDOM_DAEMON_SOCKET = 49,
-    GCRYCTL_USE_RANDOM_DAEMON = 50
+    GCRYCTL_USE_RANDOM_DAEMON = 50,
+    GCRYCTL_FAKED_RANDOM_P = 51
   };
 
 /* Perform various operations defined by CMD. */

Modified: trunk/src/global.c
===================================================================
--- trunk/src/global.c	2006-08-04 10:18:14 UTC (rev 1172)
+++ trunk/src/global.c	2006-08-28 09:40:39 UTC (rev 1173)
@@ -219,6 +219,13 @@
       _gcry_quick_random_gen (1);
       break;
 
+    case GCRYCTL_FAKED_RANDOM_P:
+      /* Return an error if the RNG is faked one (i.e. enabled by
+         ENABLE_QUICK_RANDOM. */
+      if (_gcry_random_is_faked ())
+        err = GPG_ERR_GENERAL;
+      break;
+
     case GCRYCTL_DUMP_RANDOM_STATS:
       _gcry_random_dump_stats ();
       break;
@@ -329,7 +336,7 @@
 
     case GCRYCTL_FAST_POLL:
       /* We need to do make sure that the random pool is really
-         initialized so that the poll fucntion is not a NOP. */
+         initialized so that the poll function is not a NOP. */
       _gcry_random_initialize (1);
       _gcry_fast_random_poll (); 
       break;




More information about the Gnupg-commits mailing list