Classic protocol and crypto cleanups.

Does this take over ownership of key (and, thus, newkey) ?
If not, we're leaking key (and newkey).