Classic protocol and crypto cleanups.

memset(0) because this is crypto code, better safe than sorry. I believe this is preexisting, and I didn't feel like changing it in the course of a quick cleanup session.