portable method to zeroize memory when destroying a mpz number

Vicente Benjumea vicente at lcc.uma.es
Thu Mar 20 19:05:35 UTC 2014

> That doesn't cover all deallocations. When you write:
> mpz_add(a,b,c);
> GMP may reallocate a so the result fits.

Thank you. I didn't realize that option.

> Best would be for you to use the existing GMP interfaces to replace the 
> allocation/deallocation functions and zero memory there.

Thanks. I'll explore this approach. However, it seems to me that this
approach will require to add an initialization function to my library
(to replace the de/allocation functions), which, a priori, I prefer to
avoid if I could.

I will also explore the other approach suggested by Torbjörn:

> Alternatively wait a few days for the new GMP release which has a nice
> set of mpn functions specifically designed for cryptography.

Thanks a lot

More information about the gmp-discuss mailing list