-
Notifications
You must be signed in to change notification settings - Fork 223
Description
Following up on #2003 we want to figure out how to implement DigestSigner/Verifier
for PureEdDSA.
With dalek-cryptography/curve25519-dalek#828, we will add DigestSigner/Verifier
implementations directly on SigningKey/VerifiyingKey/Context
, which end up creating a HashEdDSA (ed25519ph) signature.
The initial idea was thrown around to add a hazmat
ZST that would implement DigestSigner/Verifier
for PureEdDSA, using the already available raw_sign_byupdate()
. The reasoning for adding it in hazmat
, is that we can't ensure on a type level that users are really updating the hash function with the same message. I'm not sure how strong that reasoning really holds.
However, thinking about this again, I'm not sure we are going down the right path. Currently DigestSigner/Verifier
is able to offer a trait over various signatures, including ML-DSA, that uses the pre-hash mode of that signature. Even if ML-DSA's pre-hash mode produces the same signature as the regular one.
Re-using that same trait for the regular mode of a signature, would only be applicable for curve25519-dalek
and ed448-goldilocks
, in addition to being behind hazmat
modules (ergo separate types). I'm not sure how valuable a common trait, for different modes, that is only selectively available, is in a real-life scenario.
I'm thinking it might be better if we had a separate trait for regular mode signatures that can really be applied for all signatures. So instead I propose the following:
- Rename
PreHashSigner
toRawPreHashSigner
. - Rename
DigestSigner
toPreHashSigner
, making it clear that this is using the pre-hash mode of the signature. - Add a new
DigestSigner
which uses the regular mode of the signature.
The signature would be the same as the current DigestSigner
, which I believe works fine as all signature algorithms I know of use a hash internally.
I should probably point out that the transition might be problematic for users because we are re-using the DigestSigner
name for a different signature mode.
(I decided to post this here instead of curve25519-dalek
because my concerns about the signature
API, instead of questions about the implementation)