Skip to content

Reject non-canonical Edwards point encodings in _from_edwards - #388

Open
amirulian wants to merge 1 commit into
tlsfuzzer:masterfrom
amirulian:fix-edwards-non-canonical-point
Open

amirulian wants to merge 1 commit into
tlsfuzzer:masterfrom
amirulian:fix-edwards-non-canonical-point

Conversation

@amirulian

Copy link
Copy Markdown
  • Per RFC 8032 Section 5.1.3 (Ed25519) and Section 5.2.3 (Ed448), point decoding must fail if the decoded y coordinate is >= p or if x == 0 and the sign bit x_0 == 1.
  • Currently, AbstractPoint._from_edwards() does not check y >= p (leaving y >= p unreduced in PointEdwards.__coords and allowing non-zero low bits in the 57th byte of Ed448 encodings) and allows x == 0 with x_0 == 1 (since -0 % p == 0, which also allows R = (0, 1) with x_0 = 1 to re-encode to x_0 = 0 via R.to_bytes() during PublicKey.verify()).
  • Raise MalformedPointError in AbstractPoint._from_edwards() when y >= p or x == 0 and x_0.
  • Add unit tests in src/ecdsa/test_eddsa.py.

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