Skip to content
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

Conversation

isislovecruft
Copy link
Member

This is only done during signature verification.

This is only done during signature verification.
Copy link

@paragonie-scott paragonie-scott left a 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).

paragonie-security added a commit to paragonie/sodium_compat that referenced this pull request Oct 11, 2019
@isislovecruft isislovecruft merged commit deca36d into dalek-cryptography:develop Oct 11, 2019
isislovecruft added a commit to isislovecruft/ed25519-elisabeth that referenced this pull request Oct 14, 2019
This is only done upon signature deserialisation/verification.
cf. dalek-cryptography/ed25519-dalek#99 for more info.
isislovecruft added a commit to isislovecruft/ed25519-elisabeth that referenced this pull request Oct 15, 2019
This is only done upon signature deserialisation/verification.
cf. dalek-cryptography/ed25519-dalek#99 for more info.
@elichai
Copy link

elichai commented Oct 15, 2019

Pretty damn awesome :)
Someone should write a book full of those tricks lol

tarcieri added a commit to RustCrypto/signatures that referenced this pull request Dec 5, 2019
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
tarcieri added a commit to RustCrypto/signatures that referenced this pull request Dec 5, 2019
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
tarcieri added a commit to RustCrypto/signatures that referenced this pull request Dec 5, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants