[git] GCRYPT - branch, master, updated. libgcrypt-1.6.0-315-gb12dd55

by NIIBE Yutaka cvs at cvs.gnupg.org
Wed Feb 10 09:50:39 CET 2016


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  b12dd550fd6af687ef95c584d0d8366c34965cc8 (commit)
      from  4a19b195697e0b6534d28de9401ae3e9d86adb42 (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 b12dd550fd6af687ef95c584d0d8366c34965cc8
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Wed Feb 10 17:35:43 2016 +0900

    ecc: Fix memory leaks on error.
    
    * cipher/ecc.c (ecc_decrypt_raw): Go to leave to release memory.
    * mpi/ec.c (_gcry_mpi_ec_curve_point): Likewise.
    
    --
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/cipher/ecc.c b/cipher/ecc.c
index b861925..d1fe823 100644
--- a/cipher/ecc.c
+++ b/cipher/ecc.c
@@ -1572,8 +1572,8 @@ ecc_decrypt_raw (gcry_sexp_t *r_plain, gcry_sexp_t s_data, gcry_sexp_t keyparms)
 
   if (!_gcry_mpi_ec_curve_point (&kG, ec))
     {
-      point_free (&kG);
-      return GPG_ERR_INV_DATA;
+      rc = GPG_ERR_INV_DATA;
+      goto leave;
     }
 
   /* R = dkG */
diff --git a/mpi/ec.c b/mpi/ec.c
index 346e5f1..f0b8374 100644
--- a/mpi/ec.c
+++ b/mpi/ec.c
@@ -1478,10 +1478,12 @@ _gcry_mpi_ec_curve_point (gcry_mpi_point_t point, mpi_ec_t ctx)
     {
     case MPI_EC_WEIERSTRASS:
       {
-        gcry_mpi_t xxx = mpi_new (0);
+        gcry_mpi_t xxx;
 
         if (_gcry_mpi_ec_get_affine (x, y, point, ctx))
-          return 0;
+          goto leave;
+
+        xxx = mpi_new (0);
 
         /* y^2 == x^3 + a·x + b */
         ec_pow2 (y, y, ctx);
@@ -1502,7 +1504,7 @@ _gcry_mpi_ec_curve_point (gcry_mpi_point_t point, mpi_ec_t ctx)
 #define xx y
         /* With Montgomery curve, only X-coordinate is valid.  */
         if (_gcry_mpi_ec_get_affine (x, NULL, point, ctx))
-          return 0;
+          goto leave;
 
         /* The equation is: b * y^2 == x^3 + a · x^2 + x */
         /* We check if right hand is quadratic residue or not by
@@ -1530,7 +1532,7 @@ _gcry_mpi_ec_curve_point (gcry_mpi_point_t point, mpi_ec_t ctx)
     case MPI_EC_EDWARDS:
       {
         if (_gcry_mpi_ec_get_affine (x, y, point, ctx))
-          return 0;
+          goto leave;
 
         /* a · x^2 + y^2 - 1 - b · x^2 · y^2 == 0 */
         ec_pow2 (x, x, ctx);
@@ -1553,6 +1555,7 @@ _gcry_mpi_ec_curve_point (gcry_mpi_point_t point, mpi_ec_t ctx)
       break;
     }
 
+ leave:
   _gcry_mpi_release (w);
   _gcry_mpi_release (x);
   _gcry_mpi_release (y);

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

Summary of changes:
 cipher/ecc.c |  4 ++--
 mpi/ec.c     | 11 +++++++----
 2 files changed, 9 insertions(+), 6 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