wk at gnupg.org
Tue Jun 22 22:55:22 CEST 2010
On Tue, 22 Jun 2010 18:30, nmav at gnutls.org said:
> gcry_mpi_t w = gcry_mpi_new(gcry_mpi_get_nbits(a)+gcry_mpi_get_nbits(b));
> if (w==NULL) return -ENOMEM;
(If a malloc fails ERRNO will be set; please don't use your own idea of
an error code).
I am not sure whether this will always work. At the time I adopted GMP
2.0 for use in GnuPG about 12 years ago, my main goal was to make sure
that we can distinguish sensitive data from common data (i.e. secret
vs. public key operations). I used to use xmalloc all over the place
and only later partly changed this to plain malloc with error return. I
am not even sure whether this has been implemented all over the place.
I even would not call gcry_mpi_ functions a fork of GMP anymore. It has
always been a stripped down version of GMP with a couple of things which
makes it slower but more useful for crypto stuff. Less code complexity
is just one of these features. Some code has even been optimized for
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.
More information about the gmp-devel