-
Notifications
You must be signed in to change notification settings - Fork 481
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
Ristretto compression process with a different basepoint. #284
Comments
I'm afraid the point you selected is not of order
|
Hmmm. It's right, the assertion shouldn't fail if it has order #[test]
fn test_basepoint() {
let point = EdwardsPoint {
X: FieldElement51([881010941142167, 1648694857529964, 470497918313193, 1327361769579760, 108032109768103]),
Y: FieldElement51([23, 0, 0, 0, 0]),
Z: FieldElement51::one(),
T: FieldElement51([2248853136787876, 1891184704225212, 1814252866462463, 1255923122426260, 232938710981134])
};
for i in 2..9 {
let prod = &point * Scalar::from(i as u8);
println!("{:?}", prod);
assert!(prod != point);
assert!(prod != EdwardsPoint::identity());
};
} And it gave:
Identity isn't printed anywhere, and the assertions didn't fail. So as far as I understand, this discards the point of having order: If I'm missing something, excuse me I'm not a cryptographer or anything similar ahaha. |
Hi all, I'm going to be on vacation until the middle of next week but I can check into this when I get back. |
@hdevalence Have a nice vocation! I use the transformation above and translate the edwards point (u,v)=(777614515006863064380223997674220849595901915306045448346376123656982013079,23) to the corresponding montgomery point (x,y)=(31579660701086235115519359547823974869073632181538335647124795638521762629062, 9132590012203147150454691378506969525775439784381435392762152234963404418091):
By translating the point @CPerezz selected to montgomery format, and use the sage script above, it seemed that the point do have the right order and can be act as a basepoint. And I retest it with magma script ( just paste it in http://magma.maths.usyd.edu.au/calc/ ), the same results hold.
magma result:
Anything wrong? |
Oh, I confused myselft. The point @CPerezz selected is of order
|
@3for is right. Sorry for the confusion. I close the issue btw, thanks for the quick responses @3for @hdevalence :) |
Previously it was a 2-tuple containing a `CompressedEdwardsY` serialization and a decompressed `EdwardsPoint`, however using `.0` and `.1` for these respectively makes the code hard to read. This commit changes them to `compressed` and `point`, which as it were are the names of the local variables used when constructing a `VerifyingKey`, which improves clarity.
Due to some issues I've had implementing Ristretto for another curve, I came to the repo to reproduce the behavior that I was experiencing and check it against this implementation by looking and playing with the
ristretto.rs
implementation.How to reproduce the issue:
If I'm not wrong, as it is mentioned on the Decaf paper, and for Ristretto also, for a point, to be a valid Ristretto representation, "inside the 4coset where it lives" it has to be the only point that satisfies:
So, following this, I generated a point in the curve from a random x-coordinate by doing:
After performing the mod_sqrt, I multiplied the point by 8, doing:
The result of the first print wasn't the identity, so it is a basepoint.
On the same test, I declared the resulting point as a
RistrettoPoint
and printed it since theDebug
implementation prints the 4-coset related to the point.From the 4 resulting points, I picked the one that satisfies the requirements mentioned above:
So at this point, we have a Twisted Edwards point, that is a basepoint since it has order
L
and is the validRistrettoPoint
representation inside of it's 4-coset since it satisfies the requirements mentioned above.Issue
The issue appears when I execute:
I added a
println!
statement just before the third compression step is executed (theinv_sqrt
) that prints also theChoice
that the operation returns. So it looks like:This are the outputs:
So, it differs from the comment :
curve25519-dalek/src/ristretto.rs
Line 442 in cf03d39
inv_sqrt()
is not QR.When the
decompress()
function is called, it returns aNone
and debugging the possibleChoice
results that can make the function fail I got:Is this the expected behavior? Since it seems not due to the comments on the code and the statements that appear on:
I'm sorry if any assumption has been done incorrectly from my side or there's any conceptual error.
The text was updated successfully, but these errors were encountered: