[git] GCRYPT - branch, master, updated. libgcrypt-1.5.0-164-g6e1adb0

by Werner Koch cvs at cvs.gnupg.org
Wed Jul 17 10:47:46 CEST 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU crypto library".

The branch, master has been updated
       via  6e1adb05d290aeeb1c230c763970695f4a538526 (commit)
      from  61b44812728d1feca880a613c685040ba82c05ce (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6e1adb05d290aeeb1c230c763970695f4a538526
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Jul 17 10:18:39 2013 +0200

    Fix a special case bug in mpi_powm for e==0.
    
    * mpi/mpi-pow.c (gcry_mpi_powm): For a zero exponent, make sure that
    the result has been allocated.
    --
    
    This code triggered the problem:
    
        modulus = gcry_mpi_set_ui(NULL, 100);
        generator = gcry_mpi_set_ui(NULL, 3);
        exponent = gcry_mpi_set_ui(NULL, 0);
        result = gcry_mpi_new(0);
        gcry_mpi_powm(result, generator, exponent, modulus);
    
    gcry_mpi_new(0) does not allocate the limb space thus it is not
    possible to write even into the first limb.  Workaround was to use
    gcry_mpi_new (1) but a real fix is better.
    
    Reported-by: Ian Goldberg
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/mpi/mpi-pow.c b/mpi/mpi-pow.c
index 891a7e6..7ec49d7 100644
--- a/mpi/mpi-pow.c
+++ b/mpi/mpi-pow.c
@@ -81,9 +81,14 @@ gcry_mpi_powm (gcry_mpi_t res,
   if (!esize)
     {
       /* Exponent is zero, result is 1 mod MOD, i.e., 1 or 0 depending
-        on if MOD equals 1.  */
-      rp[0] = 1;
+         on if MOD equals 1.  */
       res->nlimbs = (msize == 1 && mod->d[0] == 1) ? 0 : 1;
+      if (res->nlimbs)
+        {
+          RESIZE_IF_NEEDED (res, 1);
+          rp = res->d;
+          rp[0] = 1;
+        }
       res->sign = 0;
       goto leave;
     }

-----------------------------------------------------------------------

Summary of changes:
 mpi/mpi-pow.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
The GNU crypto library
http://git.gnupg.org




More information about the Gnupg-commits mailing list