nmav at gnutls.org
Tue Jun 22 18:30:38 CEST 2010
Currently there is a fork of the GMP at libgcrypt (crypto library),
and the main if not only reason is that the API for GMP does not allow
detection of out of memory situations, except for a callback. For
example in libgcrypt if I want to do multiplication I do:
gcry_mpi_t w = gcry_mpi_new(gcry_mpi_get_nbits(a)+gcry_mpi_get_nbits(b));
if (w==NULL) return -ENOMEM;
gcry_mpi_mul (w, a, b); /* always succeeds */
whilst in gmp:
mpz_mul (w, a, b);
In the first case the application can return an error on the
out-of-memory condition whilst in the gmp case, the application cannot
control out of memory errors, except crashing or transfering control to
a callback that is not always useful.
My question is. Do you plan in GMP to support a "safe" API such as
Having something like this will really help applications that are build
on the assumption that recovery from out-of-memory situations is
possible, to benefit from using GMP.
. The API of libgcrypt's gmp are the gcry_mpi_* functions.
More information about the gmp-devel