X25519: Change test 101 result to "acceptable" and add "Twist" flag #196
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.
Test case 101 in x25519_test.json uses a public key that lies on the twist of Curve25519, not on the main curve. This PR changes the result from "valid" to "acceptable" and adds the "Twist" flag so it matches with the other twist point tests.
The public key in 101 is:
For a point to be on Curve25519, the value x^3 + 486662x^2 + x must be a quadratic residue (have a square root in the field). Computing the Legendre symbol:
x^3 + 486662x^2 + x = 2b5a0cb55d322bba66520d668373c2f655f4103ff12bfedf527d57b26d5fb505
Legendre symbol = -1 (quadratic non-residue)
This confirms the point is on the twist, not the main curve.
Implementations that reject twist points are making a valid security decision. Masked scalar multiplication implementations (used for side channel protection) may not be able to process twist points. While RFC 7748 recommends accepting all inputs (Section 7 notes rejecting twist points is 'not recommended'), Wycheproof's purpose is really for testing cryptographic correctness and security. Rejecting twist points is stricter than the RFC requires but arguably more secure against invalid curve attacks.
If it helps