Question about mpz_clear

Michel Bardiaux mbardiaux@peaktime.be
Thu, 19 Jun 2003 10:49:15 +0200


Kevin Ryde wrote:
> "Eric M. Hopper" <hopper@omnifarious.org> writes:
> 
>>Does this clear the memory associated with a given variable zeroed?
> 
> 
> No.
> 
> 
>>Is there an easy way to make sure it is?
> 
> 
> mp_set_memory_functions will let you have your own free function.

I am having a slight problem with that. I have ascertained that I often 
have a lot of mpsomething with rather short limbs; it would be efficient 
to store the limbs contiguous to the 'enveloppe' data; unfortunately, 
the free function would then require more info than just the limb 
pointer. Is it conceivable to change the library for that? I might do 
it, but am not keen on starting a modif that would not be accepted in 
the official tree...

> 
> 
>>I'm designing some software that does cryptography, and I would like to
>>ensure that decrypted private keys are lying around in memory in a
>>decrypted state for as little time as possible.
> 
> 
> Lots of gmp routines put operand data on the stack too.
When that happens, is it not just the pointer data that is on the stack, 
with the limbs *always* in the malloc arena? (Of course my proposal 
would invalidate that!)


-- 
Michel Bardiaux
Peaktime Belgium S.A.  Bd. du Souverain, 191  B-1160 Bruxelles
Tel : +32 2 790.29.41