[PATCH] mpi:ec: Use ec_mulm_lli in _gcry_mpi_ec_get_affine.
NIIBE Yutaka via Gcrypt-devel <[email protected]> Tue, 13 May 2025 09:28:28 +0900
| Newsgroups | gmane.comp.encryption.gpg.libgcrypt.devel |
|---|---|
| Message-ID | <aa089ec89badcd74817e5008c66036b1e28674f5.1747096044.git.gniibe@fsij.org> |
* mpi/ec.c (_gcry_mpi_ec_get_affine): Fix for possible leak. -- GnuPG-bug-id: 7519 Signed-off-by: NIIBE Yutaka <[email protected]> --- mpi/ec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) _______________________________________________ Gcrypt-devel mailing list [email protected] https://lists.gnupg.org/mailman/listinfo/gcrypt-devel
0001-mpi-ec-Use-ec_mulm_lli-in-_gcry_mpi_ec_get_affine.patch
(text/x-patch, 951 B)
diff --git a/mpi/ec.c b/mpi/ec.c
index 92db6e20..d7d7b772 100644
--- a/mpi/ec.c
+++ b/mpi/ec.c
@@ -1186,17 +1186,17 @@ _gcry_mpi_ec_get_affine (gcry_mpi_t x, gcry_mpi_t y, mpi_point_t point,
z1 = mpi_new (0);
z2 = mpi_new (0);
- ec_invm (z1, point->z, ctx); /* z1 = z^(-1) mod p */
- ec_mulm (z2, z1, z1, ctx); /* z2 = z^(-2) mod p */
+ ec_invm (z1, point->z, ctx); /* z1 = z^(-1) mod p */
+ ec_mulm_lli (z2, z1, z1, ctx); /* z2 = z^(-2) mod p */
if (x)
- ec_mulm (x, point->x, z2, ctx);
+ ec_mulm_lli (x, point->x, z2, ctx);
if (y)
{
z3 = mpi_new (0);
- ec_mulm (z3, z2, z1, ctx); /* z3 = z^(-3) mod p */
- ec_mulm (y, point->y, z3, ctx);
+ ec_mulm_lli (z3, z2, z1, ctx); /* z3 = z^(-3) mod p */
+ ec_mulm_lli (y, point->y, z3, ctx);
mpi_free (z3);
}