Add sanity check after key generation

Add a sanity check to prevent cosmic rays from flipping a bit in the generated public key, or bugs in the elliptic curve code. This is simply done by signing a (randomized) message, and verifying the result.
s/8/sizeof(rnd)/ ? (as you use that below too)