crypto: Clear error after DiffieHellman key errors

Fixes #5499

@bnoordhuis @trevnorris