crypto: fix nits in Sign
crypto: fix nits in Verify
crypto: refactor diffie-hellman