Classic protocol and crypto cleanups.

Why not move the BN_free() to between assigning ret and testing ret ?
It'd save duplication between here and below.