Editorial cleanups of keygen.c
Also fixed a regression introduced by me in pubkey_enc.c. Added extra checks. Removed unused code.