[PATCH 2/8] mpi:ec: Keep A untouched in ec_get_a_is_pminus3.
NIIBE Yutaka via Gcrypt-devel <[email protected]> Thu, 27 Mar 2025 14:19:05 +0900
| Newsgroups | gmane.comp.encryption.gpg.libgcrypt.devel |
|---|---|
| Message-ID | <d698ed5386e8e3be43296e77938f513261523503.1743052412.git.gniibe@fsij.org> |
* mpi/ec.c (ec_get_a_is_pminus3): Change the calculation so that it keeps the MPI of A untouched. -- Note that mpi_cmp with A may normalize the MPI. Signed-off-by: NIIBE Yutaka <[email protected]> --- mpi/ec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) _______________________________________________ Gcrypt-devel mailing list [email protected] https://lists.gnupg.org/mailman/listinfo/gcrypt-devel
0002-mpi-ec-Keep-A-untouched-in-ec_get_a_is_pminus3.patch
(text/x-patch, 434 B)
diff --git a/mpi/ec.c b/mpi/ec.c
index d1f376ca..3cfe11c6 100644
--- a/mpi/ec.c
+++ b/mpi/ec.c
@@ -728,8 +728,8 @@ ec_get_a_is_pminus3 (mpi_ec_t ec)
{
ec->t.valid.a_is_pminus3 = 1;
tmp = mpi_alloc_like (ec->p);
- mpi_sub_ui (tmp, ec->p, 3);
- ec->t.a_is_pminus3 = !mpi_cmp (ec->a, tmp);
+ mpi_sub (tmp, ec->p, ec->a);
+ ec->t.a_is_pminus3 = !mpi_cmp_ui (tmp, 3);
mpi_free (tmp);
}