[git] GCRYPT - branch, LIBGCRYPT-1-5-BRANCH, updated. libgcrypt-1.5.2-2-g366e7b1

by Werner Koch cvs at cvs.gnupg.org
Wed Jul 17 10:53:13 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, LIBGCRYPT-1-5-BRANCH has been updated
       via  366e7b1925cfebb259cc268ed3eb6687e9c8fd77 (commit)
      from  0c528aff1b28f0a317ae94675228c04db7a832da (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 366e7b1925cfebb259cc268ed3eb6687e9c8fd77
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>
    (cherry picked from commit 6e1adb05d290aeeb1c230c763970695f4a538526)

diff --git a/mpi/mpi-pow.c b/mpi/mpi-pow.c
index 33bbebe..f4aebdb 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