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

Make the to_bytes/from_bytes round trip of ExpandedSecretKey idempotent #308

Conversation

poljar
Copy link
Contributor

@poljar poljar commented Jun 27, 2023

A mistake snuck in with 9b166b7. The new scalar_bytes field of the ExpandedSecretKey is not used in the ExpandedSecretKey::to_bytes() method, instead the, now clamped, scalar is used.

This in turn means that the following snippet won't produce the same ExpandedSecretKey:

let key = ExpandedSecretKey::from_bytes(bytes);
let another_key = ExpandedSecretKey::from_bytes(&key.to_bytes())

Down the line, it means that serializing/deserializing this struct will produce differing keys and thus spurious signature verification errors.

@rozbb
Copy link
Contributor

rozbb commented Jun 27, 2023

Woah great find. I think this merits a new release. @tarcieri ?

@poljar
Copy link
Contributor Author

poljar commented Jun 27, 2023

Ah, there was a slight copy/paste issue with one of the error messages. Amended with a fixup commit.

@tarcieri
Copy link
Contributor

I think this merits a new release. @tarcieri ?

@rozbb sure, why not

@rozbb
Copy link
Contributor

rozbb commented Jun 30, 2023

@poljar Sorry for the bother, but we just moved ed25519-dalek over to the big monorepo. Would you mind rebasing the PR for there?

@poljar
Copy link
Contributor Author

poljar commented Jun 30, 2023

@poljar Sorry for the bother, but we just moved ed25519-dalek over to the big monorepo. Would you mind rebasing the PR for there?

Sure, no problem.

edit: Done -> dalek-cryptography/curve25519-dalek#541

@poljar
Copy link
Contributor Author

poljar commented Jun 30, 2023

Closing as this has been transferred.

@poljar poljar closed this Jun 30, 2023
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