Skip to content

k256+p256: fix FromUniformBytes impls for Scalar - #1983

Merged
tarcieri merged 1 commit into
masterfrom
fix-from-uniform-bytes
Nov 3, 2026
Merged

tarcieri merged 1 commit into
masterfrom
fix-from-uniform-bytes

Conversation

@tarcieri

@tarcieri tarcieri commented Nov 3, 2026

Copy link
Copy Markdown
Member

As reported in #1981, the trait definition expects the bytes to be interpreted as little endian, but they were being interpreted as big endian, which is a bug.

This commit corrects the issue, adds tests, and delegates to Reduce<U512> impls for Scalar as I originally suggested in #1379.

There wasn't a Reduce<U512> impl for p256::Scalar so this also adds one.

Closes #1981

As reported in #1981, the trait definition expects the bytes to be
interpreted as little endian, but they were being interpreted as big
endian, which is a bug.

This commit corrects the issue, adds tests, and delegates to
`Reduce<U512>` impls for `Scalar` as I originally suggested in #1379.

There wasn't a `Reduce<U512>` impl for `p256::Scalar` so this also adds
one.
@tarcieri
tarcieri merged commit c63dddf into master Nov 3, 2026
32 checks passed
@tarcieri
tarcieri deleted the fix-from-uniform-bytes branch November 3, 2026 00:46
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.

k256 and p256 decode FromUniformBytes input with incorrect endianness

1 participant