[git] GCRYPT - branch, master, updated. libgcrypt-1.7.3-118-g66ed4d5

by NIIBE Yutaka cvs at cvs.gnupg.org
Fri Jul 7 05:02:46 CEST 2017


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  66ed4d53789892def7b237756d8a0ab28df9d222 (commit)
       via  619ebae9847831f43314a95cc3180f4b329b4d3b (commit)
      from  e235f6a62f6268538c784154c2d1470ff073b6a8 (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 66ed4d53789892def7b237756d8a0ab28df9d222
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Fri Jul 7 12:00:03 2017 +0900

    mpi: Fix mpi_pow alternative implementation.
    
    * mpi/mpi-pow.c
      [USE_ALGORITHM_SIMPLE_EXPONENTIATION] (_gcry_mpi_powm): Use
      mpi_set_cond.
    
    --
    
    Limbs of RES may be allocated more before the call of mpi_pow,
    but it only uses the space of SIZE.
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/mpi/mpi-pow.c b/mpi/mpi-pow.c
index 3d6d68c..54f477b 100644
--- a/mpi/mpi-pow.c
+++ b/mpi/mpi-pow.c
@@ -188,10 +188,16 @@ _gcry_mpi_powm (gcry_mpi_t res,
     mpi_limb_t e;
     mpi_limb_t carry_limb;
     struct karatsuba_ctx karactx;
+    struct gcry_mpi w, u;
 
     xp_nlimbs = msec? size:0;
     xp = xp_marker = mpi_alloc_limb_space( size, msec );
 
+    w.sign = u.sign = 0;
+    w.flags = u.flags = 0;
+    w.alloced = w.nlimbs = size; /* RES->alloc may be longer.  */
+    u.alloced = u.nlimbs = size;
+
     memset( &karactx, 0, sizeof karactx );
     negative_result = (ep[0] & 1) && bsign;
 
@@ -267,11 +273,11 @@ _gcry_mpi_powm (gcry_mpi_t res,
                     xsize = msize;
                   }
               }
-            if ( (mpi_limb_signed_t)e < 0 )
-              {
-                tp = rp; rp = xp; xp = tp;
-                rsize = xsize;
-              }
+
+            w.d = rp;
+            u.d = xp;
+            mpi_set_cond (&w, &u, ((mpi_limb_signed_t)e < 0));
+
             e <<= 1;
             c--;
           }

commit 619ebae9847831f43314a95cc3180f4b329b4d3b
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Fri Jul 7 11:39:09 2017 +0900

    Fix mpi_pow alternative implementation.
    
    * mpi/mpi-pow.c [USE_ALGORITHM_SIMPLE_EXPONENTIATION] (_gcry_mpi_powm):
    Allocate size fix.
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/mpi/mpi-pow.c b/mpi/mpi-pow.c
index 3cba690..3d6d68c 100644
--- a/mpi/mpi-pow.c
+++ b/mpi/mpi-pow.c
@@ -189,8 +189,8 @@ _gcry_mpi_powm (gcry_mpi_t res,
     mpi_limb_t carry_limb;
     struct karatsuba_ctx karactx;
 
-    xp_nlimbs = msec? (2 * (msize + 1)):0;
-    xp = xp_marker = mpi_alloc_limb_space( 2 * (msize + 1), msec );
+    xp_nlimbs = msec? size:0;
+    xp = xp_marker = mpi_alloc_limb_space( size, msec );
 
     memset( &karactx, 0, sizeof karactx );
     negative_result = (ep[0] & 1) && bsign;

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

Summary of changes:
 mpi/mpi-pow.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)


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


_______________________________________________
Gnupg-commits mailing list
Gnupg-commits at gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-commits




More information about the Gcrypt-devel mailing list