[git] GCRYPT - branch, master, updated. libgcrypt-1.5.0-181-g9a42181

by NIIBE Yutaka cvs at cvs.gnupg.org
Tue Aug 6 10:40:22 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  9a421813123a2f5db0a91eaee4a45138efc9ad34 (commit)
       via  87eddc31ccba6decbddd1761dd42a208666cd311 (commit)
       via  ae6ffd9af38cbcac57c220960f683aab91db85cb (commit)
      from  d8e99a04dba6a606e879464cd11deee760d1e000 (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 9a421813123a2f5db0a91eaee4a45138efc9ad34
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Tue Aug 6 14:38:51 2013 +0900

    cipher: fix another memory leak.
    
    * cipher/ecc.c (ecc_get_curve): Free TMP.

diff --git a/cipher/ecc.c b/cipher/ecc.c
index 375eeaf..b694d76 100644
--- a/cipher/ecc.c
+++ b/cipher/ecc.c
@@ -1319,6 +1319,7 @@ ecc_get_curve (gcry_mpi_t *pkey, int iterator, unsigned int *r_nbits)
                           tmp = scanval (domain_parms[idx].g_y);
                           if (!mpi_cmp (tmp, E.G.y))
                             {
+                              mpi_free (tmp);
                               result = domain_parms[idx].desc;
                               if (r_nbits)
                                 *r_nbits = domain_parms[idx].nbits;

commit 87eddc31ccba6decbddd1761dd42a208666cd311
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Tue Aug 6 12:59:35 2013 +0900

    tests: fix memory leaks.
    
    * tests/pubkey.c (check_keys_crypt): Release L, X0, and X1.
    (check_keys): Release X.

diff --git a/tests/pubkey.c b/tests/pubkey.c
index ffaecb3..baf234c 100644
--- a/tests/pubkey.c
+++ b/tests/pubkey.c
@@ -144,6 +144,7 @@ check_keys_crypt (gcry_sexp_t pkey, gcry_sexp_t skey,
   /* Extract data from plaintext.  */
   l = gcry_sexp_find_token (plain0, "value", 0);
   x0 = gcry_sexp_nth_mpi (l, 1, GCRYMPI_FMT_USG);
+  gcry_sexp_release (l);
 
   /* Encrypt data.  */
   rc = gcry_pk_encrypt (&cipher, plain0, pkey);
@@ -160,7 +161,10 @@ check_keys_crypt (gcry_sexp_t pkey, gcry_sexp_t skey,
   if (rc)
     {
       if (decrypt_fail_code && gpg_err_code (rc) == decrypt_fail_code)
-        return; /* This is the expected failure code.  */
+	{
+	  gcry_mpi_release (x0);
+	  return; /* This is the expected failure code.  */
+	}
       die ("decryption failed: %s\n", gcry_strerror (rc));
     }
 
@@ -189,6 +193,8 @@ check_keys_crypt (gcry_sexp_t pkey, gcry_sexp_t skey,
   /* Compare.  */
   if (gcry_mpi_cmp (x0, x1))
     die ("data corrupted\n");
+  gcry_mpi_release (x0);
+  gcry_mpi_release (x1);
 }
 
 static void
@@ -218,6 +224,7 @@ check_keys (gcry_sexp_t pkey, gcry_sexp_t skey, unsigned int nbits_data,
 
   rc = gcry_sexp_build (&plain, NULL,
                         "(data (flags raw no-blinding) (value %m))", x);
+  gcry_mpi_release (x);
   if (rc)
     die ("converting data for encryption failed: %s\n",
 	 gcry_strerror (rc));

commit ae6ffd9af38cbcac57c220960f683aab91db85cb
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Tue Aug 6 12:57:10 2013 +0900

    cipher: fix memory leaks.
    
    * cipher/elgamal.c (elg_generate_ext): Free XVALUE.
    
    * cipher/pubkey.c (sexp_elements_extract): Don't use IDX for loop.
    Call mpi_free.
    (sexp_elements_extract_ecc): Call mpi_free.

diff --git a/cipher/elgamal.c b/cipher/elgamal.c
index b40d132..7540e3f 100644
--- a/cipher/elgamal.c
+++ b/cipher/elgamal.c
@@ -641,7 +641,10 @@ elg_generate_ext (int algo, unsigned int nbits, unsigned long evalue,
     }
 
   if (xvalue)
-    ec = generate_using_x (&sk, nbits, xvalue, retfactors);
+    {
+      ec = generate_using_x (&sk, nbits, xvalue, retfactors);
+      mpi_free (xvalue);
+    }
   else
     {
       generate (&sk, nbits, retfactors);
diff --git a/cipher/pubkey.c b/cipher/pubkey.c
index b540bd5..e867169 100644
--- a/cipher/pubkey.c
+++ b/cipher/pubkey.c
@@ -1832,8 +1832,8 @@ sexp_elements_extract (gcry_sexp_t key_sexp, const char *element_names,
   if (!err)
     {
       /* Check that all elements are available.  */
-      for (name = element_names, idx = 0; *name; name++, idx++)
-        if (!elements[idx])
+      for (name = element_names, i = 0; *name; name++, i++)
+        if (!elements[i])
           break;
       if (*name)
         {
@@ -1857,7 +1857,7 @@ sexp_elements_extract (gcry_sexp_t key_sexp, const char *element_names,
     {
       for (i = 0; i < idx; i++)
         if (elements[i])
-          gcry_free (elements[i]);
+          mpi_free (elements[i]);
     }
   return err;
 }
@@ -1963,7 +1963,7 @@ sexp_elements_extract_ecc (gcry_sexp_t key_sexp, const char *element_names,
     {
       for (name = element_names, idx = 0; *name; name++, idx++)
         if (elements[idx])
-          gcry_free (elements[idx]);
+          mpi_free (elements[idx]);
     }
   return err;
 }

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

Summary of changes:
 cipher/ecc.c     |    1 +
 cipher/elgamal.c |    5 ++++-
 cipher/pubkey.c  |    8 ++++----
 tests/pubkey.c   |    9 ++++++++-
 4 files changed, 17 insertions(+), 6 deletions(-)


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




More information about the Gnupg-commits mailing list