Manolo on Mon, 10 Sep 2012 18:18:48 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Cleaning the pari-stack


2012/9/10 Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr>:

>
> Beware that an even greater concern is to use strong pseudo-random number
> generators. (Ours, based on Brent's XORGEN, are definitely not suitable
> for key or nonce generation.)

Yes, I know ;-) This was my first aware. I've builded my own
randomInt(n:int) function, that harvests entropy from /dev/urandom.

Thanks anyway for the tip.


> I'd use simply
>
> void
> burn_paristack() { bzero((void*)bot, avma - bot); }
>
> (untested:-) to simply clear up the unused part of the stack.

Nice! It could even be implemented as a macro! Thank you!

(But the size variable (avma-bot) gives the size of stack in "long"
type words, isn't it? It should be multiply by "sizeof(pari_sp)" or
"sizeof(long)", I guess.)

Thanks a lot!

-- 
Manuel Pancorbo Castro
http://bitakoro.tk/