Skip to content

ed25519: deprecate Signature::new in favor of ::from_bytes#401

Merged
tarcieri merged 1 commit intomasterfrom
ed25519/deprecate-new-in-favor-of-from-bytes
Nov 18, 2021
Merged

ed25519: deprecate Signature::new in favor of ::from_bytes#401
tarcieri merged 1 commit intomasterfrom
ed25519/deprecate-new-in-favor-of-from-bytes

Conversation

@tarcieri
Copy link
Copy Markdown
Member

Adds a Signature::from_bytes inherent method which matches the method of the same name on the Signature trait, i.e. it returns a signature::Result.

This method performs a partial range check on the s component of the signature to ensure fit within the order of ~2^(252.5). It won't reject all invalid signatures, but it will detect quite a few of them.

Deprecates the infallible Signature::new method, since it can't detect invalid signatures. While the from_bytes method isn't perfect, it can be improved in the future, whereas an infallible method can't.

@tarcieri tarcieri force-pushed the ed25519/deprecate-new-in-favor-of-from-bytes branch from 7804f39 to cfd3baa Compare November 18, 2021 15:59
Adds a `Signature::from_bytes` inherent method which matches the method
of the same name on the `Signature` trait, i.e. it returns a
`signature::Result`.

This method performs a partial range check on the `s` component of the
signature to ensure fit within the order of ~2^(252.5). It won't reject
all invalid signatures, but it will detect quite a few of them.

Deprecates the infallible `Signature::new` method, since it can't detect
invalid signatures. While the `from_bytes` method isn't perfect, it can
be improved in the future, whereas an infallible method can't.
@tarcieri tarcieri force-pushed the ed25519/deprecate-new-in-favor-of-from-bytes branch from cfd3baa to 6a58487 Compare November 18, 2021 16:03
@tarcieri tarcieri merged commit ec0d8e3 into master Nov 18, 2021
@tarcieri tarcieri deleted the ed25519/deprecate-new-in-favor-of-from-bytes branch November 18, 2021 16:09
@tarcieri tarcieri mentioned this pull request Nov 18, 2021
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.

1 participant