Classic protocol and crypto cleanups.

I don't see you check the return from this malloc() - why not xmalloc() ?