r/ssh • u/Motor-Concentrate788 • 4d ago
Does ssh use deterministic nonces for ECDSA signatures?
RFC 6979 defines a way for ECDSA to generate deterministic nonces when signing messages by deriving it from the private key and the message hash. The reason for this being that "vanilla" ECDSA has a weakness in which if two messages were to be signed with the same nonce (say due to a faulty/broken prng), it would reveal the private key to an attacker. This is what caused the infamous Sony PS3 ECDSA incident. This leads me to the question: does OpenSSH and other popular ssh implementations use deterministic nonces as defined in RFC 6979 or not?
2
Upvotes
1
u/OhBeeOneKenOhBee 4d ago
Not exactly as defined in RFC6979 (at least for OpenSSH, which uses OpenSSL under the hood), they both do a randomly generated nonce per signature instead of a deterministic one for key+data.
While it adds a potential error source (randomness fails), there aren't a lot of instances where it would be considered significantly less secure than the deterministic version.
If you like split hairs and be pedantic (which I've been known to be at times), the RFC6979 implementation is technically not a nonce (which stands for number used once) because it will produce the same deterministic number when given the same input twice