[PATCH 1/5] mpi/ec: remove VLA usage
Jacob Bachmeyer
jcb62281 at gmail.com
Mon Oct 3 02:19:30 CEST 2022
Jussi Kivilinna wrote:
> * mpi/ec-nist.c (_gcry_mpi_ec_nist192_mod, _gcry_mpi_ec_nist224_mod)
> (_gcry_mpi_ec_nist256_mod, _gcry_mpi_ec_nist384_mod)
> (_gcry_mpi_ec_nist521_mod): Avoid VLA for arrays on stack.
> * mpi/ec.c (ec_secp256k1_mod): Avoid VLA for arrays on stack.
> --
>
> Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
> ---
> mpi/ec-nist.c | 40 ++++++++++++++++++++--------------------
> mpi/ec.c | 6 +++---
> 2 files changed, 23 insertions(+), 23 deletions(-)
>
> diff --git a/mpi/ec-nist.c b/mpi/ec-nist.c
> index 69b05a6d..14e3c3ab 100644
> [...]
> + mpi_limb64_t o[DIM(s)];
> [...]
> + mpi_limb64_t d[DIM(s)];
> [...]
> + mpi_limb64_t t[DIM(s)];
> + mpi_limb64_t d[DIM(s)];
> + mpi_limb64_t e[DIM(s)];
> + const mpi_size_t wsize = DIM(s) - 1;
> [...]
> + mpi_limb64_t t[DIM(s)];
> + mpi_limb64_t d[DIM(s)];
> + mpi_limb64_t x[DIM(s)];
> [...]
> + mpi_limb_t s[(256 + BITS_PER_MPI_LIMB - 1) / BITS_PER_MPI_LIMB + 1];
> + mpi_limb_t n[sizeof(s)];
> + const mpi_size_t wsize = DIM(s) - 1;
> mpi_limb_t cy, borrow;
> mpi_ptr_t wp;
>
Am I misreading the patch (e.g. sizeof(mpi_limb_t) == 1?) or did you
miss a spot at the end?
-- Jacob
More information about the Gcrypt-devel
mailing list