[git] GCRYPT - branch, master, updated. libgcrypt-1.8.1-99-gf74687f
by Werner Koch
cvs at cvs.gnupg.org
Wed Oct 24 11:55:47 CEST 2018
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 f74687fd43f5772a372f54031d5a9527597f4ce4 (commit)
via e57e75ea517f32109b508113f18298fc69fd1192 (commit)
from 149ceb3cae03d0385341d32430aa5ae57de90007 (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 f74687fd43f5772a372f54031d5a9527597f4ce4
Author: Werner Koch <wk at gnupg.org>
Date: Wed Oct 24 11:55:34 2018 +0200
Fix memory leak in secmem in out of core conditions.
* src/secmem.c (_gcry_secmem_malloc_internal): Release pool descriptor
if the pool could not be allocated.
--
GnuPG-bug-id: 4211
Signed-off-by: Werner Koch <wk at gnupg.org>
diff --git a/src/secmem.c b/src/secmem.c
index 79c135f..3e091d8 100644
--- a/src/secmem.c
+++ b/src/secmem.c
@@ -658,7 +658,10 @@ _gcry_secmem_malloc_internal (size_t size, int xhint)
pool->size = auto_expand? auto_expand : STANDARD_POOL_SIZE;
pool->mem = malloc (pool->size);
if (!pool->mem)
- return NULL; /* Not enough memory available for a new pool. */
+ {
+ free (pool);
+ return NULL; /* Not enough memory available for a new pool. */
+ }
/* Initialize first memory block. */
mb = (memblock_t *) pool->mem;
mb->size = pool->size - BLOCK_HEAD_SIZE;
commit e57e75ea517f32109b508113f18298fc69fd1192
Author: Werner Koch <wk at gnupg.org>
Date: Wed Oct 24 11:50:46 2018 +0200
ecc: Fix memory leak in the error case of ecc_encrypt_raw
* cipher/ecc.c (ecc_encrypt_raw): Add proper error cleanup in the main
block.
--
GnuPG-bug-id: 4210
Signed-off-by: Werner Koch <wk at gnupg.org>
diff --git a/cipher/ecc.c b/cipher/ecc.c
index 4e3e5b1..3f221a2 100644
--- a/cipher/ecc.c
+++ b/cipher/ecc.c
@@ -1392,6 +1392,7 @@ ecc_encrypt_raw (gcry_sexp_t *r_ciph, gcry_sexp_t s_data, gcry_sexp_t keyparms)
unsigned char *rawmpi;
unsigned int rawmpilen;
+ rc = 0;
x = mpi_new (0);
if (ec->model == MPI_EC_MONTGOMERY)
y = NULL;
@@ -1418,7 +1419,7 @@ ecc_encrypt_raw (gcry_sexp_t *r_ciph, gcry_sexp_t s_data, gcry_sexp_t keyparms)
if (!(flags & PUBKEY_FLAG_DJB_TWEAK))
{ /* It's not for X25519, then, the input data was simply wrong. */
rc = GPG_ERR_INV_DATA;
- goto leave;
+ goto leave_main;
}
}
if (y)
@@ -1443,7 +1444,7 @@ ecc_encrypt_raw (gcry_sexp_t *r_ciph, gcry_sexp_t s_data, gcry_sexp_t keyparms)
if (_gcry_mpi_ec_get_affine (x, y, &R, ec))
{
rc = GPG_ERR_INV_DATA;
- goto leave;
+ goto leave_main;
}
if (y)
mpi_e = _gcry_ecc_ec2os (x, y, pk.E.p);
@@ -1461,11 +1462,12 @@ ecc_encrypt_raw (gcry_sexp_t *r_ciph, gcry_sexp_t s_data, gcry_sexp_t keyparms)
}
}
-
+ leave_main:
mpi_free (x);
mpi_free (y);
-
point_free (&R);
+ if (rc)
+ goto leave;
}
if (!rc)
-----------------------------------------------------------------------
Summary of changes:
cipher/ecc.c | 10 ++++++----
src/secmem.c | 5 ++++-
2 files changed, 10 insertions(+), 5 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