Classic protocol and crypto cleanups.

Segfault if the malloc() failed.