-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimisation for signature verification to succeed fast in checking the scalar #99
Optimisation for signature verification to succeed fast in checking the scalar #99
Conversation
This is only done during signature verification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your reasoning is sound and the implementation of this logic (bytes[3] & 240 == 0)
matches the comment (assuming that bytes are little-endian; which, for every Ed25519 implementation I've seen, holds true).
Based off jedisct1/libsodium#884 which is, in turn, based off dalek-cryptography/ed25519-dalek#99 Thanks @isislovecruft
This is only done upon signature deserialisation/verification. cf. dalek-cryptography/ed25519-dalek#99 for more info.
This is only done upon signature deserialisation/verification. cf. dalek-cryptography/ed25519-dalek#99 for more info.
Pretty damn awesome :) |
Ensures that the three highest bits of the `s` scalar component of an Ed25519 signature are unset. This doesn't ensure that `s` is fully reduced (which would require a full reduction check in the event that the 4th most significant bit is set), however it will catch a number of invalid signatures relatively cheaply. Inspired by: dalek-cryptography/ed25519-dalek#99
Ensures that the three highest bits of the `s` scalar component of an Ed25519 signature are unset. This doesn't ensure that `s` is fully reduced (which would require a full reduction check in the event that the 4th most significant bit is set), however it will catch a number of invalid signatures relatively cheaply. Inspired by: dalek-cryptography/ed25519-dalek#99
Ensures that the three highest bits of the `s` scalar component of an Ed25519 signature are unset. This doesn't ensure that `s` is fully reduced (which would require a full reduction check in the event that the 4th most significant bit is set), however it will catch a number of invalid signatures relatively cheaply. Inspired by: dalek-cryptography/ed25519-dalek#99
This is only done during signature verification.