Conversation
The wNAF implementation assumes a little endian representation for scalars, but `PrimeField::to_repr` returns an opaque representation which may be big endian and is in the case of our implementations of the NIST P-curves. RustCrypto/ff#10 added a stopgap API: `PrimeField::to_le_repr`, which is guaranteed to return a little endian representation. This commit switches `(rustcrypto-)group` to use it, which should make it compatible with our curves which otherwise use a big endian SEC1 representation.
PrimeField::to_le_repr for scalarsPrimeField::to_le_repr for scalars
Member
Author
|
Confirmed this is working against cc @str4d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The wNAF implementation assumes a little endian representation for scalars, but
PrimeField::to_reprreturns an opaque representation which may be big endian and is in the case of our implementations of the NIST P-curves.RustCrypto/ff#10 added a stopgap API:
PrimeField::to_le_repr, which is guaranteed to return a little endian representation. This commit switches(rustcrypto-)groupto use it, which should make it compatible with our curves which otherwise use a big endian SEC1 representation.Thanks to @tob-scott-a for sleuthing this out in #10.