On Thu, Dec 12, 2013 at 5:31 PM, Niels Möller nisse@lysator.liu.se wrote:
That said, Nettle shouldn't do unbounded stack allocations in this case, it ought to use malloc, or abort or fail in some other *reliable* fashion. (I think having some documented limit on keysize would be acceptable, but I'm leaning towards saying that it's better to just use heap allcoation). Do you agree?
Yes, that would be much better. Do you want me to send an updated patch?
That would be good. I think it makes sense to use gmp's allocation functions here, so the user can override allocation, without having to do it separately for nettle and gmp. See gmp-glue.c:gmp_alloc_limbs.
What about the attached patch?