Blame SOURCES/libgcrypt-1.5.0-leak.patch

241384
diff -up libgcrypt-1.5.0/cipher/elgamal.c.leak libgcrypt-1.5.0/cipher/elgamal.c
241384
--- libgcrypt-1.5.0/cipher/elgamal.c.leak	2011-02-04 20:09:38.000000000 +0100
241384
+++ libgcrypt-1.5.0/cipher/elgamal.c	2012-12-03 14:51:10.743067964 +0100
241384
@@ -641,7 +641,10 @@ elg_generate_ext (int algo, unsigned int
241384
     }
241384
 
241384
   if (xvalue)
241384
-    ec = generate_using_x (&sk, nbits, xvalue, retfactors);
241384
+    {
241384
+      ec = generate_using_x (&sk, nbits, xvalue, retfactors);
241384
+      gcry_mpi_release(xvalue);
241384
+    }
241384
   else
241384
     {
241384
       generate (&sk, nbits, retfactors);
241384
diff -up libgcrypt-1.5.0/cipher/primegen.c.leak libgcrypt-1.5.0/cipher/primegen.c
241384
--- libgcrypt-1.5.0/cipher/primegen.c.leak	2012-04-05 15:37:52.000000000 +0200
241384
+++ libgcrypt-1.5.0/cipher/primegen.c	2012-12-03 14:44:14.610010867 +0100
241384
@@ -1198,10 +1198,7 @@ gcry_prime_group_generator (gcry_mpi_t *
241384
                             gcry_mpi_t prime, gcry_mpi_t *factors,
241384
                             gcry_mpi_t start_g)
241384
 {
241384
-  gcry_mpi_t tmp = gcry_mpi_new (0);
241384
-  gcry_mpi_t b = gcry_mpi_new (0);
241384
-  gcry_mpi_t pmin1 = gcry_mpi_new (0);
241384
-  gcry_mpi_t g = start_g? gcry_mpi_copy (start_g) : gcry_mpi_set_ui (NULL, 3);
241384
+  gcry_mpi_t tmp, b, pmin1, g;
241384
   int first = 1;
241384
   int i, n;
241384
 
241384
@@ -1214,6 +1211,11 @@ gcry_prime_group_generator (gcry_mpi_t *
241384
   if (n < 2)
241384
     return gpg_error (GPG_ERR_INV_ARG);
241384
 
241384
+  tmp = gcry_mpi_new (0);
241384
+  b = gcry_mpi_new (0);
241384
+  pmin1 = gcry_mpi_new (0);
241384
+  g = start_g? gcry_mpi_copy (start_g) : gcry_mpi_set_ui (NULL, 3);
241384
+
241384
   /* Extra sanity check - usually disabled. */
241384
 /*   mpi_set (tmp, factors[0]); */
241384
 /*   for(i = 1; i < n; i++) */
241384
diff -up libgcrypt-1.5.0/cipher/pubkey.c.leak libgcrypt-1.5.0/cipher/pubkey.c
241384
--- libgcrypt-1.5.0/cipher/pubkey.c.leak	2011-06-13 12:23:50.000000000 +0200
241384
+++ libgcrypt-1.5.0/cipher/pubkey.c	2012-12-03 15:23:42.377183489 +0100
241384
@@ -2853,6 +2853,8 @@ gcry_pk_encrypt (gcry_sexp_t *r_ciph, gc
241384
 
241384
   REGISTER_DEFAULT_PUBKEYS;
241384
 
241384
+  init_encoding_ctx (&ctx, PUBKEY_OP_ENCRYPT, gcry_pk_get_nbits (s_pkey));
241384
+
241384
   /* Get the key. */
241384
   rc = sexp_to_key (s_pkey, 0, NULL, &pkey, &module);
241384
   if (rc)
241384
@@ -2873,7 +2875,6 @@ gcry_pk_encrypt (gcry_sexp_t *r_ciph, gc
241384
   algo_elems = pubkey->elements_enc;
241384
 
241384
   /* Get the stuff we want to encrypt. */
241384
-  init_encoding_ctx (&ctx, PUBKEY_OP_ENCRYPT, gcry_pk_get_nbits (s_pkey));
241384
   rc = sexp_data_to_mpi (s_data, &data, &ctx;;
241384
   if (rc)
241384
     goto leave;
241384
diff -up libgcrypt-1.5.0/src/hmac256.c.leak libgcrypt-1.5.0/src/hmac256.c
241384
--- libgcrypt-1.5.0/src/hmac256.c.leak	2011-02-04 20:17:33.000000000 +0100
241384
+++ libgcrypt-1.5.0/src/hmac256.c	2012-12-03 15:37:36.504955809 +0100
241384
@@ -435,7 +435,6 @@ _gcry_hmac256_finalize (hmac256_context_
241384
       tmphd = _gcry_hmac256_new (NULL, 0);
241384
       if (!tmphd)
241384
         {
241384
-          free (hd);
241384
           return NULL;
241384
         }
241384
       _gcry_hmac256_update (tmphd, hd->opad, 64);