Problem: missing stdlib.h include in curve_keygen.cpp

Solution: fixed this. Also minor code cleanups.